Contents Previous Next

8.18 Rotating graphs 90 degrees

In section 10.2 you can read about arbitrary rotation of the graphs. For most practical purposes rotation of 90 degrees is most useful. This could for example be used to plot horizontal bar graphs.

The slight complication with general rotation is that the margins also rotates, this means that if you rotate a graph 90 degrees the left margin in the image was originally the bottom margin. In additional by default the center of the rotation is the center of the plot area and not the entire image (if all the margins are symmetrical then they will of course coincide). This means that depending on your margin the center of the rotation will move. You can read more about this and how to manually set the center for rotation in the section about rotation, 10.2

This is just a slight inconvenience which you have to take into account when you need to set an explicit margin with a call to Graph::SetMargin()

However, in order to make a rotation of 90 degrees much easier you can easily rotate a graph 90 degrees and set the correct margin with a call to Graph::Set90AndMargin() The parameter to this method lets you specify the margins as you will see them in the image without having to think of what becomes what after the rotation.

So, the only thing you need to do is call this method and then the graph will have been rotated 90 degrees.


Contents Previous Next