Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: 3 Y axes wih 4 variable
Replies: 9   Last Post: Apr 24, 2013 9:28 AM

 Messages: [ Previous | Next ]
 Murat Posts: 7 Registered: 4/20/13
Re: 3 Y axes wih 4 variable
Posted: Apr 23, 2013 7:16 AM

still i couldn't get the what i want. i tried plotyyy , plot4y and after i showed to my teacher he said the curves must be smooth. when i looked for the smooth in plotting 4 'Y' axis i couldn't find any useful thing. and now i looked the adding new plots. but now the axis are on the left side of the original Y axis. please someone help me for this thing. here is a code for plotting 3 Y axis. I want to add 1 Y axis BUT it's the same name as one of the Y axis like in the figure ; http://img401.imageshack.us/img401/1750/3yaxeswith2common.png

%# Some sample data:
x = 0:20;
N = numel(x);
y1 = rand(1,N);
y2 = 5.*rand(1,N)+5;
y3 = 50.*rand(1,N)-50;
y4 = 500.*rand(1,N)+50;

%# Some initial computations:
axesPosition = [110 40 200 200]; %# Axes position, in pixels
yWidth = 30; %# y axes spacing, in pixels
xLimit = [min(x) max(x)]; %# Range of x values
xOffset = -yWidth*diff(xLimit)/axesPosition(3);

%# Create the figure and axes:
figure('Units','pixels','Position',[200 200 330 260]);
h1 = axes('Units','pixels','Position',axesPosition,...
'Color','w','XColor','k','YColor','r',...
h2 = axes('Units','pixels','Position',axesPosition+yWidth.*[-1 0 1 0],...
'Color','none','XColor','k','YColor','m',...
'XLim',xLimit+[xOffset 0],'YLim',[0 10],...
h3 = axes('Units','pixels','Position',axesPosition+yWidth.*[-2 0 2 0],...
'Color','none','XColor','k','YColor','b',...
'XLim',xLimit+[2*xOffset 0],'YLim',[-50 50],...
xlabel(h1,'time');
ylabel(h3,'values');

%# Plot the data:
plot(h1,x,y1,'r');
plot(h2,x,y2,'m');
plot(h3,x,y3,'b');

Date Subject Author
4/20/13 Murat
4/20/13 dpb
4/21/13 Murat
4/23/13 Murat
4/23/13 Murat
4/23/13 dpb
4/23/13 Murat
4/24/13 dpb
4/24/13 Murat
4/24/13 dpb