[Scilab-users] plot2d3()

Samuel Gougeon sgougeon at free.fr
Sat Apr 24 19:39:28 CEST 2021


Le 12/04/2021 à 07:39, Federico Miyara a écrit :
>
> Dear All,
>
> I'm trying to get a plot like this:
>

Nice plot (a Power Spectrum Density after applying an open window()..? :-))


> where I intend to get a line plot where the lines come from the bottom 
> of the plot instead of coming from 0 as is the normal way using 
> plot2d3().
>
> To get this with plot2d3() I had to plot the y axis data + 50 in order 
> to make the botom of the plot coincident with 0, and then fake the 
> labels using
>
>
> gca()..y_ticks.labels = 
> ["-50","-45","-40","-35","-30","-25","-20","-15","-10","-5","0","5","10"]';
>
>
> To get the circles I had to use plot() with "o" as third argument 
> since plot2d3() doesn't accept it.
>
> Is there a more direct way to get such result
>
> Is a there some way of achieving this in a more tative way?


Good question!
I see two issues with this trial:

  * setting y_ticks labels by hand cancels the auto_ticking mode for
    ordinates, if we resize the graphic window
  * The y value on datatips becomes wrong

There could be a solution using gca().ticks_st(:,2), but... 
gca().ticks_st does not work <http://bugzilla.scilab.org/14790> (no 
workaround found to make it working).
When this will be fixed, the following code could be tested:

[n,  ybase]  =  (10,  -12);
y  =  ybase  +  9*grand(1,n,"def");
clf,  plot(y(:),  "-o")
set(gce().children,  "polyline_style",3,  "line_mode","off");
gca().axes_reverse(2)  =  "on";
gca().ticks_st(:, 2)  =  [-1;-14];

It should set correct -- and auto_ticked -- y values, with lines 
starting from the bottom.
But i wonder if default datatips take the .ticks_st property into 
account to display correct values.

In the meantime, here is another possible workaround, that is both 
auto_ticking and with correct datatiped values:

// Raw data [n,  ybase]  =  (10,  -12);
y  =  ybase  +  9*grand(1,n,"def");
// Actual data y  =  [ybase*ones(y);  y  ;  ybase*ones(y)];
x  =  (1:n)  .*.  [1  1  1];
// Plotting clf,  plot(x(:),  y(:),  "-o")
set(gce().children,  "mark_stride",3,  "mark_offset",1);

Regards
Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20210424/66185c78/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bjohlbeipdpbnclh.png
Type: image/png
Size: 10483 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20210424/66185c78/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lfignlgimicaeben.png
Type: image/png
Size: 10469 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20210424/66185c78/attachment-0001.png>


More information about the users mailing list