I want to set up Y, such as ytics(0,80,10,0), how to do it in blow code?
load aou nou t; baka=100; x = t[1:baka]; y = aou[1:baka,.]/30; /* Graphics */ //Declare the structure struct plotControl myPlot; //Initialize the structure myplot = plotGetDefaults("xy"); //Set new line colors clrs = "green"$|"red"$|"midnight blue"; plotSetLineColor(&myPlot, clrs); //Set line style newStyle = 1*ones(2,1); plotSetLineStyle(&myPlot, newStyle); plotSetXLabel(&myPlot, "Time", "English111 Vivace BT", 30, "black"); plotSetYLabel(&myPlot, "Environmental fluctuation", "Century New", 25, "black"); plotSetXTicInterval(&myPlot,baka/5, 0); plotSetGrid(&myPlot, "off"); plotSetLegend(&myPlot,"off"); plotxy(myplot,x,y); end;
2 Answers
0
Use the scalePlot1 procedure from this link right after your call to plotXY, like this:
plotXY(myPlot, x, y);
//Make Y-axis range from 0 to 80
scalePlot1(minc(x)|minc(x), 0|80);
end;
The scalePlot1 procedure takes a 2x1 vector for the minimum and maximum of X and a 2x1 vector for the minimum and maximum of Y. Since we do not wish to expand the X axis in this case and scalePlot1 does not contract the axes (it will only expand them), we can pass in any values that are in the range of your X data. Here we arbitrarily choose the minimum values of X.
For the Y-axis, we pass in the 2x1 vector with 0 as the first element and 80 as the second. This will make sure that the Y-axis will range from 0 to 80 even if your Y data does not extend that far.
NOTE: scalePlot1 will apply changes to an already created graph, so it must be called after the main plot call as shown in this example.
0
this only give us the min and max Y, how to control the step and minor subdivisions. Like we can do with ytics()?
Your Answer
2 Answers
Use the scalePlot1 procedure from this link right after your call to plotXY, like this:
plotXY(myPlot, x, y);
//Make Y-axis range from 0 to 80
scalePlot1(minc(x)|minc(x), 0|80);
end;
The scalePlot1 procedure takes a 2x1 vector for the minimum and maximum of X and a 2x1 vector for the minimum and maximum of Y. Since we do not wish to expand the X axis in this case and scalePlot1 does not contract the axes (it will only expand them), we can pass in any values that are in the range of your X data. Here we arbitrarily choose the minimum values of X.
For the Y-axis, we pass in the 2x1 vector with 0 as the first element and 80 as the second. This will make sure that the Y-axis will range from 0 to 80 even if your Y data does not extend that far.
NOTE: scalePlot1 will apply changes to an already created graph, so it must be called after the main plot call as shown in this example.
this only give us the min and max Y, how to control the step and minor subdivisions. Like we can do with ytics()?