Matlab's own help gives the solution to have two axes on any type of plots:Īx2 = axes('Position',get(ax1,'Position'). Jiro's solution is good (file Exchange function), however, it does not allow to use Matlab's built-in plot functions (bar, scatter, etc.), and you have to use plot2axes instead. You may try this submission to MATLAB File Exchange - PLOT2AXES. I think basically I need away to find the minimum y value in my plot at intervals along the x-axis (if my x-axis goes from 0 - 100 I would think 10 points would suffice). It has given me an idea of how to achieve what I need. Ylabel(hNewAxes, 'scale 2') % Add a label to the right y axis This was food for thought so thanks for your time. HNewAxes = axes('Position', axesPosition. Set(gca, 'Box', 'off') % Turn off the box surrounding the whole axesĪxesPosition = get(gca, 'Position') % Get the current axes position Ylabel(gca, 'scale 1') % Add a label to the left y axis If you want a super-simple DIY solution, you can try this: plot(rand(1, 10)) % Plot some random data There are a number of good suggestions on this closely related question, although they deal with a more complicated situation than yours.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |