[Scilab-users] Plot w. part of background in a different color

Claus Futtrup cfuttrup at gmail.com
Sat Mar 5 09:39:32 CET 2016


Hi there

Thank you Samuel, it was very helpful. I have a few follow-up questions

I do a double-log plot.

a.log_flags = "lln"; // double-log plot
a.auto_scale = "off";

When I plot the polygons, then I use data_bounds now, but on the y-axis, 
the axis goes a bit further_

ymin = a.data_bounds(3);
ymax = a.data_bounds(4); // if ymax = 20.1 ... then plot goes to 30 !
xfpolys([f(im1) f(im2) f(im2) f(im1) ; f(ie1) f(ie2) f(ie2) f(ie1)]', ..
[ymin ymin ymax ymax; ymin ymin ymax ymax]', [color("bisque") 
color("scilabpink")]);

Is there a way to determine what is the upper limit for the y-axis? ... 
a.axes_bounds doesn't seem to be helpful in any way (or am I looking in 
the wrong place?).

a.grid_position = "foreground"; // put grid in the foreground - in front 
of the polygons
a = a.children(1).children; // what does this do?

As the comment says - what does children(1).children do?

a.line_mode="off"; // don't 'box/frame'the polygons (background squares)
a(1).data(:,3)=-1; // data(:,1) = xaxis data, data(:,2) = yaxis data
a(2).data(:,3)=-1; // data(:,3) = ???

We set data(:,3) = -1 ... I can see the content in ,2 and ,1 ... but 
what's in the third column? and why do we set it = -1 ?? ... I see a(1) 
= first polygon (a 'box' in our case) and that a(2) = second 
polygon-box. So is the third  column = z-axis data? ... Why do we need 
to make sure z-axis data are negative = -1 ??

Best regards,
Claus

On 04-03-2016 23:06, Samuel Gougeon wrote:
> Hello Clauss,
>
> Here is an example that you may customize:
> x  =  linspace(0,10,100);
> clf
> drawlater
> plot(x,sin(x))
> xgrid(color("grey70"))
> xfpolys([2  5  5  2  ;  7  8.5  8.5  7]',[-1  -1  1  1;  -1  -1  1  1]',..
>           [color("scilabpink")  color("bisque")])
> r  =  gca();
> r.grid_position  =  "foreground";
> r  =  r.children(1).children;
> r.line_mode="off";
> r(1).data(:,3)=-1;
> r(2).data(:,3)=-1;
> drawnow
>
>
> HTH
> Samuel
>
> Le 04/03/2016 21:54, Claus Futtrup a écrit :
>> Hi there
>>
>> A friend of mine uses Python matplotlib for some graphs and I'd like 
>> to generate similar graphs in Scilab.
>>
>> I've attached an example of such a plot.
>>
>> What I'd like to replicate is part of the background shaded in green 
>> and red.
>>
>> I think the function in Python matplotlib is something like:
>>
>> axvspan (xmin,xmax,ymin=0,ymax=1,hold=None, **kwargs)
>>
>> The kwargs are named arguments, for example: facecolor='g',alpha=0.1
>>
>> Examples here: 
>> http://matplotlib.org/examples/pylab_examples/axhspan_demo.html
>>
>> http://physicalmodelingwithpython.blogspot.no/2015/08/function-arguments-args-and-kwargs.html 
>>
>>
>> How would I do similar stuff in Scilab? (Searching for vspan and 
>> hspan didn't give any hits).
>>
>> Best regards,
>> Claus
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160305/5281407b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 8975 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20160305/5281407b/attachment.png>


More information about the users mailing list