PLOTYY Label Vertical Axis

46 次查看(过去 30 天)
figure (7)
plotyy(x1-11100,y1,x2,y2, 'stairs', 'plot')
Is 'stairs' 'plot' really necessary? What do these represent in plotyy?
title('Force vs. Time')
xlabel('Time (s)');
How would I label the left and right vertical axis?

采纳的回答

Walter Roberson
Walter Roberson 2012-11-5
'stairs' in that position instructs plotyy() to call stairs() plot for the first set of data. Use whichever plotting routine is appropriate for your data representation.
To label the two axes independently, record the output of plotyy()
ax = plotyy(x1-11100,y1,x2,y2, 'stairs', 'plot');
Then index result to specify which axis you want
ylabel(ax(1), 'Major Force');
ylabel(ax(2), '2 Star General Force');
  2 个评论
T
T 2012-11-5
perhaps I shold have used what was in the help menu,
what is stairs and plot were replaced with function1 and function2 what then would this represent? It doesn't even show up on the graph. If it instructs plotyy() to call function1() plot for the first data set, how do I access it?
Walter Roberson
Walter Roberson 2012-11-5
编辑:Walter Roberson 2012-11-6
As the help says,
plotyy(X1,Y1,X2,Y2,FUN) uses the plotting function FUN
instead of PLOT to produce each graph. FUN can be a
function handle or a string that is the name of a plotting
function, e.g. plot, semilogx, semilogy, loglog, stem,
etc. or any function that accepts the syntax H = FUN(X,Y).
For example
plotyy(X1,Y1,X2,Y2,@loglog) % Function handle
plotyy(X1,Y1,X2,Y2,'loglog') % String
Make sure that you use the @ form if you are calling a local function; the string form will only work if the name of the function is known at the base workspace level (e.g. a .m file with the name exists). The function so called would have to contain calls to graphics routines such as line() to do the actual graphing.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Two y-axis 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by