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 

New sugestion(s) for %PL - (first - an initial question)
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Thu Mar 04, 2021 1:41 pm    Post subject: Reply with quote

Ken,

I did not use the GET_PLOT_POINT@, since the points
which are to be joined have real world coordinates with which
they were plotted in the graph using the command:
Code:

 iw=winio@('%`^pl[full_mouse_input]&',gw,gh,npoints,y_ok,x_ok,y_mm,x_mm,handle_pl_ok,pl_cb)

Y_OK,X_OK are real geodetic coordinates of optical cable
Y_MM,X_MM are real geodetic coordinates from mobile mapping.

Paul,

thanks for your real evaluation of my idea.
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Sat Mar 06, 2021 12:02 pm    Post subject: Reply with quote

Martin_K, you wrote:
Quote:
PS: I tested the link above and was able to download it back using EDGE


EDGE ???????
_________________
''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 ... Smile "
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Sat Mar 06, 2021 12:51 pm    Post subject: Reply with quote

John,

I meant Microsoft Edge.
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Fri Mar 12, 2021 10:58 pm    Post subject: Reply with quote

... which I didn't even know existed !!!!

I'm a Windows 7 fiend myself and only started using Windows 10 a year ago and hadn't noticed the nesw explorer as I'm a Firefox afficionado !!!

You learn something new every day.
_________________
''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 ... Smile "
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Sat Mar 13, 2021 1:35 am    Post subject: Reply with quote

This is basically an additional question to Ken´s post of PostPosted: Sat Feb 27, 2021 1:46 pm.

Since the function DRAW_POLYLINED@ does not work with me as I want,
I already organized the input data to be able to use the %PL option STACKED and to also use the option LINK=LINES.

Now, I have 20 different sections of data points (it means 20 different graphs put into one graph) which are to be joined
(each section separately, no cross joining among sections).

Questions:

Should I use the option LINK=LINES 20x in the %PL?
(In your example for STACKED, you use LINK=LINES 2x).

Moreover, I NEVER know in advance, how many different sections will be present in the data (the number of different sections is always a variable).
Is there a method to tell the options LINK=LINES, how many times it should be used for graphs taking into account the variable computed
during the run of program which says how many different sections
are to be joined (the points within each section)?

I mean - something like variable:LINE=LINES (in my case 20: LINE=LINES)
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Sat Mar 13, 2021 1:13 pm    Post subject: Reply with quote

For n graphs you could do something like this.

Code:
use clrwin
integer i,n
character(len=50) txt
n = 10
write(txt,'("%pl[n_graphs=",I2,"]")') n
call winop@(txt)
do i = 1, n , 1
  call winop@('%pl[link=lines]')
end do
end
Back to top
View user's profile Send private message Visit poster's website
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Sat Mar 13, 2021 5:54 pm    Post subject: Reply with quote

Thanks, Ken!

I used the code:

Code:

      WRITE(TXT_LINK,'("%pl[n_graphs=",I2,"]")') pocet_roz_usekov+1
      CALL winop@(TXT_LINK)
      DO z = 1, pocet_roz_usekov, 1
        CALL winop@('%pl[link=lines]')
      END DO


However, is there a limitation for the option LINK=LINES (in the sense of
its number, since in this particular case I have 20 different sections/graphs, where points are to be joined + one graph with points only/no joining), because I get the following error:

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



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

PostPosted: Sat Mar 13, 2021 6:43 pm    Post subject: Reply with quote

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@. See item [394] in the Clearwin+ enhancements documentation.

PS. Example with 20 stacked graphs which form 20 cycles of a sine wave. 200 points in each individual graph i.e. 1 cycle.

Code:
program test
use clrwin
implicit none
integer, parameter :: dp=kind(1.d0)
integer i, iw
real(kind=dp)twopi, freq, omega, dt, time
real(kind=dp) x(1:4001), y(1:4001)
integer :: n = 20
character(len=50) txt
integer, allocatable :: n_pl(:)
integer gw, gh
twopi = 2.d0*4.d0*atan(1.d0)
freq = 50.d0
omega = twopi*freq
time  = 0.d0
dt    = 0.0001d0

do i = 0, 4000
  x(i+1) = time
  y(i+1) = sin(omega*time)
  time = time + dt
