Author |
Topic  |
|
oloughcd
Australia
2 Posts |
Posted - 07/04/2002 : 02:53:07 AM
|
Hi,
I'm plotting data to a log time scale with time measured in hours. However, the time goes from 10 hours up to 100,000 hours so it is difficult to interpret in terms of days or even years. Is it possible (in Origin 6.1) to have an additional x-axis which only spans from say 8760 hours (1 year) to 87600 hours (10 years). This axis would be displayed either above or below the "main" x-axis.
Thanks,
Con |
|
Jose
Netherlands
93 Posts |
Posted - 07/05/2002 : 07:15:33 AM
|
You can add a second layer with no data, just to make another x-axis, in a few steps:
a) If you have a top x-axis in your main layer, remove it first of all. To do this double click on it, go to the "Tile & Format" tab, and uncheck "Show axis and ticks". Do the same with the "Ticks and labels" tab in case you have ticks.
If you don't have a top x-axis, forget this first point.
b) Click: Edit -> New layer -> (linked) Top X.
c) Make the new top axis log-scaled too, as the main layer is log-scaled.
d) Having this second layer active, select Format -> Layer and go to the "Link Axes Scale" tab. There select "X axis link: Custom", and type these equations in the custom text boxes:
X1= X1/8760 X2= X2/8760
With this you'll have a top x-axis in years. This is still not exactly what you want, because this will show a range from about 1e-4 years to 10 years, and you prefer to begin the top axis in about 1 year. You could have skipped step d), and do the following instead:
To gain precission, make both layers to have their dimensions measured in pixels: Format -> Layer -> Size/Speed -> Units: Pixels (this for them two).
Then go to the script window and run this short script:
layer2.x.from=1; layer2.x.to=10;
i=(log(layer2.x.from*8760)-log(layer1.x.from))/(log(layer1.x.TO)-log(layer1.x.from))*layer1.width; j=(log(layer2.x.to*8760)-log(layer1.x.from))/(log(layer1.x.TO)-log(layer1.x.from))*layer1.width;
layer2.left=layer1.left+i; layer2.width=j-i;
The first two lines will set the range of the top axis from 1 year to 10 years.
The next two lines calculate from what point to what point, measured from the left of the main layer, must the second layer be placed to show its years coordinates in the proper place.
The last two lines change the position and width of the second layer to display it properly.
To run the above script, copy and paste it in the script window, then select it all and press enter. To display the Script Window in case it is hidden, go to Window -> Script window. If the code doesn't run, verify in the script window that Edit -> Script Execution is checked.
Remember to execute again the code every time you change the x-range of the main layer or its position, to place the second properly.
If you use Origin 7 the tick labels of your year-axis may appear too close to each other. In this case, execute this command in the script window and then refresh the graph:
@TL=1;
Read this topic for further details on this.
Jose Via, Origin WebRing member
Edited by - Jose on 07/05/2002 07:47:53 |
 |
|
oloughcd
Australia
2 Posts |
Posted - 07/08/2002 : 04:01:21 AM
|
Jose,
Thanks for that!
Con |
 |
|
|
Topic  |
|
|
|