replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Native %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 

Native %pl
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  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: 2927
Location: South Pole, Antarctica

PostPosted: Thu Mar 16, 2017 8:45 am    Post subject: Reply with quote

Noticed that I call the plot with one single line of Fortran source like this

call winop@(charvar, N, ix,iy, X, Y1, Y2, Y3, Y4, Y5, Y6)

to plot up to 6 curves **dynamically** - and not as if it was programmed ones for one case and you can not change anything without recompilation? This is because you can edit charvar in this window, showed in the previous post, you can update the plot the way you want dynamically. This charvar contain all the settings for the plot, and it is saved into the file each time you plot, so next time you just call the program and the plot looks perfect as you left it.

If I was not clear in previous message what I suggest to Silverfrost to think about to get ultimate easiness for the new %pl here is the picture which is as usually better then 100 words : if place the icon in the corner (marked as #1), and when the changes of the graph will be needed invoke it with right mouse. There is menu for better looking settings then the one single long heap of all things in charvar.



This is how OriginLab is doing that
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 16, 2017 9:21 am    Post subject: Reply with quote

Dan

Thanks for the feedback but there are no plans to do further work on the native %pl.

If you find any bugs then please let me know.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Thu Mar 16, 2017 1:08 pm    Post subject: Reply with quote

I did not test native ℅pl yet but hope with last release some obvious defects we discussed before were fixed (if first user already said "the new %pl is really good". Litle bit more polishing and all will say "i love it" ).

One of such i'd say "bugs" was the axis and tic marks linewidth which was just single pixel wide. Ideally would be to make separate option for axis linewidth and curves linewidth not just one single linewidth parameter for both curves and axis like in older Simpleplot's ℅pl. That control over small details in grapgics looks like minor unimportant matter but it is exactly what distinguish beauty and ugliness. Beauty is skin deep (and ugly down to the bones)
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Fri Mar 17, 2017 1:07 pm    Post subject: Reply with quote

Using %`pl I can get the handle of the graphics region created by %pl, so I should be able to create a graphics region in memory into which I can copy four separate %`pl graphic areas and export them as a single image.

The following code does this, and creates an image as required. However then the user selects exit, an access violation occurs. I've hit a bit of brick wall over the last few days on this. Is there anything obviously wrong in the code?

Thanks

Ken

Code:
module plot_mod
implicit none
integer, parameter :: npts = 100
integer, parameter :: hand_p1 = 1, hand_p2 = 2, hand_p3 = 3, hand_p4 = 4, hand_p5 = 5
integer, parameter :: gw = 300, gh = 250
real(kind=2) time(1:npts), s1(1:npts), s2(1:npts), s3(1:npts), s4(1:npts)
contains

  integer function generate_time_series()
    real(kind=2) t, dt, omega
    integer i
    t = 0.d0 ; dt = 0.001d0 ; omega = 2.d0*4.d0*(atan(1.d0))*50.d0
    do i = 1, npts, 1
      time(i)=t ; s1(i)=sin(omega*t) ; s2(i)=cos(omega*t) ; s3(i)=s1(i)+s2(i) ; s4(i)=s3(i)*s3(i) ;t=t+dt
    end do
    generate_time_series = 1
  end function generate_time_series

  integer function plot_time_series()
  include<windows.ins>
  integer i
    i = winio@('%ww&')
    i = winio@('%mn[Close]&','EXIT')
    i = winio@('%mn[Save_plot]&',save_plot_cb)
    call winop@("%pl[native]")
    call winop@("%pl[x_array]")
    call winop@("%pl[COLOUR=RED]")
    call winop@("%pl[smoothing=4]")
    i = winio@('%`pl&',gw,gh,npts,time,s1, hand_p1)
    call winop@("%pl[native]")
    call winop@("%pl[x_array]")
    call winop@("%pl[COLOUR=blue]")
    call winop@("%pl[smoothing=4]")
    i = winio@('%`pl&',gw,gh,npts,time,s2, hand_p2)
    i = winio@('%ff&')
    call winop@("%pl[native]")
    call winop@("%pl[x_array]")
    call winop@("%pl[COLOUR=green]")
    call winop@("%pl[smoothing=4]")
    i = winio@('%`pl&',gw,gh,npts,time,s3, hand_p3)
    call winop@("%pl[native]")
    call winop@("%pl[x_array]")
    call winop@("%pl[COLOUR=black]")
    call winop@("%pl[smoothing=4]")
    i = winio@('%`pl',gw,gh,npts,time,s4, hand_p4)
    plot_time_series = 1
  end function plot_time_series
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Fri Mar 17, 2017 1:08 pm    Post subject: Reply with quote

second part

Code:
  integer function save_plot_cb()
  include<windows.ins>
  integer i, create_graphics_region@, copy_graphics_region@, select_graphics_object@, export_image@, &
             delete_graphics_region@
    i = create_graphics_region@(hand_p5, gw*2, gh*2) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, 0,   0, gw, gh, hand_p1, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, gw,  0, gw, gh, hand_p2, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, 0,  gh, gw, gh, hand_p3, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, gw, gh, gw, gh, hand_p4, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = select_graphics_object@(hand_p5) ; write(6,*) i
    i = export_image@('picture.jpg')     ; write(6,*) i
    i = delete_graphics_region@(hand_p5) ; write(6,*) i
    save_plot_cb = 1
  end function save_plot_cb
end module plot_mod

program main
use plot_mod
implicit none
integer i
i = generate_time_series()
i = plot_time_series()
end program main
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Fri Mar 17, 2017 1:10 pm    Post subject: Reply with quote

And the problem:-

Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Fri Mar 17, 2017 1:54 pm    Post subject: Reply with quote

A little bit more to the tale. If I have four graphics regions created using %`gr, it works fine as the following shows:-

Code:

module plot_mod
implicit none
integer, parameter :: hand_p1 = 1, hand_p2 = 2, hand_p3 = 3, hand_p4 = 4, hand_p5 = 5
integer, parameter :: gw = 300, gh = 250

contains

  integer function plot()
  include<windows.ins>
  integer i
    i = winio@('%ww&')
    i = winio@('%mn[Close]&','EXIT')
    i = winio@('%mn[Save_plot]&',save_plot_cb)
    i = winio@('%`gr&',gw,gh, hand_p1)
    call draw_filled_rectangle@(0,0,gw,gh,rgb@(255,0,0))
    i = winio@('%`gr&',gw,gh, hand_p2)
    call draw_filled_rectangle@(0,0,gw,gh,rgb@(0,255,0))
    i = winio@('%ff&')
    i = winio@('%`gr&',gw,gh, hand_p3)
    call draw_filled_rectangle@(0,0,gw,gh,rgb@(0,0,255))
    i = winio@('%`gr&',gw,gh,  hand_p4)
    call draw_filled_rectangle@(0,0,gw,gh,rgb@(101,156,239))
    i = winio@('%ws',' ')
    plot = 1
  end function plot

  integer function save_plot_cb()
  include<windows.ins>
  integer i, create_graphics_region@, copy_graphics_region@, select_graphics_object@, export_image@, &
             delete_graphics_region@
    i = create_graphics_region@(hand_p5, gw*2, gh*2) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, 0,   0, gw, gh, hand_p1, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, gw,  0, gw, gh, hand_p2, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, 0,  gh, gw, gh, hand_p3, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = copy_graphics_region@(hand_p5, gw, gh, gw, gh, hand_p4, 0, 0, gw, gh, srccopy ) ; write(6,*) i
    i = select_graphics_object@(hand_p5) ; write(6,*) i
    i = export_image@('picture.jpg')     ; write(6,*) i
    i = delete_graphics_region@(hand_p5) ; write(6,*) i
    save_plot_cb = 1
  end function save_plot_cb
end module plot_mod

program main
use plot_mod
implicit none
integer i
i = plot()
end program main
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Mar 17, 2017 6:11 pm    Post subject: Reply with quote

Yes you can plot more than one graph but the access violation appears to be a bug in ClearWin+ that needs fixing.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Fri Mar 17, 2017 8:08 pm    Post subject: Reply with quote

Thanks Paul, I will stop pursuing this for now and just export data as a CSV for import to excel for plotting.

I did try a slightly different approach, replacing the save_plot_cb function in my first post with the following which does not call copy_graphics_region@.

Unfortunately, the error still occurs.

Code:
  integer function save_plot_cb()
  include<windows.ins>
  integer i, create_graphics_region@, select_graphics_object@, export_image@, import_image@, &
             delete_graphics_region@
  real(kind=2) set_jpeg_quality@
  integer(kind =2) error_code
     i = set_jpeg_quality@(1.d0)
     i = select_graphics_object@(hand_p1) ; write(6,*) i
     i = export_image@('picture01.jpg')   ; write(6,*) i
     i = select_graphics_object@(hand_p2) ; write(6,*) i
     i = export_image@('picture02.jpg')   ; write(6,*) i
     i = select_graphics_object@(hand_p3) ; write(6,*) i
     i = export_image@('picture03.jpg')   ; write(6,*) i
     i = select_graphics_object@(hand_p4) ; write(6,*) i
     i = export_image@('picture04.jpg')   ; write(6,*) i
     i = create_graphics_region@(hand_p5, gw*2, gh*2) ; write(6,*) i
     i = select_graphics_object@(hand_p5) ; write(6,*) i
     i = import_image@('{picture01.jpg}',0,0)   ; write(6,*) i
     i = import_image@('{picture02.jpg}',gw,0)  ; write(6,*) i
     i = import_image@('{picture03.jpg}',0,gh)  ; write(6,*) i
     i = import_image@('{picture04.jpg}',gw,gh) ; write(6,*) i
     i = export_image@('picture.jpg')           ; write(6,*) I
     i = delete_graphics_region@(hand_p5) ; write(6,*) i
     call erase@('picture01.jpg',error_code)
     call erase@('picture02.jpg',error_code)
     call erase@('picture03.jpg',error_code)
     call erase@('picture04.jpg',error_code)
    save_plot_cb = 1
  end function save_plot_cb
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Mar 18, 2017 4:04 pm    Post subject: Reply with quote

Kenneth

This has now been fixed and a new set of DLLs will be available shortly.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Sat Mar 18, 2017 4:34 pm    Post subject: Reply with quote

Great - thanks Paul. Very Happy

Both of us working on a Saturday - not to good. Sad
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Sat Mar 18, 2017 4:41 pm    Post subject: Reply with quote

My observation is if, for example, scientist does not work on Saturdays - he does not work at all. Smile

Ken, Unless there was some specific purpose for that, copy_graphics_region was actually not needed to get 4 graphs together. Just placing these 4 %gr regions next to each other with ww[no_border] doing the same trick, is shorter and more convenient for run-time plotting. Here is the code example which running makes 4 different plots at the same time. It also crashes at the exit but the reason is probably different - program needs to exit cycling do loop first, which is probably easy to fix
Code:
winapp
use clrwin
common /RunContinueStop_/k_RunPauseContinueStop1234
common /Visual_/ k_visual, ixVis , iyVis, ihGrVis, ihGrVisGreen, lw_visWindow, ihGrRun, ihGrMain, icol
integer, external ::  Run

parameter (n=240)
integer x(n),y(n)
common x,y

k_RunPauseContinueStop1234 = 1
k_visual   = 1
ixVis       = 500
iyVis       = 360

ihGrVis      = 4
ihGrVisGreen   = 3
ihGrRun      = 2
ihGrMain   = 1

do i=1,n
 x(i)=5*i
 y(i)=150 - 100 * sin(i/10.)
enddo

 i=winio@('%bg[gray]&')
! i=winio@('%^tt[Run  Code]&',Run)
 i=winio@('%^tt[E&xit]%ff%nl&','+','set',k_RunPauseContinueStop1234, 4,'exit')
 i = winio@('%ww[no_border]%pv%fr%lw',1200,800, ictrlFrame)
 i=winio@('%aw%ww[no_border]%pv%60.5cw',ictrlFrame, 0)
 jj=Run ()

end
!=====================================================
integer*4 function Run ()
use clrwin
common /RunContinueStop_/k_RunPauseContinueStop1234
common /Visual_/ k_visual, ixVis , iyVis, ihGrVis, ihGrVisGreen, lw_visWindow, ihGrRun, ihGrMain, icol

integer, external ::  Vis, Calc,  Interrupt

j = Interrupt ()

 i=winio@('%ww[no_border]%ff&')
 i=winio@('%`gr[black]&',      ixVis, iyVis, ihGrMain)
 i=winio@('%`gr[blue]%ff&',    ixVis, iyVis, ihGrRun)
 i=winio@('%`gr[red]&',        ixVis, iyVis, ihGrVis )
 i=winio@('%`gr[green]',       ixVis, iyVis, ihGrVisGreen )

jj = Calc()

Run=1
end function

!================================================
integer*4 function Interrupt ()
use clrwin
common /RunContinueStop_/k_RunPauseContinueStop1234
common /Visual_/ k_visual, ixVis , iyVis, ihGrVis, ihGrVisGreen, lw_visWindow, ihGrRun, ihGrMain, icol
integer, external ::  Vis, Calc

 i=winio@('%^tt[Run]&',     'set',k_RunPauseContinueStop1234,1)
 i=winio@('%^tt[Pause]&',   'set', k_RunPauseContinueStop1234,2)
 i=winio@('%^tt[Continue]%ff&','set',k_RunPauseContinueStop1234,1)
 i=winio@('%^tt[StartVis]&','set',k_visual,1)
 i=winio@('%^tt[StopVis]&','set',k_visual,0)

 i=winio@('%^tt[E&xit]&', &
  '+', 'set',k_RunPauseContinueStop1234, 4, &
  '+', 'set',k_visual, 0, &
  '+', 'set',lw_visWindow, 0, &
       'set',iRunWindow,0) ! 'exit')

