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

Samuel Gougeon sgougeon at free.fr
Sat Mar 5 15:08:16 CET 2016


Hi Claus,

Le 05/03/2016 09:39, Claus Futtrup a écrit :
> 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?).
.
.data_bounds are reliable only if gca().tight_limits="on". Otherwise, 
AFAIK, there is presently no way to get the true bounds of the displayed 
axes. This has been reported.

>
> 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?
.
It is a vector of handles. It points to the set of background rectangles 
generated with xfpolys(). It makes "lighter" forthcoming operations on 
the rectangles.
>
> 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?
Z. It is not assigned by default when the axes is in 2D .view. 
Nevertheless, Z can be set to manage overlays.
This is possible with polylines, but not with the rect graphical type 
(as plotted with fxrects()).

> 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 ??
.
Change the value, and you will see why. No worry, it won't explode :) I 
tried 0, but when it is on the foreground, the grid looks to be set 
between 0 and -1. You can play with .grid_position and the Z value (i 
did it), you will see. The Z of the grid can't be tuned accurately. They 
can have only 2 predefined positions. It is not very efficient. A 
.grid_z attribute would have been better (and clearer)  than 
.grid_position. It could come just by mimicking some other softwares. 
This is too often the very ambition of Scilab : just mimicking others.

Since Scilab does not managed transparency (alpha channel), there will 
be a problem if you draw crossed rectangles. The common part will have 
the color of the highest-z rectangle.
It was formerly possible to tuned the rendering mode -- setting the new 
pixel color according to the current color of the pixel -- but
1) it applied to the whole figure : 
https://help.scilab.org/docs/5.5.2/en_US/pixel_drawing_mode.html
2) it is out-of-work since Scilab > 5.3.3  : 
http://bugzilla.scilab.org/12017

Here is what was possible with 2 octogons filled with bisque and 
powderblue predefined colors,
and the regression brought by Scilab 5.4.0, still unfixed.


Samuel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160305/88eaecac/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixel_drawing_mode_533.png
Type: image/png
Size: 6885 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20160305/88eaecac/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixel_drawing_mode_552.png
Type: image/png
Size: 6551 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20160305/88eaecac/attachment-0001.png>


More information about the users mailing list