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: 2813
Location: South Pole, Antarctica

PostPosted: Wed Mar 15, 2017 11:55 am    Post subject: Reply with quote

That how I used older Simpleplot. I used character*320 variable for that.
Look at this monstrosity which I expanded by photoshopping because it did not fit




But may be better would be to offer one settings for all that and the icon in the corner of the plot where you can click and all settings will be displayed and changed dynamically. This is because new %pl offers more options to customize plot. And will inevitably offer even more in the future
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Mar 15, 2017 12:13 pm    Post subject: Reply with quote

John

I will aim to provide an upload within a week.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



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

PostPosted: Wed Mar 15, 2017 12:52 pm    Post subject: Reply with quote

John,
I didn't realise you could use HEX codes (#339900) for the colours in %pl. That opens up more possibilities Very Happy
Thanks
Ken
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2813
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: 7916
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: 2813
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: 697
Location: Hamilton, 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 Visit poster's website
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, 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 Visit poster's website
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, 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 Visit poster's website
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, 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 Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

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

I think you can plot more than 1 plot to a graphics area using %pl. There are various ́parameters', set via commands independent of the %pl comméand itself which you can set to do this if I remember correctly from my ramblings through the SimplePlot documentation.
Dan and I has some success getting some things to work that way a ciuole id ́f years ago when there was a rampant discussion going on the forum about how to improve it at the time.
I think that native %pl might recognise those parameters as it's not entirely new, if I understand correctly it's just modifications to the simpleplot %pl introducing new add-on features via options.
Same with positioning on page etc...
Maybe Paul might know if that's true. otherwise it's delve in the n'manuals and suck-it.n.see time.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
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: 697
Location: Hamilton, 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 Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
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: 697
Location: Hamilton, 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 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 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