end do

gw = 0.80*clearwin_info@('screen_width')
gh = 0.80*clearwin_info@('screen_depth')

iw = winio@('%mn[Exit]&','exit')
write(txt,'("%pl[native,stacked,n_graphs=",I2,"]")') n
call winop@(txt)

call winop@('%pl[x_array,independent,frame,gridlines,etched,axes_pen=2,smoothing=4,width=2,dx=0.02]')
do i = 1, n , 1
  call winop@('%pl[link=lines]')
end do

do i = 1, n/4 , 1
  call winop@('%pl[colour=red]')
  call winop@('%pl[colour=blue]')
  call winop@('%pl[colour=yellow]')
  call winop@('%pl[colour=green]')
end do

allocate(n_pl(n))
n_pl = 200
iw = winio@('%pl&',gw,gh,n_pl,x,y)
iw = winio@(' ')
end
Back to top
View user's profile Send private message Visit poster's website
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Sat Mar 13, 2021 11:52 pm    Post subject: Reply with quote

I just noticed your new code - I will have a look, thanks!

A few remarks + a problem:

I read the notice 394 in ENH docs and did it as required BEFORE I posted my previous info, just neglected the command winop_hdl@,
which was placed before my call to winop@ with 21 graphs.
I thought that only pure winop@ commands should be taken into account.
This caused the reported error message.

BTW, I also noticed that also option colour must be together with LINK=LINES
when more than 10 graphs are to be plotted, otherwise I got the same error report as I previously reported, this time relating to colour.

Now, I am struggling with a specific thing. In fact, I have 21 graphs. The 20 graphs represent 20 different sections of points
(every section contains different number of points, together 1951 points in this particular case), where within
each section the points must be joined, but no cross joining among section is allowed.

The 21st graph represents points collected in the field (2098 points in this particular case)
and these points are NOT to be joined by straight lines.
They must be displayed just as individual points in the graph.

Therefore +1 in my previous post with code when doing DO loop for 20x LINK=LINES.

Here is my question/problem regarding the following code:

Code:

iw=winio@('%`^pl[vscroll,hscroll,full_mouse_input]&',gw,gh,D,npoints(2),y_ok,x_ok,y_mm,x_mm,handle_pl_ok,pl_cb)


D-represents number of 20 different sections (1951 points)
NPOINTS(2) - represents the number (2098) of individual points (no joining).
Y_OK,X_OK are 1951 points belonging to all 20 sections (they are to be joined)
Y_MM,X_MM are 2098 individual points (no joining)

I know that the code above is wrong, since there can be only one
variable telling %PL how many points are to be plotted.
I do not know, how should I manage this.

I tried to sum up both variables: D as scalar and also NPOINTS(2) as scalar to have just one amount of points (4049), but it does not work.
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Sun Mar 14, 2021 12:13 pm    Post subject: Reply with quote

If you are using the [stacked] opion all x and y data should be passed to the %pl via two arrays say x_pl and y_pl.

The contents of y_ok and x_ok should be copied to the first elements of x_pl and y_pl, and the contents of y_mm and x_mm are appended thereafter at the end of the stack.

You now have 21 sets of data arranged sequentially in x_pl and y_pl.

Define an integer array n_pl(1:21)

n_pl(1) = no of points in first line
n_pl(2) = no of points in second line
.
.
.
n_pl(21) = no of points in last section i.e y_mm and x_mm.

n_pl is used by %pl to determine the starting/ending positions of each data set in the stack.

A minimum set of winio calls to display this could be:
Code:

