Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Questions about plotyy in Matlab

  1. Aug 17, 2011 #1
    Here is the relevant piece of code as it stands now:

    [AX,H1,H2] = plotyy(plot2data(:,1),plot2data(:,2),plot2data(:,1),...
    set(get(AX(1),'Ylabel'),'String','Mean Value of C_{a}','Color','k')
    set(get(AX(2),'Ylabel'),'String','Mean Value of C_{b}','Color','k')
    legend('Mean Value of C_{a}','Mean Value of C_{b}','Location','West');

    I have two questions. The first is that I want both vertical axes to be black - I'm currently getting different colors. The first two set commands above change the color of the axis label, but the numbers along the axes remain different colors. How can I change those?

    The second question is: How can I change the range on one or both of the vertical axes? My immediate desire would be to do something like

    axis tight

    but only on AX(2).

  2. jcsd
  3. Aug 18, 2011 #2


    User Avatar
    Science Advisor

    I can't give you an exact answer, but you may be able to find the parameter you need with the Interactive Plotting Tool:
    http://www.mathworks.com/help/techdoc/creating_plots/f9-47085.html [Broken]

    Good luck!
    Last edited by a moderator: May 5, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook