Silverfrost Forums

Welcome to our forums

Post the prototype please for multiplot

18 Jun 2019 12:23 #23797

I need to plot in one graph like 50 XY plots. This is useful for overview of large data. All curves depend on the same X. Unfortunately I have not followed development of %PL for the last year or so but remember Paul planned to realize this option. Can anyone post simplest possible working demo?

18 Jun 2019 8:11 #23798

Here is a sample program together with the associated comments...

      WINAPP
      INCLUDE <windows.ins>
      INTEGER M,N,i
      PARAMETER(N=11,M=20)
      REAL*8 xm,x(N),y(M*N)
      CHARACTER(len=24) str
      DO i=1,N
        xx = 0.1d0*(i-1)
        x(i) = xx
        xm = 0.1d0
        DO j=0,M-1
         y(i+j*N) = xm*xx
         xm = xm + 0.1d0
        ENDDO
      ENDDO
      i=winio@('%ca[Multi-graph]&')
      CALL winop@('%pl[n_graphs=20]') !20=M
      CALL winop@('%pl[stacked]')
      CALL winop@('%pl[x_array]')
      CALL winop@('%pl[x_max=1.0]')
      CALL winop@('%pl[dx=0.1]')
      CALL winop@('%pl[smoothing=4]')
      !Various line colours going from blue to red...
      DO j=1,M
        i = 255*j/M
        write(str,'(a,z6.6,a)') '%pl[colour=#', RGB@(255-i,0,i), ']'
        CALL winop@(trim(str))
      ENDDO  
      i=winio@('%pl&',400,250,N,x,y)
      i=winio@('%ff%nl%cn%tt[OK]')
      END

The value of n_graphs was limited to a maximum of 10. This limit has now been removed. If n_graphs > 10 and more than one related call is made to winop@ then the value of n_graphs must be included in the first call to winop@. A new %pl option [stacked] is provided for large values of n_graphs in order to avoid multiple winio@ arguments for the y arrays (and the x arrays when they are 'independent'). [stacked] treats the y data as one large array with the values for the second graph added to the end of those for the first and so on (similarly for independent x arrays). If each graph has the same number of points, this is equivalent to using a 2-dimensional array with the data values on the first index and n ranging from 1 to n_graphs on the second index.

18 Jun 2019 9:07 #23799

That was exactly what i needed, thanks Paul! Looks also very nice. We have so much data generated by PIC codes that to find optimum often the only way is to plot huge amount of plots or make a movie just not to miss some rear or sharp peak value

The only what i failed with this demo is that when i add %pv to make plot to be re-sizable

      ix = 400; iy=250 
      i=winio@('%pv%pl&',ix,iy,N,x,y) 

it does not by some reason resize...

18 Jun 2019 10:15 #23800

You probably just need %ww.

18 Jun 2019 8:57 #23801

Yes, %ww solves this. Very common time trap, by the way, which annoyed me in the past a lot. Because everything else works without %ww. And typically in couple years user forgets this again. I already discussed this here i think after getting kick from %pv 😃. As a potential suggestion, can CWP be made accepting %pv without %ww ? And if not, or not desirable, then to warn user in popup screen to add %ww ? This will make CWP more user friendly.

In the [independent] mode when x values are different for each of the n_graphs can number of X points N be also made independent ?

20 Jun 2019 11:35 #23814

Cool

24 Jun 2019 12:55 #23844

ClearWin+ has been modified in order to allow %pv (and resizing) without %ww. This is experimental and will appear in the next release of the DLLs.

Please login to reply.