Silverfrost Forums

Welcome to our forums

%pl[native,n_graphs=1]

16 Oct 2023 4:47 #30647

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?

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
17 Oct 2023 5:52 #30648

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+.

17 Oct 2023 10:05 #30651

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.

Please login to reply.