gno*_*ice 16
关于这个密切相关的问题,有很多好的建议,尽管它们处理的情况比你的情况更复杂.如果你想要一个超简单的DIY解决方案,你可以试试这个:
plot(rand(1, 10)); % Plot some random data
ylabel(gca, 'scale 1'); % Add a label to the left y axis
set(gca, 'Box', 'off'); % Turn off the box surrounding the whole axes
axesPosition = get(gca, 'Position'); % Get the current axes position
hNewAxes = axes('Position', axesPosition, ... % Place a new axes on top...
'Color', 'none', ... % ... with no background color
'YLim', [0 10], ... % ... and a different scale
'YAxisLocation', 'right', ... % ... located on the right
'XTick', [], ... % ... with no x tick marks
'Box', 'off'); % ... and no surrounding box
ylabel(hNewAxes, 'scale 2'); % Add a label to the right y axis
Run Code Online (Sandbox Code Playgroud)
这是你应该得到的:
您可以尝试将此提交到MATLAB文件交换 - PLOT2AXES.
PLOT2AXES示例http://www.mathworks.com/matlabcentral/fx_files/7426/2/plot2axes.png