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 ... 6, 7, 8, 9, 10, 11  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


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

PostPosted: Mon Sep 25, 2017 8:44 am    Post subject: Reply with quote

John

The maximum number of plots on one graph is 10, otherwise you should get an error report. There is no programmed limit on the number of points that you can plot, memory is allocated on demand.

I don't have a quick answer to your 2nd question.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Mon Sep 25, 2017 6:06 pm    Post subject: Reply with quote

ok, thanks for the reply Paul.
Is it possible to easly increase that limitation ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Sep 26, 2017 7:05 am    Post subject: Reply with quote

In one sense yes, it's just a parameter in the library. But it is a static value that means that the base memory for all calls to %pl would be increased. No doubt the model can be changed but that would require a redesign and off hand I don't know how much work that would entail.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Tue Sep 26, 2017 10:48 am    Post subject: Reply with quote

it would be an infinite improvement if that limit could be removed (I assume via ALLOCATION of the relevant parameters).
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 126
Location: Glasgow, Scotland.

PostPosted: Tue Sep 26, 2017 11:30 am    Post subject: Reply with quote

I have to agree with John, the maximum I have used so far is N_GRAPHS=9, and I was blissfully unaware of this limitation, until now.

To me the beauty of the new %pl is the ability to display data without having to resort to exporting text files for import to excel (or equivalent) which is all time consuming, particularly where the user needs to view the plots, before the next step of an ongoing calculation. The alternative is to plot the data using %gr - which is equally time consuming to get right first time - and would be a backwards step considering all the functionality that's been built into the native %pl.

One for the wish-list which hopefully Paul will start compiling and work through - time permitting.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Sep 26, 2017 12:02 pm    Post subject: Reply with quote

Ken

I have added the option [external_ticks]. This implies [framed] and puts the tick marks externally to the frame.
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 126
Location: Glasgow, Scotland.

PostPosted: Tue Sep 26, 2017 1:00 pm    Post subject: Reply with quote

Thanks Paul, I knew you had a wish list ! Wink Look forward to the next dll coming out.

John, One way to overcome the N_Graphs=10 limit, might be to use the %pl call back function to overlay additional graphs, in which case the GET_PLOT_POINT@ subroutine would provide all the required geometric data. Just a thought. I will try this when I have time.
Back to top
View user's profile Send private message Visit poster's website
Kenneth_Smith



Joined: 18 May 2012
Posts: 126
Location: Glasgow, Scotland.

PostPosted: Wed Sep 27, 2017 10:49 pm    Post subject: Reply with quote

Paul, Another one for you to look at I am afraid.

The following code plots two points on the x-y plane. Note that there is a spin wheel on one of the Y values. Running the program and increasing this Y value incrementally reveals some issues.

When compiled under 32 bit, for the following Y values the corresponding point is not plotted 4.5, 9.0, 11.5, 14.5, 15.5, 18.0, 18.5, 20.5, 23.0 etc.

When compiled under 64 bit, this still happens, but it first occurs for a Y value of 48.5, then 80.5, 83.5 etc.

I am using the most recent DLLS (13).


Code:
module geometry
implicit none
integer, parameter :: dp = SELECTED_REAL_KIND(15,307)
integer, parameter :: n_ew_max  = 2
real(kind=dp)      :: ew_cond_coords_x(1:n_ew_max)       = (/1.d0,2.d0/)
real(kind=dp)      :: ew_cond_coords_y(1:n_ew_max)       = (/1.d0,2.d0/)

contains

  integer function get_geometry()
  include<windows.ins>
  integer i
    i = winio@('%mn[Exit]&','exit')
    i = winio@('%fn[Tahoma]&')
    i = winio@('%nl%3.3ob[scored]&')
    i = winio@('%cb&')
    i = winio@('%ws&','X [m]')
    i = winio@('%cb&')
    i = winio@('%ws&','Y [m]')
    i = winio@('%cb&')

    i = winio@('%ws&','1')
    i = winio@('%cb&')
    i = winio@('%^rf&',ew_cond_coords_x(1), update_graphics)
    i = winio@('%cb&')
    i = winio@('%df&', 0.5d0)
    i = winio@('%^rf&',ew_cond_coords_y(1), update_graphics)
    i = winio@('%cb&')

    i = winio@('%ws&','2')
    i = winio@('%cb&')
    i = winio@('%^rf&',ew_cond_coords_x(2), update_graphics)
    i = winio@('%cb&')
    i = winio@('%^rf&',ew_cond_coords_y(2), update_graphics)
    i = winio@('%cb&')
   
    call winop@('%pl[native]')
    CALL winop@("%pl[width=2]")
    CALL winop@("%pl[x_array]")
    call winop@("%pl[N_GRAPHS=1]")
    CALL winop@("%pl[link=none]")
    CALL winop@("%pl[colour=blue]")
    call winop@("%pl[symbol=11]")
    call winop@("%pl[pen_style=0]")
    call winop@("%pl[y_min=0]")
    i = winio@('%`bg[white]&')
    i = winio@('%pl', 500, 500, 2, ew_cond_coords_x, ew_cond_coords_y)
    get_geometry = 1

  end function get_geometry

  integer function update_graphics()
  include<windows.ins>
    call simpleplot_redraw@()
    update_graphics=1
  end function update_graphics
 