i=winio@('%lw&', iRunWindow)
Interrupt = 1
end function
!


Last edited by DanRRight on Sat Mar 18, 2017 10:28 pm; edited 8 times in total
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Sat Mar 18, 2017 10:08 pm    Post subject: Reply with quote

Code:
!================================================
integer*4 function Vis ()
use clrwin
common /RunContinueStop_/k_RunPauseContinueStop1234
common /Visual_/ k_visual, ixVis , iyVis, ihGrVis, ihGrVisGreen, lw_visWindow, ihGrRun, ihGrMain, icol
  i=winio@('%^tt[E&xit]&','set',lw_visWindow,0) ! 'exit')
  i=winio@('%lw',lw_visWindow)
  Vis = 1
end function
!=====================================================
integer*4 function Calc ()
use clrwin
common /RunContinueStop_/k_RunPauseContinueStop1234
common /Visual_/ k_visual, ixVis , iyVis, ihGrVis, ihGrVisGreen, lw_visWindow, ihGrRun, ihGrMain, icol
logical aa_log
integer, external :: plot
save

a = 0.1
ixold = 0
iyold = 0

1   call temporary_yield@()   

if(k_RunPauseContinueStop1234.eq.1) then

  ir = random() * 255
  ig = random() * 255
  ib = random() * 255
  print*,'IR,IG,IB=',IR,IG,IB

  if(k_visual.eq.1) then

  icol = rgb@(ir,ig,ib)

