I made a plot and wanted to add a second y-axis with different units of measurement.
Here is what I did:
...
...
plot(x,y,x,y1,x,y2)
ax1=gca;
set(gca,'YTickLabel',num2str(get(gca,'YTick').'))
legend('0.5 atm','1 atm','2 atm','Location','best')
title('H_2S equilibrium partial pressure for different total pressures')
xlabel('Temperature (K)')
ylabel('Partial pressure (Pa)')
hold on
ax2 = axes('Position',ax1.Position,...
'YAxisLocation','right',...
'Color','none');
ax2.YLim = [0 0.25];
ax2.XTick = [];
ylabel(ax2,'Partial pressure (atm)') % label right y-axis
How do I get the right label to have the same padding between itself and the edge of the figure as the left label and border?
(view the picture on a dark background to see what I mean)
I've just discovered export_fig.
It automatically crops extra space from plots and also adds nifty features, such as anti-aliasing!