Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Is it possible to specify certain plotting properties when using plotyy()?
Replies: 5   Last Post: Nov 21, 2013 2:08 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kate J.

Posts: 177
Registered: 6/9/11
Re: Is it possible to specify certain plotting properties when using plotyy()?
Posted: Nov 18, 2013 2:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Thanks for your response, Steven.

>> Don't call PLOTYY multiple times. Instead, make use of the fact that PLOT
>> and PLOTYY treat NaN values in the data to be plotted as "blanks"

>> M1 = [x_set1, NaN, x_set2, NaN, x_set3, NaN];
>> M2 = [x_learning1, NaN, x_learning2, NaN, x_learning3, NaN];
>> Y1 = [S1_data_subset1, NaN, S1_data_subset2, NaN, S1_data_subset3, NaN];
>> Y2 = [S1_learning1, NaN, S1_learning2, NaN, S1_learning3, NaN];
>> [AX, H1, H2] = plotyy(M1, Y1, M2, Y2);

Your suggested code above is a good start. However, I still have some lingering problems:

~ I would like to have substantial markers for each data point (e.g. o or triangle markers), particularly for Data Set B, which, if the markers aren't enlarged, appear only as tiny, almost invisible single pixels. However, I can't seem to change the marker size using plotyy() in the same way that this can easily be done using plot().

~ I'm not sure how to specify the axes limits. I would like the left Y axis to have limits of [-2, 2] and the right Y axis to have limits of [0,20] (or, if possible, to have the 0 values of both axes line up, and include -20 as the lower limit on the right axis). It doesn't appear that the 'Alim' property is what I should modify, and if I try to do this, nothing changes. If there is only one variable for the axis, how would it be possible to change the properties of 2 different axes?

~ Also, I would like to add labels to both Y axes, but similarly to the axes limits issue above, I'm not sure how to specify this using plotyy(). If I try to do

set(AX, 'Ylabel', 'Mean Rating Value'); ... I get an error that the 'value must be a handle'; however, if I try set(H1,'Ylabel','Mean Rating Value'); , I get:
??? Error using ==> set
There is no 'Ylabel' property in the 'lineseries' class.

Thanks for any insights you have!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2016. All Rights Reserved.