if(ir.lt.64) then
 Print*,'<16 Run',icol
 i16=select_graphics_object@(ihGrRun)
 if(i16.eq.0) goto 222
 call get_graphical_resolution@(ixVis,iyVis )

else if(ir.lt.128) then
  Print*,'<128 Main',icol
  i32=select_graphics_object@(ihGrMain)
  if(i32.eq.0) goto 222
  call get_graphical_resolution@(ixVis,iyVis )
  ix   = random() * ixVis
  iy   = random() * iyVis
  call DRAW_filled_RECTANGLE@(IX,IY,IXold,IYold,ICOL)
  goto 222

else if(ir.lt.196) then
  Print*,'<196 red',icol
  i48=select_graphics_object@(ihGrVis)
  if(i48.eq.0) goto 222
  call get_graphical_resolution@(ixVis,iyVis )
  ix   = random() * ixVis
  iy   = random() * iyVis
  call DRAW_RECTANGLE@(IX,IY,IXold,IYold,ICOL)

  goto 222

else
  Print*,'>196 green screen',icol
  i64=select_graphics_object@(ihGrVisGreen)
  if(i64.eq.0) goto 222
  call get_graphical_resolution@(ixVis,iyVis )
  jj = plot ()
  goto 222
 endif

  ix   = random() * ixVis
  iy   = random() * iyVis

  call temporary_yield@()   

  call draw_line@(ixold, iyold, ix,iy, icol)