end module geometry

program main
use geometry
implicit none
integer i
i = get_geometry()
end program main


If I change [link=none], to [link=lines], the line joining the points is correctly drawn.

I have a work around - essentially finding the maximum y value and plotting an invisible graph that has its maximum slightly larger (x 1.01 which works for this data set, x 1.001 does not).
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Wed Sep 27, 2017 11:15 pm    Post subject: Reply with quote

Yes Ken, and an even better way would be to input the curves to be plotted as 2 dimensional arrays ! of dimension (n x nc) rather than having to put nc vectors in there on the %pl line !
That for y values and also for x-values when 'independent' option is chosen.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Wed Sep 27, 2017 11:23 pm    Post subject: Reply with quote

apart from that, here are some observations having played around with Ken's 'generic random' code which appeared earlier in this post . A couple of new bugs identified Paul.when you've digested indicate which you might like to delve into first and I'll post the specific related code, rather than post all the individual varians here which would do nothing but confuse.

----------------------------------------------------------------------------

So, I've been playing around with Ken's 'generic' code , which has proved very useful, thank you Ken, using dlls13.
During the course of my dabblings I've made a few modifications as I wnt along, namely:-
a) played around with some SPECIFIC ranges to try to understand see how the END POINTS on the scales are numbered (with the original definition neither end value is plotted , neither on the X, nor the 0 on the Y-axis)
b) added some 'real world' titles (to test how native %pl places them - Note - with the default (X and Y) they are right justified, still not centred!!!)
c) made the window resizeable (to see how it copes with interactive re-sizing) - with some surprising results !!!!!


Bugs !

1. Scales spacings chosen are not logical. e.g. If the data range user-fixed at 0 to 1 (Ken's example) I don't expect spacigs of 0.15 ! I expect for example spacings of : 0.1 or 0.2 or 0.5.

2. End points on scales are often not labelled (both X and Y)

3. A symbol (square box) somtimes appears at axes 'origin', sometimes it doesn't

4. Axes titles are now centred BUT on +ve axis only ! they should be centred on whole axis ! Preferably there should be an option for centre or rightjustified or leftjustified.

5. with log-log scales and re-sizing of window I've seen some very strange things happen:

a) scales change on re-sizing from (1 to 10) TO (1 to 10^10) !!!!!

Ex 3f2



re-sized



b) absolute gobbledy-gook on x-axis !!!

Ex 3f



after re-size




Some ESSENTIAL Enhancements Needed

A. I'd expect there to be an option for sub-tic marks between the major tick marks. This is to enable easy 'reading off the graph'.

B. A logical extension is then gridlines (with paler geyed colours/styles (dashed) - under user options)) which is a standard in other plot packages.

C. Main titles often require to hold a lot of information. Currently there is only a single line available and if it exceeds the width of the plot window it gets chopped off. Obviously 'folding of a title onto 2 or more lines would probably be a complex mod, maybe allowing several title lines (say 3 max) would be a good compromise with less development time involved ? Similarly for Axes Titles (say x2 max kėlines ?).

D. There is no scope for introducing differing fonts within a title e.g. to introcuce symbols, alpha, bets , etc .... Is it not possible to introduce changes to allow title strings to contain variable fonts/formatting/greek chars etc .... as in a normal text sting ?
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Wed Sep 27, 2017 11:34 pm    Post subject: Reply with quote

.... AND ..... I have a problem trying to generate GridLines using the GET_PLOT_POINT@ subroutine.

