[scilab-Users] color of a string

Adrien Vogt-Schilb vogt at centre-cired.fr
Thu Apr 5 13:08:49 CEST 2012


On 05/04/2012 12:15, grivet wrote:
> Le 03/04/2012 19:27, Adrien Vogt-Schilb a écrit :
>> On 03/04/2012 17:47, grivet wrote:
>>> Hello,
>>> How can I change the color of a string using Scilab5.3.2?
>>> For instance, I wish to plot two vectors using 
>>> plot2d(u,[a,b],style=[2,14]) and then write a
>>> label next to each curve with xstring(xa,ya,string_a), 
>>> xstring(xb,yb,string_b); this works.
>>> Now, I would like to match the color of the text to that of the 
>>> curves. I tried xset("color",2)
>>> and xset("color",14); this changes the color of the axes (in an 
>>> unpredictable manner) but not
>>> that of the text.
>>> Thanks for your help
>>>
>>>
>> Hi
>>
>> Build on this:
>>
>> plot()
>> xstring(1,0,"ET PAF!")
>> e=gce()
>> e.font_foreground = 3
>>
>> or if you are familiar with RGB 
>> <http://en.wikipedia.org/wiki/RGB_color_model>:
>>
>> e.font_foreground = color(255,100,100)
>>
>> br
>> avs
> Thank you Adrien, this works fine; is there a way to change the color 
> of several strings at the same time
> instead of repeating the sequence xstring(), e = 
> gce(),e.font_foreground = n for each ?
> JP Grivet
Hi

I'd build an upper-level function:

myDEFAULT_color = color(155,120,60);
functionmystring(x,y,str,mycolor)//plots str on x, y in color mycolor. 
mycolor is optional//Default value for 
mycolorifargn(2)<4mycolor=myDEFAULT_colorendxstring(x,y,str)e=gce()e.font_foreground=mycolorendfunction


then use mystring instead of xstring
note that you may omit the last argument








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120405/fff79951/attachment.htm>


More information about the users mailing list