[Scilab-users] figure with several subplots and two y-axes for each subplot

simi99 simon.mayr at gmail.com
Wed Jun 12 15:09:44 CEST 2013


Hello,
I have a question concerning figure plotting in scilab. I want to create a
figure with two subplots. Every subplot should contain two y-axes (left and
right). 
So far so good. My code generates the first subplot with the two y-axes. The
problem occurs adding the second subplot. Executing "subplot(2,1,2) deletes
the second y-axis from subplot(2,1,1). Any idea? Thanks in advance!
Kind regards,
Simon

----------------------
Code without the second subplot:
// Test-Syntax
// Plot

t = 0:0.001:0.1;
x = sin(2*%pi*50*t);
y = cos(2*%pi*50*t);

clf()

subplot(2,1,1)
plot(t,x,"b")
grid on
hold on
xlabel("time")
ylabel("Sinus")
title("tstSyntax - Plotting Styles","fontsize",5) // Titel-Beschriftung mit
Schriftgröße 5
a = gca(); // Get Current Axes (gca)
a.y_location = "left"; // y-Achse links
a.filled = "on"; // Axes Background = Off
a.axes_visible = ["on","on","on"]; //Axes sichtbar
a.font_size = 3; // Schriftgröße Achsenbeschriftung
b = newaxes(); // zusätzliche Achse erstellen
b.y_location = "right"; // y-Achse rechts
b.filled = "off";
b.axes_visible = ["off","on","on"];
b.axes_bounds = a.axes_bounds; // neue Achse auf ersten Subplot begrenzen
b.y_label.text = "Cosinus"; // Achsenbeschriftung (nur bei Achsen die mit
newaxes() erstellt wurden)
b.font_size = a.font_size;
hold on;
plot(t,y,"g")

//subplot(2,1,2)
//plot(t,x.*y,"b")
//grid on
//hold on
//xlabel("time")
//ylabel("x*y")
//a = gca(); // Get Current Axes (gca)
//a.y_location = "left"; // y-Achse links
//a.filled = "on"; // Axes Background = Off
//a.axes_visible = ["on","on","on"]; //Axes sichtbar
//a.font_size = 3; // Schriftgröße Achsenbeschriftung
//b = newaxes(); // zusätzliche Achse erstellen
//b.y_location = "right"; // y-Achse rechts
//b.filled = "off";
//b.axes_visible = ["off","on","on"];
//b.axes_bounds = a.axes_bounds; // neue Achse auf ersten Subplot begrenzen
//b.y_label.text = "x+y"; // Achsenbeschriftung (nur bei Achsen die mit
newaxes() erstellt wurden)
//b.font_size = a.font_size;
//hold on;
//plot(t,x+y,"g")


----------------------
Code with the second subplot:

// Test-Syntax
// Plot

t = 0:0.001:0.1;
x = sin(2*%pi*50*t);
y = cos(2*%pi*50*t);

clf()

subplot(2,1,1)
plot(t,x,"b")
grid on
hold on
xlabel("time")
ylabel("Sinus")
title("tstSyntax - Plotting Styles","fontsize",5) // Titel-Beschriftung mit
Schriftgröße 5
a = gca(); // Get Current Axes (gca)
a.y_location = "left"; // y-Achse links
a.filled = "on"; // Axes Background = Off
a.axes_visible = ["on","on","on"]; //Axes sichtbar
a.font_size = 3; // Schriftgröße Achsenbeschriftung
b = newaxes(); // zusätzliche Achse erstellen
b.y_location = "right"; // y-Achse rechts
b.filled = "off";
b.axes_visible = ["off","on","on"];
b.axes_bounds = a.axes_bounds; // neue Achse auf ersten Subplot begrenzen
b.y_label.text = "Cosinus"; // Achsenbeschriftung (nur bei Achsen die mit
newaxes() erstellt wurden)
b.font_size = a.font_size;
hold on;
plot(t,y,"g")

subplot(2,1,2)
plot(t,x.*y,"b")
grid on
hold on
xlabel("time")
ylabel("x*y")
a = gca(); // Get Current Axes (gca)
a.y_location = "left"; // y-Achse links
a.filled = "on"; // Axes Background = Off
a.axes_visible = ["on","on","on"]; //Axes sichtbar
a.font_size = 3; // Schriftgröße Achsenbeschriftung
b = newaxes(); // zusätzliche Achse erstellen
b.y_location = "right"; // y-Achse rechts
b.filled = "off";
b.axes_visible = ["off","on","on"];
b.axes_bounds = a.axes_bounds; // neue Achse auf ersten Subplot begrenzen
b.y_label.text = "x+y"; // Achsenbeschriftung (nur bei Achsen die mit
newaxes() erstellt wurden)
b.font_size = a.font_size;
hold on;
plot(t,x+y,"g")




--
View this message in context: http://mailinglists.scilab.org/figure-with-several-subplots-and-two-y-axes-for-each-subplot-tp4026837.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list