Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University 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
Is it possible to specify certain plotting properties when using plotyy()?
Posted: Nov 17, 2013 5:40 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I have an unusual set of data that I would like to display using the plotyy() function. Data Set A has pairs of values that need to be connected by a line, but each pair should appear separate from all other pairs. Data Set B consists of values that were collected in between each pair of values from Data Set A. Currently, I have had no problem using the regular plot() function to generate a reasonable plot, although the scale of Set B is not shown. For reference, here is the code for the single-Y-axis plot I generate:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

x_set1 = [1 2];
x_set2 = [3 4];
x_set3 = [5 6];
x_set4 = [7 8];
x_set5 = [9 10];

S1_data_subset1 = [-0.18 -0.18];
S1_data_subset2 = [-0.42 -0.38];
S1_data_subset3 = [-0.42 -0.44];
S1_data_subset4 = [-0.42 -0.48];
S1_data_subset5 = [-0.60 -0.72];

x_learning = [1.5 3.5 5.5 7.5 9.5];
S1_learning = [19 1 1 9 1];

figure;
plot(x_set1, S1_data_subset1,'ko-','LineWidth',2);
hold on;
plot(x_set2, S1_data_subset2,'ko-','LineWidth',2);
hold on;
plot(x_set3, S1_data_subset3,'ko-','LineWidth',2);
hold on;
plot(x_set4, S1_data_subset4,'ko-','LineWidth',2);
hold on;
plot(x_set5, S1_data_subset5,'ko-','LineWidth',2);
hold on;
plot(x_learning, S1_learning,'bo','LineWidth',2);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

However, now I am trying to use the plotyy() function so that Data Set B?s value will have some meaning, and ideally so that I will be able to scale the 2 y axes so that I can match up their 0 values to be the same. However, I?m having difficulty with using plotyy(); the following code:

x_set1 = [1 2];
x_set2 = [3 4];
x_set3 = [5 6];
x_set4 = [7 8];
x_set5 = [9 10];

S1_data_subset1 = [-0.18 -0.18];
S1_data_subset2 = [-0.42 -0.38];
S1_data_subset3 = [-0.42 -0.44];
S1_data_subset4 = [-0.42 -0.48];
S1_data_subset5 = [-0.60 -0.72];

x_learning = [1.5 3.5 5.5 7.5 9.5];
S1_learning = [19 1 1 9 1];

x_learning1 = [1.5];
x_learning2 = [3.5];
x_learning3 = [5.5];
x_learning4 = [7.5];
x_learning5 = [9.5];

S1_learning1 = [19];
S1_learning2 = [1];
S1_learning3 = [1];
S1_learning4 = [9];
S1_learning5 = [1];

[AX1,H1,H2] = plotyy(x_set1,S1_data_subset1,x_learning1,S1_learning1);
hold on;
[AX2,H3,H4] = plotyy(x_set2,S1_data_subset2,x_learning2,S1_learning2);
hold on;
[AX3,H5,H6] = plotyy(x_set3,S1_data_subset3,x_learning3,S1_learning3);
hold on;
[AX4,H7,H8] = plotyy(x_set4,S1_data_subset4,x_learning4,S1_learning4);
hold on;
[AX5,H9,H10] = plotyy(x_set5,S1_data_subset5,x_learning5,S1_learning5);


? generates a figure that is problematic because:
~ there are 2 sets of x axis labels overlaid and it is a mess
~ the second Y axis has multiple values overlaid at each tick mark
~ the Edit -->Axes Properties dialog box only allows me access to the first (and already correct) Y axis
~ I can?t seem to specify the marker types and sizes for the 2 data sets

I have tried to manage the handle properties, but these don?t appear to be able to change the marker size & line style properties that I need to modify.

Does anyone have suggestions about how to solve the above issues? Thanks in advance for your help!



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.