soccer jersey forums.silverfrost.com :: View topic - Limitation of number of plots in %PL
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 

Limitation of number of plots in %PL
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Tue Oct 05, 2021 8:16 am    Post subject: Limitation of number of plots in %PL Reply with quote

Paul,
What is the limit on number of curves with %PL if they are built as "independent" ? I tried more than 10 curves but failed. I remember we discussed here that it would be great to increase this. Is it doable or needs much work ?

Tried to reproduce this nice plot made ages ago using professional contour software. The greatness of it is that it actually displays the evolution movie in one static XY plot !


Last edited by DanRRight on Tue Oct 05, 2021 11:05 pm; edited 2 times in total
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Tue Oct 05, 2021 10:13 am    Post subject: Reply with quote

Dan,

This should work, the thing to remember is that 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@.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Oct 05, 2021 5:17 pm    Post subject: Reply with quote

The following sample program illustrates a way to draw multiple curves on one set of axes via a callback function. Details can be found in cwplus.enh.

Code:
      WINAPP
      MODULE mymod
      USE mswin
      INTEGER,PARAMETER::N=11
      DOUBLE PRECISION x(N),y(N)
      CONTAINS
      INTEGER FUNCTION cb()
      DOUBLE PRECISION xx(5),yy(5)
      CALL set_plot_mode@(1)
      CALL set_line_width@(2)
      CALL draw_curvesD@(x,y,N,RGB@(0,0,255))   
      CALL draw_line_betweenD@(0d0, 0d0, x(N), y(N), 255)
      CALL draw_line_betweenD@(0d0, 0d0, x(1), y(1), 255)
      CALL draw_rectangleD@(0.1d0, 0.1d0, 0.3d0, 0.15d0, RGB@(0,255,0))
      CALL draw_filled_ellipseD@(-0.1d0, 0.15d0, 0.04d0, 0.02d0, RGB@(0,255,0))
      CALL draw_charactersD@("Caption", 0.1d0, 0.2d0, 0)
      xx = (/0d0, 0.05d0, 0.05d0, 0d0, 0d0/)
      yy = (/0d0, 0d0, 0.035d0, 0.035d0, 0d0/)
      CALL draw_filled_polygonD@(xx,yy,5,RGB@(0,0,255))
      CALL draw_symbolsD@(x,y,N,11,5,255)
      CALL set_plot_mode@(0)
      cb = 2
      END FUNCTION
      END MODULE mymod
     
      PROGRAM main
      USE mymod
      INTEGER i
      DO i=1,N
        x(i)=0.1d0*(i-6)
        y(i)=x(i)*x(i)
      ENDDO
      i=winio@('%ca[Quadratic]%pv&')
      CALL winop@("%pl[title=Graph]") !graph title
      CALL winop@("%pl[y_max=0.25]")  !maximum y value on axis
      CALL winop@("%pl[x_array]")     !the data provides other max and min values
      CALL winop@("%pl[smoothing=5]")
      CALL winop@("%pl[link=user]")   !all lines and symbols drawn via set_plot_mode@
      CALL winop@("%pl[frame]")
      i=winio@('%^pl&',400,250,N,x,y,cb)
      i=winio@('%sf%ff%nl%cn%tt[OK]')
      END
     
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Tue Oct 05, 2021 9:06 pm    Post subject: Reply with quote