n = 21
write(txt,'("%pl[native,stacked,n_graphs=",I2,"]")') n
call winop@(txt)
call winop@('%pl[x_array,independent])
iw = winio@('%pl&',gw,gh,n_pl,x_pl,y_pl)
iw = winio@(' ')


Once you have the stacked data input working correctly then you can worry about lines etc.
Back to top
View user's profile Send private message Visit poster's website
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Mon Mar 15, 2021 1:15 pm    Post subject: Reply with quote

Ken,

many thanks - thanks your invaluable help! I come near to my goal, although, at the moment I am not still in it.
Namely - I have still two (I think - minor) problems.
I appended the array with the points which are NOT be joined (21st graph, points X_MM,Y_MM) to the end of last section of points
(20 graphs. all points X_OK, Y_OK) which are to be joined by straight lines, every section separately, no cross section joining.

But first, an observation regarding the PACK function:

At least in my case, the function PACK
behaves unpredictably (maybe I don´t use it in proper way, but I don´t think so)
and I cannot use it.

The code:

Code:

...
      IF (ALLOCATED (D)) DEALLOCATE (D)
                    ALLOCATE (D(en))
                 
          d(1:en) = 0 ! initialisation of D array
          d=pack(section_points,mask=section_points.ne.0) ! to exctrat all NON-zero values of D-array
...


does not produce required results.

Therefore, I wrote a short code, which - in my case - replaces the PACK functionality as follows:

Code:

...
   p=0 ! initialisation of an auxiliary variable
                   
               DO i=1,k,1
                      IF (section_points(i) == 0) CYCLE
                      IF (section_points(i) /= 0) THEN
                        p=p+1
                        D(p) = section_points(i)            ! to extract NON-zero values from the array SECTION_POINTS,
                                                            ! in fact, the NON-zero values represent the number of points to be joined by lines in each separate section of points
                      END IF
                    END DO
...

When I use my code above, I get the following correct results (in yellow) for the N_PL(i) array needed for the %PL to draw lines separately in each section of points:



When I use the PACK function, it assigns zero values to the elemenents N_PL(1) - N_PL(20), only element N_PL(21) is OK.

So, when invoking function GRAPHICS-vector with my code instead the PACK function, I get the following graph(s):



And in the picture above can be seen the two (minor) problems.

FIRST problem:
The points of the last (21st) graph are hidden (not visible). They should be in blue colour with + symbols.
The fact that they are present in the graph after all (but invisible), shows the yellow rectangle with the data extracted
from each blue point (here invisible) when hovering with the cursor over a blue point. Such data are NOT present when
hovering over red lines. So invisibility of blue points is unwanted.

So the question is - why are the points belonging to the last (21st) graph invisible?

SECOND problem:
If you look at the picture above to its top left section (better seen in the detail below), you see there a short line which also has point symbols with plus sign.
And this is also unwanted.



So, the question is - why on this short line and only on this short line are also point symbols displayed?

Here is full part of the code used with %PL command. Maybe here, in the code below, is hidden the answer
to the two questions above, but, unfortunately, I do not see it.

[code:1:cc0be54232]
...
INTEGER FUNCTION plot_OK_MM ()
IMPLICIT NONE

iw = CREATE_GRAPHICS_REGION@(handle_internal_gr,gw,gh)
iw=joining_lines() ! the function which joins the X_OK, Y_OK points (not the points X_MM, Y_MM) by straight lines

WRITE(TXT_LINK,'("%pl[native,stacked,n_graphs=",I2,"]")') po
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Mon Mar 15, 2021 1:19 pm    Post subject: Reply with quote

sorry, last important section with the code went wrong, so here
once again:

Code:

...
 INTEGER FUNCTION plot_OK_MM ()
  IMPLICIT NONE
 
  iw = CREATE_GRAPHICS_REGION@(handle_internal_gr,gw,gh)
  iw=joining_lines() ! the function which joins the X_OK, Y_OK points (not the points X_MM, Y_MM) by straight lines
   
 WRITE(TXT_LINK,'("%pl[native,stacked,n_graphs=",I2,"]")') pocet_roz_usekov    ! pocet_roz_usekov = number of different sections (21)
      CALL winop@(TXT_LINK)
      DO z = 1, pocet_roz_usekov, 1

         IF (z < pocet_roz_usekov) THEN
          CALL winop@('%pl[link=lines,colour=red]') ! X_OK, Y_OK points, all joined with straight lines in each section separately, NO cross sectionjoining, no point sybol used
         ELSE
           CALL winop@('%pl[link=none,colour=blue,symbol=12,symbol_size=3]')   ! X_MM,Y_MM points in  blue with + point symbol, NO joining
         END IF                                                                             

      END DO   

      iw=winio@('%fn[Verdana]%ts[1.4]%bf%gf%sf&',hTitleFont)
      call winop_hdl@('%pl[title_hfont]&',hTitleFont)
      CALL ENABLE_UTF8@(1)
     
      iw=winio@('%ww[no_border]%ca[Mobilné mapovanie plánovanej trasy optického kábla]%bg[grey]&')
      iw=winio@('%2nl%5ta%bf Zväčšiť/Zmenšiť:%ta%50sl%ta%`bg[white]%`rf%sf&',zoom,zoom_min,zoom_max,zoom) ! SLIDER
      iw=winio@('%ta%bf%^bt[Celý &rozsah bežca]%sf%2nl&',full_extents_cb) ! full extents of the slider
     
      CALL winop@('%pl[scale=linear]')
      CALL winop@('%pl[gridlines]')
      CALL winop@('%pl[x_sigfigs=8]')
      CALL winop@('%pl[y_sigfigs=9]')
      CALL winop@('%pl[title="Body z mobilného mapovania na plánovanej trase optického kábla"]')
      CALL winop@('%pl[x-axis=@,y-axis=@]')
      CALL winop@('%pl[x_array]')
      CALL winop@('%pl[independent]')
      CALL winop@('%pl[frame,etched]')
      CALL winop@('%pl[axes_pen=4,smoothing=4,frame_pen=1]')
     
      iw=winio@("%vx&",vpage_step,vmax_value, vcur_val)
      iw=winio@("%hx&",hpage_step,hmax_value, hcur_val)
      iw=winio@('%`^pl[vscroll,hscroll,full_mouse_input]&',gw,gh,n_pl,Y_OK_U,X_OK_U,handle_pl_ok,pl_cb)
      iw=winio@('%dl&',0.5d0,timer_cb)
     
      ....
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Mon Mar 15, 2021 2:38 pm    Post subject: Reply with quote

I cannot comment on PACK it’s not an element of the language I use particularly often, and when I do MASK is a logical array rather than a logical scalar, (which allows me to check that the MASK is correct).

Look at your DO LOOP, symbol=12,symbol_size=3 is only called once.

%pl processes the option data in the order in which it is presented to winop@, so symbol=12,symbol_size=3 is applied to the first stacked graph. There is not a 21st call to winop@(‘%pl[symbol=12]) so your 21st graph has the default symbol =0 (i.e. no symbol). So for the 21st graph, you have correctly specified a colour, but no symbol. This explains both of your problems!

You need to specify the symbol and symbol_size for all elements sequentially. Try something like this:-
Code:
      DO z = 1, pocet_roz_usekov, 1

         IF (z < pocet_roz_usekov) THEN
          CALL winop@('%pl[link=lines,colour=red,symbol=0,symbol_size=3]') ! X_OK, Y_OK points, all joined with straight lines in each section separately,
                                                                           ! NO cross sectionjoining, no point sybol used
         ELSE
           CALL winop@('%pl[link=none,colour=blue,symbol=12,symbol_size=3]')   ! X_MM,Y_MM points in  blue with + point symbol, NO joining
         END IF                                                                             

      END DO
Back to top
View user's profile Send private message Visit poster's website
Martin_K



Joined: 09 Apr 2020
Posts: 219

PostPosted: Mon Mar 15, 2021 11:11 pm    Post subject: Reply with quote

Your advise is a direct hit to the midpoint of the target!
Again, many thanks Ken!

I really thought that in the DO loop first 20 cycles will draw the lines
for the 20 different sections of points and since I didn´t want to have
there a symbol for the line points, I didn´t use the option symbol there and that the last 21st cycle will draw individual blue points.

Now everything works as expected (here is pictured the detail of the graph,
where I previously had the red crosses on the line, Now, all is OK,
the 21st graph with individual points is displayed. I also set the line width=3):



Additional info: When I move with the slider very quickly back and forth,
in rare cases program crashes. Can have the speed of slider movement
such impact?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Mar 16, 2021 8:49 am    Post subject: Reply with quote

Martin

A program crash might be caused by a callback (triggered by the slider) being re-entered when it is already being called.

You can block re-entry by setting a static logical variable on entry and resetting on exit. A test on the variable can then prevent re-entry.
Back to top
View user's profile Send private message AIM Address
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  Next
Page 2 of 7

 
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