forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

%pl[native,n_graphs=1]

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Mon Oct 16, 2023 5:47 pm    Post subject: %pl[native,n_graphs=1] Reply with quote

In the following code y = x**2 is plotted using 6 different sets of %pl options (using 64 bit compiler with checkmate - so by default we are using the native %pl).

In the second case, a blank graphics region is produced, which can be corrected by adding the n_graphs=1 option. The default value for n_graphs is 1, and this declaration is not required in the other cases.

It's not clear to me why n_graphs=1 is required in one particular case, but not in any of the others? Is this a bug or am I missing something here?

Code:
program p1
use clrwin
implicit none
real*8 :: y1(1:10), x1(1:10), xstart=1.d0, dx=1.d0
integer :: i
x1 = [(i, i=1,10)]
y1 = [(i**2, i=1,10)]

! Without x_array option

i = winio@('%pl[native]',           500,500,10,xstart,dx,y1)  ! This produces the expected plot. 
                                                              ! The [native] option is the default for the 64 bit compiler
                                                              ! so this declaration is redundant.  Yet removing it changes
                                                              ! the outcome.
                                                                 
i = winio@('%pl',                   500,500,10,xstart,dx,y1)  ! This produces a blank plot. #####
                                                              ! To get back to the expected plot add [n_graphs = 1]
                                                                 
i = winio@('%pl[n_graphs=1]',       500,500,10,xstart,dx,y1)  ! This produces the expected plot.  But n_graphs = 1 is the
                                                              ! default (as in the first example) so why is this necessary?

                                                              ! Shouldn't the first two winio calls produce identical plots?
! With x_array option

i = winio@('%pl[native,x_array]',    500,500,10,x1,y1)        ! This produces the expected plot.
i = winio@('%pl[x_array]',           500,500,10,x1,y1)        ! This produces the expected plot. n_graphs=1 is not required.
i = winio@('%pl[x_array,n_graphs=1]',500,500,10,x1,y1)        ! This produces the expected plot.
 
end program p1
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Oct 17, 2023 6:52 am    Post subject: Reply with quote

Ken

There is something that needs fixing here and, unless I report back, you can assume that it will be fixed.

The original %pl design for SimplePlot allowed for a maximum of 10 graphs and this effectively becomes the default value of n_graphs though fewer that 10 naturally works correctly.

The rule for the native %pl is that, if you want more than 10 graphs then n_graphs must be the first option. Even so, your code does reveal a bug in ClearWin+.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Tue Oct 17, 2023 11:05 am    Post subject: Reply with quote

No problem Paul, I will leave this one with you.

If the user always specifies a value for n_graphs the issue does not arise, which is probably the reason I did not find this earlier as that is generally something I habitually do.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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