Very cool, thanks, Paul
Here is your example with 50 curves added:
Code:
      WINAPP
      MODULE mymod
      USE mswin
      INTEGER,PARAMETER::N=11
      DOUBLE PRECISION x(N),y(N),xprev(N),yprev(N)
      CONTAINS
      INTEGER FUNCTION cb()
      DOUBLE PRECISION xx(5),yy(5)
      CALL set_plot_mode@(1)
      CALL set_line_width@(2)

      nCurves = 50   
      do ii=0,nCurves   
      y(:) = yprev(:)+0.2/nCurves*ii
      CALL draw_curvesD@(x,y,N,RGB@(max(0,-255+ii*2*255/ncurves),255-abs(255-ii*2*255/ncurves),max(0,255-ii*2*255/ncurves)))
      enddo   
      y(:) = yprev(:)
      CALL draw_line_betweenD@(0d0, 0d0, x(N), y(N), 255)
      CALL draw_line_betweenD@(0d0, 0d0, x(1), y(1), 255)
      CALL draw_rectangleD@(0.1d0, 0.1d0, 0.3d0, 0.15d0, RGB@(0,255,0))
      CALL draw_filled_ellipseD@(-0.1d0, 0.15d0, 0.04d0, 0.02d0, RGB@(0,255,0))
      CALL draw_charactersD@("Caption", 0.1d0, 0.2d0, 0)
      xx = (/0d0, 0.05d0, 0.05d0, 0d0, 0d0/)
      yy = (/0d0, 0d0, 0.035d0, 0.035d0, 0d0/)
      CALL draw_filled_polygonD@(xx,yy,5,RGB@(0,0,255))
      CALL draw_symbolsD@(x,y,N,11,5,255)
      CALL set_plot_mode@(0)
      cb = 2
      END FUNCTION
      END MODULE mymod
     
      PROGRAM main
      USE mymod
      INTEGER i
      DO i=1,N
        x(i)=0.1d0*(i-6)
        y(i)=x(i)*x(i)
      ENDDO
   xprev(:)=x(:)
   yprev(:)=y(:)
      i=winio@('%ca[Quadratic]%pv&')
      CALL winop@("%pl[title=Graph]") !graph title
      CALL winop@("%pl[y_max=0.25]")  !maximum y value on axis
      CALL winop@("%pl[x_max=0.39]")  !maximum X value   <--------------
      CALL winop@("%pl[x_array]")     !the data provides other max and min values
      CALL winop@("%pl[smoothing=5]")
      CALL winop@("%pl[link=user]")   !all lines and symbols drawn via set_plot_mode@
      CALL winop@("%pl[frame]")
      i=winio@('%^pl&',600,400,N,x,y,cb)
      i=winio@('%sf%ff%nl%cn%tt[OK]%es')
      END


By the way i like %es ESCape acceleration key to exit the program. Recommend.

ADDITION: Have you noticed one small defect after i added x_max =marked as <-------- ?


Last edited by DanRRight on Tue Oct 05, 2021 10:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Tue Oct 05, 2021 10:38 pm    Post subject: Reply with quote

Ken,
Your comment how to make n_graphs > 10 usual way i did not understand, sorry Sad. I have done it this way which does not work if i use Nt (number of curves) more than 10. here is working example with 10

Code:

      USE mswin
      INTEGER,PARAMETER:: Nx=11, Nt=10
      DOUBLE PRECISION Xmp(Nx,Nt),Ymp(Nx,Nt)
      integer Np(Nt)
      integer, external :: SnapshotMultiplotPL   

      DO j = 1,Nt
   Np(j) = Nx
        do i = 1,Nx
          Xmp(i,j)=0.1d0 * (i-(Nx+1)/2)
          Ymp(i,j)=Xmp(i,j)**2 + 0.2/Nt * j
        enddo
      endDO


   i=winio@('%ww%fn[Tahoma]%bf&')
   i=winio@('%ts&', 2.0d0)

   call winop@('%pl[x_axis="Radius ( um )"]')
   call winop@('%pl[y_axis="Temperature  ( eV )"]')
   call winop@("%pl[file=MultiplotPL1.set]")   

   i=winio@('%pv%pl[frame,framed,axes_pen=2,frame_pen=2,etched,'//&
           'width=2,x_array,independent,n_graphs=10]%ff&',&
       1000,700, Np,&
       Xmp(1,1), Ymp(1,1), Xmp(1,2), Ymp(1,2), Xmp(1,3), Ymp(1,3),&
       Xmp(1,4), Ymp(1,4), Xmp(1,5), Ymp(1,5), Xmp(1,6), Ymp(1,6),&
       Xmp(1,7), Ymp(1,7), Xmp(1,8), Ymp(1,8), Xmp(1,9), Ymp(1,9),&
       Xmp(1,10),Ymp(1,10))


   i=winio@('%ts&', 1.0d0)     
   i=winio@('%cn%^tt[Snapshot]%es', SnapshotMultiplotPL)

   MultiplotPL = 2
    end ! function
