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?
0 个评论
采纳的回答
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 个评论
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 Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!