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

Samuel Gougeon sgougeon at free.fr
Fri Mar 4 23:06:18 CET 2016


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

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


More information about the users mailing list