Discussion:
[Scilab-users] Plot with 2 y-axes
Richard llom
2017-06-26 22:51:34 UTC
Permalink
Hello fellow scilab-users,
I'm having a hard time creating a plot with two y-axes. This is what I tried
so far:

// Visualization
clf();
// Channel 1
plot2d(1:10,1:10);
ax1=gca();
ax1.x_label.text="time";
ax1.y_label.text="ch1";
ax1.y_location="left";
ax1.foreground=5;
ax1.font_color=5; // red

// Channel 2
ax2=newaxes();
plot2d(1:10,5:-0.25:2.75);
ax2.y_label.text="ch2";
ax2.y_location="right";
ax1.foreground=2;
ax2.font_color=2; // blue

1.
First of all I'm missing my first plot. It seems to be erased by the 2nd
one, although in the help it says "By default, successive plots are
superposed."???

2.
For channel 1 I want to have all information in red, that is the line,
y-axes, y-label but not x-axes. Same for ch2 but in blue. How do I achieve
this?

3.
Is it possible to create a third y-axes like this:
Loading Image...
?

Many Thanks,
richard



--
View this message in context: http://mailinglists.scilab.org/Plot-with-2-y-axes-tp4036672.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
Samuel Gougeon
2017-06-27 07:12:29 UTC
Permalink
Hello,
There are 2 demos named plotyy() and plotyyy() that are examples that
you can edit and mimick, about this topic.
In addition, it was already dealt with in some quite recent threads in
this mailing list. You may have a look to the archives.
Regards
Samuel
Post by Richard llom
Hello fellow scilab-users,
I'm having a hard time creating a plot with two y-axes. This is what I tried
// Visualization
clf();
// Channel 1
plot2d(1:10,1:10);
ax1=gca();
ax1.x_label.text="time";
ax1.y_label.text="ch1";
ax1.y_location="left";
ax1.foreground=5;
ax1.font_color=5; // red
// Channel 2
ax2=newaxes();
plot2d(1:10,5:-0.25:2.75);
ax2.y_label.text="ch2";
ax2.y_location="right";
ax1.foreground=2;
ax2.font_color=2; // blue
1.
First of all I'm missing my first plot. It seems to be erased by the 2nd
one, although in the help it says "By default, successive plots are
superposed."???
2.
For channel 1 I want to have all information in red, that is the line,
y-axes, y-label but not x-axes. Same for ch2 but in blue. How do I achieve
this?
3.
https://i.stack.imgur.com/BYFr4.png
?
Many Thanks,
richard
--
View this message in context: http://mailinglists.scilab.org/Plot-with-2-y-axes-tp4036672.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
http://lists.scilab.org/mailman/listinfo/users
Richard llom
2017-06-27 11:33:51 UTC
Permalink
Hello Samuel,
I couldn't find plotyy in the help, neither does plotyy() work for me:
"Undefined variable: plotyy"

I will take a look at the archives...

regards
richard



Hello,
There are 2 demos named plotyy() and plotyyy() that are examples that
you can edit and mimick, about this topic.
In addition, it was already dealt with in some quite recent threads in
this mailing list. You may have a look to the archives.
Regards
Samuel
Post by Richard llom
Hello fellow scilab-users,
I'm having a hard time creating a plot with two y-axes. This is what I tried
// Visualization
clf();
// Channel 1
plot2d(1:10,1:10);
ax1=gca();
ax1.x_label.text="time";
ax1.y_label.text="ch1";
ax1.y_location="left";
ax1.foreground=5;
ax1.font_color=5; // red
// Channel 2
ax2=newaxes();
plot2d(1:10,5:-0.25:2.75);
ax2.y_label.text="ch2";
ax2.y_location="right";
ax1.foreground=2;
ax2.font_color=2; // blue
1.
First of all I'm missing my first plot. It seems to be erased by the 2nd
one, although in the help it says "By default, successive plots are
superposed."???
2.
For channel 1 I want to have all information in red, that is the line,
y-axes, y-label but not x-axes. Same for ch2 but in blue. How do I achieve
this?
3.
https://i.stack.imgur.com/BYFr4.png
?
Many Thanks,
richard
--
View this message in context: http://mailinglists.scilab.org/Plot-with-2-y-axes-tp4036672p4036681.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
Samuel Gougeon
2017-06-28 08:37:15 UTC
Permalink
Post by Richard llom
Hello Samuel,
"Undefined variable: plotyy"
My fault: demos are not named plotyy() and plotyyy() but plotyy and plotyyy.
There are usages without dedicated functions. In the demos GUI:
--> demo_gui // go to the Graphics => 2D and 3D plot section

To get documentation on the archives, you may use for instance
--> uman plotyy|plotyyy @

after having installed uman:
--> atomsInstall uman


Samuel
Richard llom
2017-06-28 11:35:33 UTC
Permalink
Hi Samuel,
thanks I already figured it out with demo_gui and by searching the archive.

So for the record:
For my case I needed to create 3-axes:
1 for each extra y-axe and one "virtual" to get the x-axe in its own color
scheme.

This is the code I ended up with:




--
View this message in context: http://mailinglists.scilab.org/Plot-with-2-y-axes-tp4036672p4036692.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
Loading...