X axis character labels rotated at 45 or 90 degrees in plotXY() or plotScatter()

I am plotting a number of confidence intervals , one for each of about 50 - 60 peptides. These generally go by 3-4 character letter codes, like "EAD", "TET" etc.   I would like to use these labels along the x-axis, and that might be doable if I could run the labels at an angle.  Is this possible?  I was thinking of using added text boxes, but I didn't see how to run these at an angle.    In the old PQG system, adding text at an angle would  be accomplished through _pmsgctl[4]   (" angle in degrees to print string. This may be -180 to 180 relative to the positive X axis.").    Thank you for any help on this

4 Answers



0



You can use plotSetXTicLabel to control the formatting and angle of the X-axis tick labels. Here is a simple example:

new;
cls;

struct plotControl myPlot;
myPlot = plotGetDefaults("xy");

labels = "app" $| "ban" $| "can";
y = { 0.3, 0.8, 0.6 };

// "" --> Leave X-tick label formatting to be default
// 90 --> Draw X-tick label text at 90 degrees
plotSetXTicLabel(&myPlot, "", 90);

plotXY(myPlot, labels, y);

aptech

1,773


0



Thank you for the quick reply - that is very helpful!

The plot was a little more complicated and I didn't explain it well at all.   The 15 peptides are measured in each of 4 groups.  I wanted to plot CIs for peptides 1 - 15 at x = 1 to 15 along the x-axis, in say, blue.   Then the same 15 peptides but for group 2 in positions 16-30 along the x-axis (in say, red), then the CIs for the same peptides for group 3 in positions 31-45 in green... and so on.

So for your example, it would be more like: labels = "app" $| "ban" $| "can" $|  "app" $| "ban" $| "can" and y = {0.3, 0.8, 0.6, 1.1, 0.9, 0.5} and group = {1,1,1,2,2,2}.   I would like to plot x vs y with x = {1,2,3,4,5,6}.   I would add lines at x for the confidence intervals.   If I try plotXY(&myplot, labels, y) , the x-axis will only go from 1 to 3.



0



You could create a 1x3 gird of graphs using plotLayout. Would that work for you?

aptech

1,773


0



Yes - thank you - I should have thought of that.  A 1 x 4 grid with plotlayout() should work, especially if I use plotSetYAxisShow(&myPlot, 0) to shut off the display of the y-axis in plots 2 - 4.   Thanks again.

Your Answer

4 Answers

0

You can use plotSetXTicLabel to control the formatting and angle of the X-axis tick labels. Here is a simple example:

new;
cls;

struct plotControl myPlot;
myPlot = plotGetDefaults("xy");

labels = "app" $| "ban" $| "can";
y = { 0.3, 0.8, 0.6 };

// "" --> Leave X-tick label formatting to be default
// 90 --> Draw X-tick label text at 90 degrees
plotSetXTicLabel(&myPlot, "", 90);

plotXY(myPlot, labels, y);

0

Thank you for the quick reply - that is very helpful!

The plot was a little more complicated and I didn't explain it well at all.   The 15 peptides are measured in each of 4 groups.  I wanted to plot CIs for peptides 1 - 15 at x = 1 to 15 along the x-axis, in say, blue.   Then the same 15 peptides but for group 2 in positions 16-30 along the x-axis (in say, red), then the CIs for the same peptides for group 3 in positions 31-45 in green... and so on.

So for your example, it would be more like: labels = "app" $| "ban" $| "can" $|  "app" $| "ban" $| "can" and y = {0.3, 0.8, 0.6, 1.1, 0.9, 0.5} and group = {1,1,1,2,2,2}.   I would like to plot x vs y with x = {1,2,3,4,5,6}.   I would add lines at x for the confidence intervals.   If I try plotXY(&myplot, labels, y) , the x-axis will only go from 1 to 3.

0

You could create a 1x3 gird of graphs using plotLayout. Would that work for you?

0

Yes - thank you - I should have thought of that.  A 1 x 4 grid with plotlayout() should work, especially if I use plotSetYAxisShow(&myPlot, 0) to shut off the display of the y-axis in plots 2 - 4.   Thanks again.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.