View previous topic :: View next topic 
Author 
Message 
DanRRight
Joined: 10 Mar 2008 Posts: 1933 Location: South Pole, Antarctica

Posted: Tue Jun 18, 2019 1:23 am Post subject: Post the prototype please for multiplot 


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? 

Back to top 


PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 5841 Location: Salford, UK

Posted: Tue Jun 18, 2019 9:11 am Post subject: 


Here is a sample program together with the associated comments...
Code:  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*(i1)
x(i) = xx
xm = 0.1d0
DO j=0,M1
y(i+j*N) = xm*xx
xm = xm + 0.1d0
ENDDO
ENDDO
i=winio@("%ca[Multigraph]&")
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@(255i,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 2dimensional array with the data values on the first index and n ranging from 1 to n_graphs on the second index. 

Back to top 


DanRRight
Joined: 10 Mar 2008 Posts: 1933 Location: South Pole, Antarctica

Posted: Tue Jun 18, 2019 10:07 am Post subject: 


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 resizable
Code:  ix = 400; iy=250
i=winio@('%pv%pl&',ix,iy,N,x,y) 
it does not by some reason resize... 

Back to top 


PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 5841 Location: Salford, UK

Posted: Tue Jun 18, 2019 11:15 am Post subject: 


You probably just need %ww. 

Back to top 


DanRRight
Joined: 10 Mar 2008 Posts: 1933 Location: South Pole, Antarctica

Posted: Tue Jun 18, 2019 9:57 pm Post subject: 


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 ? 

Back to top 


JohnSilver
Joined: 30 Jul 2013 Posts: 1087 Location: Aerospace Valley

Posted: Thu Jun 20, 2019 2:57 am Post subject: 


Dan, I think this (from the online documentation) means yes it can ...
Quote: 
The option [independent] provides for independent xdata for each graph. In this case the number of data points must be presented as a variable (for one graph) or as an array (for one or more graphs) where the array index corresponds to the order in which the graphs are coded. This is also the case for the optional xstart and xincrement data. As a result, these values can be changed after a window has been formed. 
(ref. https://silverfrost.com/ftn95help/clearwinp/simplepl/native.aspx) _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " 

Back to top 


JohnSilver
Joined: 30 Jul 2013 Posts: 1087 Location: Aerospace Valley

Posted: Thu Jun 20, 2019 2:58 am Post subject: 


Paul, is that example in the documentation somewhere ?
The fact that the number of curves is now unlimited (?) should be noted too in the doc. _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " 

Back to top 


DanRRight
Joined: 10 Mar 2008 Posts: 1933 Location: South Pole, Antarctica

Posted: Thu Jun 20, 2019 12:35 pm Post subject: 


Cool 

Back to top 