!......................................................
!   ____  __ _   __   ____  ____  _  _   __   ____
!  / ___)(  ( \ / _\ (  _ \/ ___)/ )( \ /  \ (_  _)
!  \___ \/    //    \ ) __/\___ \) __ ((  O )  )( 
!  (____/\_)__)\_/\_/(__)  (____/\_)(_/ \__/  (__)
!......................................................

        integer function SnapshotMultiplotPL()
        use clrwin

   character  PNGfilename*256, chdate*8, chtime*10, chzone*5
   integer ivalues(8)

   call DATE_AND_TIME(chdate, chtime, chzone, ivalues ) ! chdate format 20210504
       PNGfilename='zDesignerPL_'//chdate(1:8)//'_'//chtime(1:6)//'.png'
       
        i = export_image@(trim(PNGfilename))

        call sound@(3000,1)
        call sound@(1000,1)
        call sound@(2000,1)


        SnapshotMultiplotPL= 2
        end function


 


Last edited by DanRRight on Wed Oct 06, 2021 4:59 am; edited 2 times in total
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Wed Oct 06, 2021 4:51 am    Post subject: Reply with quote

And if i just change Nt and n_graphs to 12 and add two more pairs of Xmp, Ymp to make 12 curves then i got crash with the error message "Invalid n_graphs in %PL specification". Here is the full text

Code:
      USE mswin
      INTEGER,PARAMETER:: Nx=11, Nt=12
      DOUBLE PRECISION Xmp(Nx,Nt),Ymp(Nx,Nt)
      integer Np(Nt)
      integer, external :: SnapshotMultiplotPL   

      DO j = 1,Nt
        Np(j) = Nx
        do i = 1,Nx
          Xmp(i,j)=0.1d0 * (i-(Nx+1)/2)
          Ymp(i,j)=Xmp(i,j)**2 + 0.2/Nt * j
        enddo
      endDO


   i=winio@('%ww%fn[Tahoma]%bf&')
   i=winio@('%ts&', 2.0d0)

   call winop@('%pl[x_axis="Radius ( um )"]')
   call winop@('%pl[y_axis="Temperature  ( eV )"]')
   call winop@("%pl[file=MultiplotPL1.set]")   

   i=winio@('%pv%pl[frame,framed,axes_pen=2,frame_pen=2,etched,'//&
           'width=2,x_array,independent,n_graphs=12]%ff&',&
       1000,700, Np,&
       Xmp(1,1), Ymp(1,1), Xmp(1,2), Ymp(1,2), Xmp(1,3), Ymp(1,3),&
       Xmp(1,4), Ymp(1,4), Xmp(1,5), Ymp(1,5), Xmp(1,6), Ymp(1,6),&
       Xmp(1,7), Ymp(1,7), Xmp(1,8), Ymp(1,8), Xmp(1,9), Ymp(1,9),&
       Xmp(1,10),Ymp(1,10),Xmp(1,11),Ymp(1,11),Xmp(1,12),Ymp(1,12))


   i=winio@('%ts&', 1.0d0)     
   i=winio@('%cn%^tt[Snapshot]%es', SnapshotMultiplotPL)

   MultiplotPL = 2
    end ! function


I scaled compiler just one step down, because 8.80 does now allow me to use debugger with other codes and i temporally can not change it to 8.80 because lot of programs are running. Is this the reason possibly?
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Wed Oct 06, 2021 12:59 pm    Post subject: Reply with quote

Dan,

Here is a modification to your second example that now works as expected.

Ken


Code:
      USE mswin
      INTEGER,PARAMETER:: Nx=11, Nt=12
      DOUBLE PRECISION Xmp(Nx,Nt),Ymp(Nx,Nt)
      integer Np(Nt)
      integer, external :: SnapshotMultiplotPL   

      DO j = 1,Nt
        Np(j) = Nx
        do i = 1,Nx
          Xmp(i,j)=0.1d0 * (i-(Nx+1)/2)
          Ymp(i,j)=Xmp(i,j)**2 + 0.2/Nt * j
        enddo
      endDO


   i=winio@('%ww%fn[Tahoma]%bf&')
   i=winio@('%ts&', 2.0d0)

   call winop@('%pl[n_graphs=12]')                                    !###  n_graphs=12  is in the first call to winop@
   
   call winop@('%pl[x_axis="Radius ( um )"]')
   call winop@('%pl[y_axis="Temperature  ( eV )"]')
   call winop@("%pl[file=MultiplotPL1.set]")   

   i=winio@('%pv%pl[frame,framed,axes_pen=2,frame_pen=2,etched,'//&
           'width=2,x_array,independent]%ff&',&                       ! ### n_graphs=12 removed
       1000,700, Np,&
       Xmp(1,1), Ymp(1,1), Xmp(1,2), Ymp(1,2), Xmp(1,3), Ymp(1,3),&
       Xmp(1,4), Ymp(1,4), Xmp(1,5), Ymp(1,5), Xmp(1,6), Ymp(1,6),&
       Xmp(1,7), Ymp(1,7), Xmp(1,8), Ymp(1,8), Xmp(1,9), Ymp(1,9),&
       Xmp(1,10),Ymp(1,10),Xmp(1,11),Ymp(1,11),Xmp(1,12),Ymp(1,12))


   i=winio@('%ts&', 1.0d0)     
   i=winio@('%cn%^tt[Snapshot]%es', SnapshotMultiplotPL)

   MultiplotPL = 2
    end ! function
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Wed Oct 06, 2021 5:54 pm    Post subject: Reply with quote

Ken,
Wow ! Gazillion monkeys randomly hitting keyboards would probably earlier write "War and Peace" than me logically finding this so counterintuitive solution ! Are

Code:
call winop@('%pl[n_graphs=12]')


and

Code:
i=winio@('%pl[n_graphs=12]')


NOT THE SAME ??????

How did you find it?
Paul, how this could ever being included in design ?
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Wed Oct 06, 2021 7:54 pm    Post subject: Reply with quote

Dan,

This works without calls to winop@ before the i=winio@ function call:

Code:
      USE mswin
      INTEGER,PARAMETER:: Nx=11, Nt=12
      DOUBLE PRECISION Xmp(Nx,Nt),Ymp(Nx,Nt)
      integer Np(Nt)
      integer, external :: SnapshotMultiplotPL   

      DO j = 1,Nt
        Np(j) = Nx
        do i = 1,Nx
          Xmp(i,j)=0.1d0 * (i-(Nx+1)/2)
          Ymp(i,j)=Xmp(i,j)**2 + 0.2/Nt * j
        enddo
      endDO


   i=winio@('%ww%fn[Tahoma]%bf&')
   i=winio@('%ts&', 2.0d0)

   i=winio@('%pv%pl[x_axis="Radius ( um )",y_axis="Temperature  ( eV )",'//&
                    'file=MultiplotPL1.set,frame,framed,axes_pen=2,frame_pen=2,etched,'//&
                    'width=2,x_array,independent,n_graphs=12]%ff&',&
       1000,700, Np,&
       Xmp(1,1), Ymp(1,1), Xmp(1,2), Ymp(1,2), Xmp(1,3), Ymp(1,3),&
       Xmp(1,4), Ymp(1,4), Xmp(1,5), Ymp(1,5), Xmp(1,6), Ymp(1,6),&
       Xmp(1,7), Ymp(1,7), Xmp(1,8), Ymp(1,8), Xmp(1,9), Ymp(1,9),&
       Xmp(1,10),Ymp(1,10),Xmp(1,11),Ymp(1,11),Xmp(1,12),Ymp(1,12))

   i=winio@('%ts&', 1.0d0)     
   i=winio@('%cn%^tt[Snapshot]%es', SnapshotMultiplotPL)

   MultiplotPL = 2
    end ! function


This also works, where calls to winop@ "preload" all the %pl configuration data:


Code:
      USE mswin
      INTEGER,PARAMETER:: Nx=11, Nt=12
      DOUBLE PRECISION Xmp(Nx,Nt),Ymp(Nx,Nt)
      integer Np(Nt)
      integer, external :: SnapshotMultiplotPL   

      DO j = 1,Nt
        Np(j) = Nx
        do i = 1,Nx
          Xmp(i,j)=0.1d0 * (i-(Nx+1)/2)
          Ymp(i,j)=Xmp(i,j)**2 + 0.2/Nt * j
        enddo
      endDO


   i=winio@('%ww%fn[Tahoma]%bf&')
   i=winio@('%ts&', 2.0d0)

   call winop@('%pl[n_graphs=12]')
   call winop@('%pl[x_axis="Radius ( um )"]')
   call winop@('%pl[y_axis="Temperature  ( eV )"]')
   call winop@("%pl[file=MultiplotPL1.set]")
   call winop@('%pl[frame,framed,axes_pen=2,frame_pen=2,etched,width=2,x_array,independent]')

   i=winio@('%pv%pl%ff&',1000,700, Np,&
       Xmp(1,1), Ymp(1,1), Xmp(1,2), Ymp(1,2), Xmp(1,3), Ymp(1,3),&
       Xmp(1,4), Ymp(1,4), Xmp(1,5), Ymp(1,5), Xmp(1,6), Ymp(1,6),&
       Xmp(1,7), Ymp(1,7), Xmp(1,8), Ymp(1,8), Xmp(1,9), Ymp(1,9),&
       Xmp(1,10),Ymp(1,10),Xmp(1,11),Ymp(1,11),Xmp(1,12),Ymp(1,12))

   i=winio@('%ts&', 1.0d0)     
   i=winio@('%cn%^tt[Snapshot]%es', SnapshotMultiplotPL)

   MultiplotPL = 2
    end ! function


See items 379, 394 of cwplus.enh
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Wed Oct 06, 2021 11:48 pm    Post subject: Reply with quote

So what was wrong in my 12-curve example versus working 10-curve example? The 2-curves were working, 3-curves were working, 10-cureves were working and abruptly more were not?

!-----------------------------------------
Not related question: In %PL we set the colors of curves this way

CALL winop@("%pl[colour=#110011]")

How to extract this color for using with draw_filled_polygon@ or draw_symbols@ which use RGB@() for setting colors?
How translate #110011 exactly to what rgb@ gives ?

Or if put this different way, is it possible instead of

CALL winop@("%pl[colour=#110011]")

to set the colors somehow this way

CALL winop@("%pl[colour]"), rgb@(x,y,z) ????
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Oct 07, 2021 7:06 am    Post subject: Reply with quote

#110011 is equivalent to RGB@(17,0,17). 11 is hexadecimal so becomes 16+1 decimal. The order is the same so red is #ff0000 and RGB@(255,0,0).

Here is some code that does the conversion...

Code:
write(str,"(a,z6.6,a)") "%pl[colour=#", RGB@(ired,igreen,iblue), "]"
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Thu Oct 07, 2021 9:10 pm    Post subject: Reply with quote

Thanks Ken and Paul for the hints and tips
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Fri Oct 08, 2021 8:17 pm    Post subject: Reply with quote

Here is what i got with multiplot (of course case was different from the one shown in first picture). Ideal for planning experiments
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2863
Location: South Pole, Antarctica

PostPosted: Mon Oct 11, 2021 8:52 pm    Post subject: Reply with quote

I spent a day experiencing another devilry bug after noticing that the order of colors in the plot does not correspond to the order in the time history with numbers at the right. Colors at the right are correct, they correspond to natural palette from violet to red. Order of colors in the plot are wrong. Initial 7-8 times are in correct order with the plot history and then abruptly colors on the plot are turned upside down and start with red down to blue

Tried to change anything but this damn order still persists. If i make small demo like i did above both look in correct order. I used standard method of plotting we discussed with Ken which has strange not yet understood behavior. With Paul's method this would not happen but it is too new to me and i do not feel comfortable yet to jump into it as there could be many other pitfalls
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Tue Oct 12, 2021 5:59 pm    Post subject: Reply with quote

Dan,

For the problem you describe, I would check that each :

CALL winop@("%pl[colour=#110011]") etc

is in the correct order for graphs 1 to N.
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
Goto page 1, 2, 3  Next
Page 1 of 3

 
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