forums.silverfrost.com
Welcome to the Silverfrost forums

Author Message
John-Silver

Joined: 30 Jul 2013
Posts: 890

Posted: Thu Sep 13, 2018 9:49 pm    Post subject: Native %pl - Bug #101 (Minor) - Axis Captions Positioning

Native %pl - Bug #101 (Minor) - Axis Captions Positioning ... Strategy Not Robust

So, here we go then ... one at a time as requested....
In previous posts the question of axis captions being placed centred on the +ve prt of an axis has been raised.

At one point in reply Paul you wrote to the effect that 'that's the way most people would want it'.
(the precise post where you wrote that escapes me for the moment but
I'll post it here when I next come across it !)

Your statement is partly true, if given the caveat .... " providing all the data to be plotted is positive !"

So, I've taken Dan's short code in the post:
http://forums.silverfrost.com/viewtopic.php?t=3487&postdays=0&postorder=asc&start=360
and slightly modified it to give the exception that breaks the rule ....

Here's the test code, based on Dan's 'Beautified Version' ....

 Code: !       v 2b1a2    use clrwin    parameter (N=5)    real*8 X(N), Y(N)    Data X/1e1, 1e2, 1e3,  1e4, 1e5/    Data Y/-2.2, -66, -8333, -1111, -777/    i=winio@('%sf%ts%bf%es&', 2d0)    call winop@("%pl[axes_pen=3,width=3,x_axis='X Axis Title',y_axis='Y Axis Title']")    i=winio@('%ww%pv%pl[native,framed,x_array,scale=linear,N_GRAPHS=1]', 625,500, n, X, Y)    end

And here's what it produces ....

So, it can be clearly seen why the default for placement of the y-axis caption needs to be in the centre of the overall y-axis.

The same should obviously apply to the x-axis caption when all or the majority of x-axis values are negative !

In the case where ticks&labels (and hence captions) are placed on the outside of the frame (via option [frame]) the central caption strategy would always work.

HOWEVER (isn't there always at least one !), for the default case where 'axes are axes' as it were ...

Applying globally a 'centralised caption' strategy, when both axes have both +ve and -ve values the captions on one axis would 'cross' the other axis (and it's labels).
So clearly for the general case, some level of 'intelligent selection' of the captions locations is appropriate.
Maybe, by comparing the captions' strings lengths with the lengths of the +ve and -ve range axes lengths and then selecting the appropriate one along which to place the caption ?

Note : way back on the 4th-5th May 2017 myself and Ken Smith made some comments about the need for better captions positioning here: http://forums.silverfrost.com/viewtopic.php?t=3487&postdays=0&postorder=asc&start=30
_________________
''Computers are incredibly fast, accurate, and stupid. Human beings are incredibly slow, inaccurate, and brilliant. Together they should be powerful beyond imagination. But ...''
PaulLaidler

Joined: 21 Feb 2005
Posts: 5462
Location: Salford, UK

 Posted: Fri Sep 14, 2018 7:36 am    Post subject: Thanks John. I will take a look at this when I can and then get back to you for the next one.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 Hour Page 1 of 1