plotyy with axis for each plot only on one side
显示 更早的评论
The following code shows my problem. plotyy completely fails if the ticks are not at the same positions on both sides (which is rather the normal case...)
I require a plot with two y axis but the ticks only on one side. I was suggested to use addaxis, but I do not see how that helps me, since I do not want separated axis.
clf;
clc;
xaxis = 0:0.1:25;
y1 = linspace(12.1712,12.7679, length(xaxis));
y2 = linspace(0.3597,-28.7745, length(xaxis));
[AX,H1,H2] = plotyy(xaxis, y1, xaxis, y2);
% axis limits - x axis (min to max)
xlimits(1) = min(xaxis); xlimits(2) = max(xaxis);
set(AX, 'XLim', xlimits);
set(AX(2),'XTick',[]);
% y1 axis limits
ylimits(1) = min(ydata1); ylimits(2) = max(ydata1);
ylimits(2) = ylimits(2) + (ylimits(2)-ylimits(1))*0.05;
set(AX(1), 'YLim', ylimits);
% y2 axis limits
ylimits(1) = min(ydata2); ylimits(2) = max(ydata2);
ylimits(2) = ylimits(2) + (ylimits(2)-ylimits(1))*0.05;
set(AX(2), 'YLim', ylimits);
% y1 ticks
set(AX(1),'YTick',[12.0:0.1:12.8]);
% y2 ticks
set(AX(2),'YTick',[-25:5:0]);
print(gcf, ['-r' num2str(400)], ['test' '.png' ], ['-d' 'png']);
I would like to provide an example picture, but this forum does not allow to add images.
If this is not solvable with matlab, I will have to suggest the person which asked me if their data can be plotted with matlab to use something different.
1 个评论
the cyclist
2012-2-11
It is a shame that we cannot upload an image directly here. Instead, you can upload an image to a free site and link here. Here are some suggestions: http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!