222     ixold = ix
     iyold = iy
   endif

   endif

      do while(k_RunPauseContinueStop1234.eq.2)
     call temporary_yield@()   
     call sleep@(0.3)
          call sound@(8333,1)
      enddo

 if(k_RunPauseContinueStop1234.eq.4) goto 10000 ! stop run at exit button


  call sleep@(0.04)
  goto 1

10000   Calc = 1
end function
!........................................
integer function plot ()
use clrwin
parameter (n=240)
integer x(n),y(n)
common /Visual_/ k_visual, ixVis , iyVis, ihGrVis, ihGrVisGreen, lw_visWindow, ihGrRun, ihGrMain, icol
common x,y
save n_call, n1
data n_call/0/, n1/9/

   n_call = n_call + 1

   n1 = n_call
   if(n1.gt.n-1) then
     n_call = 1
          call clear_screen@()
        endif

   icol=rgb@(255,0,0)
   CALL set_line_width@(5)
   call draw_bezier@(x,y,n1,icol)

1000   plot = 1
   end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Mar 20, 2017 11:32 am    Post subject: Reply with quote

New DLLs are now available via the following link. The usual cautions apply.
See the readme for new %pl options.
Please report any bugs but not requests for additional features.

https://www.dropbox.com/s/ycd80m06hx9uxys/newDLLs5.zip?dl=0
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Mon Mar 20, 2017 9:23 pm    Post subject: Reply with quote

Paul,

Thanks for that - no exception on program exit now.

However, the problem with the curve fitting has come back to haunt us.

Using newdlls4 there is no overshoot in the step responses:-



But with the newdlls5 there is :-



I'm not worried about the aspect ratio - that can be fixed with the new %pl[margin=n], n = 30 looks about right to me, and the %pl[etched] is a nice touch.

Hope this is an easy fix for you. The new %pl just about does everything I need it to do now.

Thanks

Ken
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 3 of 8

 
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