|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Tue Oct 17, 2017 7:42 pm Post subject: |
|
|
Silicondale
I've seen this problem with the y axis label positioning as well. If the range of y axis data is positive, the label is positioned centred at ymax/2, which is fine for a range where ymin is zero, but results in the label being plotted off the graphics area for some data sets. In your case I would guess it has been centred at y = 204000.
A quick for now is to make the y_axis label a blank string using
call winop@('%pl[y_axis=@]')
(just in case it just creeps into your plot), and add the label using a call back function to draw the text on the graphics region. My post above (Thu Sep 28, 2017 12:49 am) shows the basic idea using a call to draw_characters@
If your colour ramp is drawn in a separate gr region, you could instead draw it to internal memory and then copy across to the pl region using COPY_GRAPHICS_REGION@ as part of the call back function.
Or if it exists as an external file by using IMPORT_IMAGE@, again as part of the call back. |
|
Back to top |
|
|
silicondale
Joined: 15 Mar 2007 Posts: 245 Location: Matlock, Derbyshire, UK
|
Posted: Tue Oct 17, 2017 10:46 pm Post subject: |
|
|
Thanks for the suggestions, Ken!
I've only started playing with the new native %pl but I see you already have quite a few tricks of the trade!
-Steve |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Thu Oct 19, 2017 12:11 pm Post subject: |
|
|
Silicondale,
That's a good and simple scaling routine, but if you use it in the following code and run with 32 bit and 64 bit and compare the outputs you get a surprise as the return values are sufficiently different to cause problems with your 'nice' graph scales.
Code: | program main
real*8 upr, alr
upr = 3.1d0
alr = 0.0d0
call v_autsca (upr, alr)
write(6,*) upr, alr
end |
Change one line from size = 10.0**lr to size = 10.d0**lr and 32 bit and 64 bit will return the same values, and avoid surprises later. |
|
Back to top |
|
|
silicondale
Joined: 15 Mar 2007 Posts: 245 Location: Matlock, Derbyshire, UK
|
Posted: Thu Oct 19, 2017 12:34 pm Post subject: |
|
|
Good suggestion! As I said, the routine is decades old. I wrote it originally in the 1970s when graphics meant Calcomp pen plotters! 64-bit coding wasn't something we even considered then. Double precision was used sparingly and only when absolutely necessary, because of memory constraints. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2816 Location: South Pole, Antarctica
|
Posted: Tue Oct 24, 2017 6:43 am Post subject: |
|
|
One more devilry. When I compile my or Ken's programs from previous pages 9-10 of this thread
Code: | real*8, dimension (5) :: X = (/1., 20., 60., 200., 600./)
real*8, dimension (5) :: Y1 = (/2.9e4, 300., 3., 0.2, 0.0022/)
real*8, dimension (5) :: Y2 = (/2.5e4, 500., 2., 0.4, 0.042/)
real*8, dimension (5) :: Y3 = (/2.2e4, 722., 2., 0.5, 0.072/)
CALL DIAGLV (0)
CALL TEXTMN(0.4) ! setting font size
CALL AXLBJS('*C','C') ! centering tic labels
call thckmg('LINE',4.) ! setting line width
call chset(-11) ! setting fonts
!... Case of two lines of Fortran source code
i=winio@('%ww%pv%pl[title="STANDARD IEC IDMT CHARACTERISTICS", x_axis="Multiple of setting current",y_axis="Relay operating time&
& [s]", colour=red, colour=blue, colour=green, X_ARRAY, N_GRAPHS=3, SCALE=LOG_LOG]%es', 640, 480, 5, X, Y1, Y2, Y3)
End |
I get
Code: | 0001) real*8, dimension (5) :: X = (/1., 20., 60., 200., 600./)
*** This statement contains an illegal character - ' '
0002) real*8, dimension (5) :: Y1 = (/2.9e4, 300., 3., 0.2, 0.0022/)
*** This statement contains an illegal character - ' '
0003) real*8, dimension (5) :: Y2 = (/2.5e4, 500., 2., 0.4, 0.042/)
*** This statement contains an illegal character - ' '
0004) real*8, dimension (5) :: Y3 = (/2.2e4, 722., 2., 0.5, 0.072/)
*** This statement contains an illegal character - ' '
0006) CALL DIAGLV (0)
*** This statement contains an illegal character - ' '
0007) CALL TEXTMN(0.4) ! setting font size
*** This statement contains an illegal character - ' '
0008) CALL AXLBJS('*C','C') ! centering tic labels
*** This statement contains an illegal character - ' '
0009) call thckmg('LINE',4.) ! setting line width
*** This statement contains an illegal character - ' '
0010) call chset(-11) ! setting fonts
*** This statement contains an illegal character - ' '
0010) call chset(-11) ! setting fonts
*** Invalid character ' ' at start of line
*** Invalid character ' ' at start of line
11 ERRORS [<main program> FTN95 v8.10.0]
*** Compilation failed
|
Anyone can check why invisible character is inserted? |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Tue Oct 24, 2017 8:30 am Post subject: |
|
|
Dan,
I don't get these messages.
Could the file be changed from ASCII Encoding ( see FILE > Advanced Save )
Compile with /lis and look at default compile options you are using
John |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Tue Oct 24, 2017 9:58 pm Post subject: |
|
|
I have the same problem as Dan. Looking at the original source code I posted, and the results of copying/pasting from the forum, it seems that single spaces are fine, but every two consecutive spaces in the source file are replaced by one space and one non printing character in the forum text. There are more than 40 of these in Dan's post above. Definitely devilry at work! |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Wed Oct 25, 2017 4:06 am Post subject: |
|
|
Ken,
How are you copying from the post ?
I am copying from Win 7-Internet Explorer V11 to Notepad and saving (ctlC ctlV). I do not get any strange characters.
The following is a scan of the file I get. Code: | [List Ver 1.61 8-Jun-16]
file name: dan_post.txt
/control selected
Opening file dan_post.txt iostat = 0
[63] real*8, dimension (5) :: X = (/1., 20., 60., 200., 600./) <CR><LF>
[65] real*8, dimension (5) :: Y1 = (/2.9e4, 300., 3., 0.2, 0.0022/) <CR><LF>
[64] real*8, dimension (5) :: Y2 = (/2.5e4, 500., 2., 0.4, 0.042/) <CR><LF>
[64] real*8, dimension (5) :: Y3 = (/2.2e4, 722., 2., 0.5, 0.072/) <CR><LF>
[ 0] <CR><LF>
[31] CALL DIAGLV (0) <CR><LF>
[50] CALL TEXTMN(0.4) ! setting font size <CR><LF>
[54] CALL AXLBJS('*C','C') ! centering tic labels <CR><LF>
[53] call thckmg('LINE',4.) ! setting line width <CR><LF>
[49] call chset(-11) ! setting fonts <CR><LF>
[ 0] <CR><LF>
[46] !... Case of two lines of Fortran source code <CR><LF>
[130] i=winio@('%ww%pv%pl[title="STANDARD IEC IDMT CHARACTERISTICS", x_axis="Multiple of setting current",y_axis="Relay operating time& <CR><LF>
[117] & [s]", colour=red, colour=blue, colour=green, X_ARRAY, N_GRAPHS=3, SCALE=LOG_LOG]%es', 640, 480, 5, X, Y1, Y2, Y3) <CR><LF>
[ 0] <CR><LF>
[ 3] End
Count of active characters in file dan_post.txt
16 lines identified if text file
820 characters read from file dan_post.txt
Number of <lf> characters = 15 30
Number of <cr> characters = 15 30
Number of <ht> characters = 0
Number of ctrl characters = 0 0
Number of blank characters = 179
Number of number characters = 105
Number of alfa characters = 505 789
Number of other characters = 0 0
Number of lines identified = 16
Maximum line length found = 130
DOS format lines identified
|
The following link is the scan_file.f95 program I used to produce the report.
https://www.dropbox.com/s/trk4k3acmj4gz9e/scan_file.f95?dl=0
It appears that only some of you are possessed !!
John |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Wed Oct 25, 2017 6:39 am Post subject: |
|
|
John, Confirmed there's no problem using Internet Explorer, but if you switch to Microsoft Edge which became the default on my main machine following a recent Windows 10 update the problem occurs.
Ken |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2816 Location: South Pole, Antarctica
|
Posted: Wed Oct 25, 2017 8:24 am Post subject: |
|
|
Good catch, Ken. Google Chrome has no problems too.
It was always very bad thing to be among first testers of Microsoft bugware. The only reason MS is still not bankrupt is that it was chosen not by computer revolution or free competition but exclusively by organized finances to make it a monopoly. |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Oct 27, 2017 2:23 am Post subject: |
|
|
I tried out your scales generation code with some random values and got the following results.
There is a problem when the scales go negative.
I made a simple mod to the code (see below) and that problem sėdisappears.
The results from the modded code show that a) there is still a problem for log-log case when '0' is selected as an end of range.
Also, for smaller graphs up to 10% 'white space' on one end of graph could be a 'luxurious' luxury. It can be solved relatively easily by going down an order of magnitude on that side to minimise the white space to 1% max.
here are the results
ans here is the modified code ...
Code: | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine v_autsca (upr, alr)
implicit double precision (a-h,o-z)
!
! ************************************************************
! * v_autsca auto-scaling algorithm ... sets min and max *
! * values for plotting at round numbers which *
! * include the full data range. alr and upr on input*
! * hold the raw values, on output hold the rounded *
! * values *
! ************************************************************
! first make sure alr and upr are the right way round!
if (upr.lt.alr) then
t = upr
upr = alr
alr = t
end if
!
range = abs(upr - alr)
if ( range.le.1.0e-6 ) go to 9000
rl = alog10(range)
lr = int(rl) - 1
size = 10.0**lr
up = upr/size
al = alr/size
if(up.ge.0.0) then
up = (aint(up) + 1.0)*size
else
up = (aint(up))*size
endif
if(al.ge.0.0) then
al = (aint(al))*size
else
al = (aint(al - 1.0))*size
endif
upr = up
alr = al
9000 return
end |
|
|
Back to top |
|
|
silicondale
Joined: 15 Mar 2007 Posts: 245 Location: Matlock, Derbyshire, UK
|
Posted: Fri Oct 27, 2017 9:27 am Post subject: |
|
|
Many thanks for those tests, John! - and the code update. Of course I should have said that the main purpose of the original coding was geographic plots where we never had either negative coordinate values or logarithmic transforms! National Grid and UTM coordinates are always positive. Yes, one of my colleagues did write a version of this routine which allows specification of the orders of magnitude to use, but I no longer have a copy of that. As for transformed data, not just logarithmic but also probability scales, which we did use for geochemical data, we either took the easy way out and hard-coded the limits or we applied this scaling on log values after conversion. For the probability scale, this is always from 0 to 1 - but since (like with logarithms) both ends go off to infinity, we used a standard range of 0.0001 to 0.9999 |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2816 Location: South Pole, Antarctica
|
Posted: Fri Oct 27, 2017 10:07 am Post subject: |
|
|
BTW, I prefer this single line shortcuts for y_min and y_max which are used in
Code: | call winop@("%pl[y_min=Axis_min"]') | when the plotted data has minimum and maximum values y0min and y0max
Code: | Axis_min = 10.d0**(int(log10(max(1d-30,y0min))))
Axis_max = 10.d0**(int(log10(max(1d-30,y0max)))) |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Sat Oct 28, 2017 7:24 am Post subject: |
|
|
If there is a consensus on the best algorithm to provide nice limits then I could add a new option to apply it. |
|
Back to top |
|
|
silicondale
Joined: 15 Mar 2007 Posts: 245 Location: Matlock, Derbyshire, UK
|
Posted: Sat Oct 28, 2017 9:49 am Post subject: |
|
|
Paul - not sure you'll get consensus on this - or even if setting "nice" limits is something that should be done within %pl. However, there are two things that I think would be much more useful (for me at least!) -
(1) when plotting points, allow each point to have its own symbol, size, and colour - so instead of just x,y arrays we have x,y,sym,size,RGB arrays. Maybe there's already a way to do this, but I haven't found it yet. Could even add an array with the link values, but since this controls the linkage between points it isn't a property that refers to just one point, unless you make it a property defining the link from the previous point in the list.
(2) to allow multiple over-plotting of sets of points and lines on the same graph. For example, coastlines of a set of islands with points (as in (1) above) scattered over each island. Actually N_GRAPHS may already do what we need, so perhaps this is already available. Limit needs to be increased to something much bigger than 10 ! The problem with N_GRAPHS is that the argument list for the %pl call can get very long if you have a lot of different x,y arrays, and you need to know in advance exactly how many - it can't easily (or maybe not at all) be changed at run time.
If (1) is implemented, there is much less of a requirement for (2).
Just my two-penn'orth |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|