The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 7
Registered: 4/20/13
Re: 3 Y axes wih 4 variable
Posted: Apr 23, 2013 7:16 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 ;

%# 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,...
'XLim',xLimit,'YLim',[0 1],'NextPlot','add');
h2 = axes('Units','pixels','Position',axesPosition+yWidth.*[-1 0 1 0],...
'XLim',xLimit+[xOffset 0],'YLim',[0 10],...
h3 = axes('Units','pixels','Position',axesPosition+yWidth.*[-2 0 2 0],...
'XLim',xLimit+[2*xOffset 0],'YLim',[-50 50],...

%# Plot the data:

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.