Why is the code only going round the Do loop in Function GridLines once ?
(see write statements outputing in cmd window and plot appears with geyed-out button and hangs.

Note - the code in Function GridLines is a mess becasue oėriginally I tried inputting into the routine via arrays, only for the program to loop incessantly outputting rubbish the same values every time for the input parameters and rubbish values for the pixel values (18 digit integers !). So, I then assigned the input array values to integer variables.

Here's the code .... again a mod of 1 of Ken's , this time with linear axes ...
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Wed Sep 27, 2017 11:36 pm    Post subject: Reply with quote

Code:

!   v1.4f - as 1.3f but with Grid Lines (Xonly)

module mod1
implicit none
real(kind=2) x1(1:2), x2(1:2), y1(1:2), y2(1:2)
integer:: n(1:2) = (/2,2/)

contains

  subroutine main
  include<windows.ins>
  integer i
  do i = 1, 2, 1
    x1(i) = RANDOM@()
    x2(i) = RANDOM@()
    y1(i) = RANDOM@()
    y2(i) = RANDOM@()
  end do

    i=winio@('%`bg[white]&')
    call winop@("%pl[native]")
    CALL winop@("%pl[smoothing=4]")
    CALL winop@("%pl[width=2]")

! axes tick marks & labels spacing set to 0.1
    CALL winop@("%pl[dx=0.1]")
    CALL winop@("%pl[dy=0.1]")

    CALL winop@("%pl[x_array]")

!    CALL winop@("%pl[x_min=0,x_max=1]")  !######
!    CALL winop@("%pl[y_min=0,y_max=1]")  !######
    CALL winop@("%pl[x_min=0.0,x_max=1.0]")  !######
!    CALL winop@("%pl[y_min=0.0,y_max=1.0]")  !######
    CALL winop@("%pl[y_min=-0.5,y_max=1.0]")  !######

    CALL winop@("%pl[title='This is a Title for Kens Nice Generic Multi-Plot Test Prog (Adapted) to see its positioning']")
    CALL winop@("%pl[x_axis='The X-axis Input Data (Y)']")
    CALL winop@("%pl[y_axis='These are The Results on Y axis']")

    Call winop@("%pl[N_GRAPHS=2]")
    CALL winop@("%pl[independent]")
    CALL winop@("%pl[link=lines,link=lines]")
    CALL winop@("%pl[colour=red, colour=blue]")
    call winop@("%pl[pen_style=0,pen_style=0]")
!    i = winio@('%pl&',400,250,n,x1,y1,x2,y2)
!    i = winio@('%ww%pv%pl&',400,250,n,x1,y1,x2,y2)

    i = winio@('%ww%pv%^pl&',400,250,n,x1,y1,x2,y2,GridLines)


    i = winio@('%ff%nl%cn%^tt[NEXT]',update)
  end subroutine main



  Integer Function GridLines()
     include<windows.ins>
   real*8 xx(20,2,2),yy(20,2,2)
   integer*8 xxpix(20,2,2), yypix(20,2,2)
   integer*8 xx1, xx2, yy1, yy2, xxpix1, yypix1, xxpix2, yypix2

   integer i,nx

  real*8 x_min, y_min, x_max, y_max
  real*8 dx, dy
   x_min=0.0
   y_min=-0.5
   x_max=1.0
   y_max=1.0

   dx=0.1D0
   dy=0.1D0
   nx=10

   Write(6,*) 'nx =',nx

  Do i=1,nx
   xx(i,1,1)=x_min+(i*dx)
   xx(i,2,1)=xx(i,1,1)
   yy(i,1,1)=y_min

   Write(6,*) 'xx( ',i,' 1 1 ', xx(i,1,1), 'yy(',i,', 1 1 )', yy(i,1,1)
 
   xx1=xx(i,1,1)
   xx2=xx(i,2,1)
   yy1=yy(i,1,1)

!  CALL GET_PLOT_POINT@(xx(i,1,1),yy(i,1,1),xxpix(i,1,1),yypix(i,1,1))
   CALL GET_PLOT_POINT@(xx1,yy1,xxpix1,yypix1)

!   Write(6,*) 'xxpix(i,1,1)', xxpix(i,1,1), 'yypix(i,1,1)', yypix(i,1,1)

   Write(6,*) 'xxpix1', xxpix1, 'yypix1', yypix1

   yy(i,2,1)=y_max
   yy2=yy(i,2,1)

!   CALL GET_PLOT_POINT@(xx(i,2,1),yy(i,2,1),xxpix(i,2,1),yypix(i,2,1))
   CALL GET_PLOT_POINT@(xx2,yy2,xxpix2,yypix2)

   Write(6,*) 'xxpix2', xxpix2, 'yypix2', yypix2


  End Do

   CALL draw_line_between@(xxpix1,yypix1,xxpix2,yypix2,RGB@(0,0,255))

   call SIMPLEPLOT_REDRAW@()

  Gridlines=1

  End Function GridLines


... to be continued !
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Wed Sep 27, 2017 11:39 pm    Post subject: Reply with quote

... continued ...

Code:


  integer function update()
  include<windows.ins>
  integer i
  do i = 1, 2, 1
    x1(i) = RANDOM@()
    x2(i) = RANDOM@()
    y1(i) = RANDOM@()
    y2(i) = RANDOM@()
  end do
    call SIMPLEPLOT_REDRAW@()
    update = 1
  end function update

end module mod1


program test
use mod1
implicit none
  call main
end program test

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



Joined: 18 May 2012
Posts: 126
Location: Glasgow, Scotland.

PostPosted: Thu Sep 28, 2017 12:49 am    Post subject: Reply with quote

John, this might help.

Code:
module keraunic_mod
implicit none
integer, parameter              :: dp = SELECTED_REAL_KIND(15,307)
real(kind=dp), allocatable :: x_td(:), y_ng(:)
contains
  real(kind=dp) function keraunic_to_ng(td)
  real(kind=dp), intent(in) :: td
    if (td .lt. 0.d0) then
      keraunic_to_ng = 0.d0
    else
      keraunic_to_ng = 0.04d0*td**1.25d0
    end if
  end function keraunic_to_ng

  integer function view_keraunic_data()
  include<windows.ins>
  integer, parameter :: td_max = 350
  integer i
    allocate(x_td(1:td_max), y_ng(1:td_max))
    do i = 1,td_max, 1
      x_td(i) = real(i,kind=dp)  ; y_ng(i) = keraunic_to_ng(real(i,kind=dp))
    end do 
    i = winio@('%mn[Exit]&','exit')
    i = winio@('%fn[Tahoma]&')
    call winop@('%pl[native,smoothing=4,framed,etched,width=2]')
    CALL winop@("%pl[x_array,N_GRAPHS=1,link=lines,colour=black]")
    call winop@("%pl[symbol=0,pen_style=0]")
    call winop@("%pl[title='Ground Flash Density Ng Vs. Keraunic level Kd']")
    call winop@("%pl[x_axis='Thunderstorm Td [days/year]']")
    call winop@("%pl[y_axis='Ground flash density Ng [flashes/sq.km]']")
    i = winio@('%`bg[white]&')
    i = winio@('%^pl&',700,600,td_max,x_td,y_ng,caption_cb)
    i = winio@('%ff')
    deallocate(x_td, y_ng)
    view_keraunic_data = 1
  end function view_keraunic_data

  integer function caption_cb()
  include<windows.ins>
  real(kind=dp) x, y, xpix, ypix
    call SELECT_FONT@('tahoma')
!   London 18 thunderstorm days per year
    x = 18.d0 ; y = keraunic_to_ng(x)
    call GET_PLOT_POINT@(x,y,xpix,ypix)
    call draw_filled_ellipse@(int(xpix),int(ypix),3,3,rgb@(0,0,255))
    call draw_characters@('London',int(xpix) + 5, int(ypix) - 150,rgb@(0,0,255))
    call draw_line_between@(int(xpix),int(ypix),int(xpix) + 5, int(ypix) - 150  ,rgb@(0,0,255))
!   Las Vegas   
    x = 13.d0 ; y = keraunic_to_ng(x)
    call GET_PLOT_POINT@(x,y,xpix,ypix)
    call draw_filled_ellipse@(int(xpix),int(ypix),3,3,rgb@(0,0,255))
    call draw_characters@('Las Vegas',int(xpix) + 5, int(ypix) - 170 ,rgb@(0,0,255))
    call draw_line_between@(int(xpix),int(ypix),int(xpix) + 5, int(ypix) - 170  ,rgb@(0,0,255))
!   HONOLULU, 7
    x = 7.d0 ; y = keraunic_to_ng(x)
    call GET_PLOT_POINT@(x,y,xpix,ypix)
    call draw_filled_ellipse@(int(xpix),int(ypix),3,3,rgb@(0,0,255))
    call draw_characters@('Honolulu',int(xpix) + 5, int(ypix) - 210 ,rgb@(0,0,255))
    call draw_line_between@(int(xpix),int(ypix),int(xpix) + 5, int(ypix) - 210  ,rgb@(0,0,255))
    caption_cb = 1
  end function caption_cb
end module keraunic_mod

program main
use keraunic_mod
i=view_keraunic_data()
end program main
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 558

PostPosted: Thu Sep 28, 2017 1:12 pm    Post subject: Reply with quote

Thank You Ken !

As usual my oversight, although I'm puzzled as to why pixel co-ordinates are real numbers and not integers ! (no reason for not RTFM though).
My natural intuition preceded me and reading the manual properly !

Incredible how the definitionas Integer rather than Real can make such a drastic impact ! with absolutely no clear error message for noggins like me such as maybe something like: "hey stupid, you defined the input parametrs as Integer and not Real as required !" LOL

I'll now press on with trying to find precise workarounds for current limitations in native %pl.
I'll post when cleaned up and advanced a little more.
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 ... 6, 7, 8, 9, 10, 11  Next
Page 7 of 11

 
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