[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.7.2 Two axes in one plot
Developing the previous hint one can make a plot with 2 or more axes. The idea is that the change of settings does not influence on the already drawn graphics. So, for 2-axes plot let us set the first axis and draw everything concerning it. Then let us setup the second axis and draw things for the second axis. The corresponding code is (see section 2-axes sample):
// set up first axis Axis(mglPoint(-1,-1,-1),mglPoint(1,1,1),mglPoint(-1,-1,-1)); Axis(); // draw it Plot(y1,"b"); // draw something in first axis // set up second axis Axis(mglPoint(0,0,0),mglPoint(1,1,1),mglPoint(1,1,1)); Axis(); // draw it Stem(y2,"r"); // draw something in second axis
Note, that the first and the second axes look better if being placed in different corners. In the code presented above the first axis is placed in the left-bottom corner, and the second one is placed in the right-top corner.