How to Calculate Plot Height?

17 views
Skip to first unread message

David Armour

unread,
Nov 30, 2022, 4:11:48 AM11/30/22
to dislin-users
I would like to automate the calculation for the parameters that go in AXSPOS and AXSLEN however I cannot figure out how to calculate the overall plot height.

In some cases I need to rotate the X-Axis labels to be vertical which then means I need more space.

How can I calculate the points from the top of the TITLIN #1 down to the bottom X_AXIS, and then from the X_AXIS to the bottom of the X_AXIS TITLE?

Using this data I believe I could correctly set my AXSPOS and AXSLEN parameters so that my plot always fits in the page.

Helmut Michels

unread,
Nov 30, 2022, 5:43:34 AM11/30/22
to dislin-users
Hi Dave,

you can get the width and height of a plot with the routine getpag. For example, Dislin uses this values
for setting the default axis lengths to 2/3 of the page length and height.

The top position of the first title line is:

        ytop = nya - nyl - nshift  - 2 * nh  - 3 * (xlinsp * nh) - nh

where

       nya is the y-position of the bottom x-axis   (the value in axpos (nxa, nya));
       nyl is the length of the y-axis;
       nshift is the shift parameter defined by vkytit. The default value is 0;
       nh  is the character height of the title lines defined by height or htitle;
       xlinsp is the  line space factor defined by linesp. The default value is 1.5;
       2 * nh is the space between the top x-axis and the bottom of title line # 4.

The bottom position of the first title line is then:

       ybottom =  ytop + nh

The formulas above are only correct if the origin of the page is located in the upper
left corner, which is the default.

Perhaps, it's easier for you to write the title with the Dislin routine messag at your
own position.

With best regards,

Helmut

David Armour

unread,
Nov 30, 2022, 9:23:14 PM11/30/22
to dislin-users
Hi Helmut,

Thanks for that info. My problem is the plot falling off the bottom of the page when I rotate the X-Axis labels vertically. How do I get the size of the labels in points for the DISLIN generated labels (e.g. dates) and their position below the X-Axis?

Rgds,
David

David Armour

unread,
Dec 4, 2022, 8:56:49 AM12/4/22
to dislin-users
Hi,

Does anyone know how to do this?

Rgds,
David

Helmut Michels

unread,
Dec 4, 2022, 3:31:20 PM12/4/22
to dislin-users
the length of numbers and strings  can be calculated with the functions
nlnumb and nlmess. So, you have to find the longest label and calculate the length of it.
If the labels are in numeric format, it can easily be done from the axis parameters in graf.
For date labels it's a little bit more complicate. I think that you have to use the longest possible
date string. The distance of the labels from an axis is defined by the routines labdis and ticlen,
where the position of the ticks is also important.
Reply all
Reply to author
Forward
0 new messages