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 ... 12, 13, 14 ... 26, 27, 28  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: 2925
Location: South Pole, Antarctica

PostPosted: Thu Nov 16, 2017 11:56 pm    Post subject: Reply with quote

Thanks Paul, indeed, the dx and dy allows the fine tuning of amount of numbering labels. I updated the code above on page 15 to include the dx and dy steps

Code:
CALL winop@("%pl[dx=0.1,dy=0.1]")
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Sat Nov 18, 2017 3:34 am    Post subject: Reply with quote

UPDATE.
After further play with this feature i found that it only worked for this specific sizes around 900x600. When i took much larger plot size for example 3600 x 2000 (initially or after resize using mouse) the program forgets this 0.1 step and starts to behave like before, placing large amount of numbers with smaller then user requested dx and dy steps.

I understand that if labels become too crowded that they start to overlap the code should decrease their amount up to just one label or even zero for very small thumbnail images, but for larger images the dx=fval and dy=fval have to stay as user requested, in our example dx=0.1, dy=0.1

Also is it planned to have something like this to update dynamically ?
Code:
CALL winop@("%pl[dx@]",dx_dval)
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Sat Nov 18, 2017 7:08 am    Post subject: Reply with quote

John,
1) I have no problems that even if dx, dy are set by the user - on the plot they are flexible. This flexibility is needed because when you shrink the size of plot the numbering eventually will be too crowded (which again requires very good universal label placement which works without dx, dy).
But when the spacings between numbering labels are OK and you increase plot size there is no reason for code to modify spacing the user intentionally set to adjust better numbering
2) Does my code work like that (showing nothing) for all sizes? I ran it and it works OK no matter what size.
3) Added %nr.

Paul,
Looks like get_plot_point@ has a bug. Look at this code which plots line from min left to max right of screen. Code places point at (X,Y) = (1,1). Try to change limits in small range and see all is OK until min values become positive

Code:
module surfplot2mod
   use clrwin
   integer (7) ihandleSP2
   real*8 x(2),y(2), xEllipse, yEllipse
   real*8 xAxisMin, xAxisMax, yAxisMin, yAxisMax

CONTAINS
   INTEGER FUNCTION plotSP()

   x(1)=xAxisMin
   x(2)=xAxisMax
   y(1)=yAxisMin
   y(2)=yAxisMax

   call simpleplot_redraw@

   ixR=7; iYr=7
   call get_plot_point@(1d0, 1d0, xEllipse, yEllipse)
   call draw_filled_ellipse@ (nint(xEllipse), nint(yEllipse),ixR,iYr,rgb@(244,0,0) )
   call UPDATE_WINDOW@(ihandleSP2)

   plotSP= 2
   end function plotSP
!......................................................
   INTEGER FUNCTION clearPL()
     INTEGER errstate
     errstate = change_plot_int@(0,"link",graph1,link_none)
     CALL simpleplot_redraw@()
     clearPL = 2
   END FUNCTION clearPL

end module surfplot2mod

!.......................
Program SurfPlot2
use surfplot2mod

   xAxisMin =-4
   xAxisMax = 5
   yAxisMin =-4
   yAxisMax = 5

   x(1)=xAxisMin
   x(2)=xAxisMax
   y(1)=yAxisMin
   y(2)=yAxisMax

   i = winio@  ('%ww%nr&')                           
   call winop@ ('%pl[native,x_array,N_GRAPHS=1]')
   call winop@ ('%pl[scale=linear]')

   CALL winop@("%pl[tick_len=9]")
   CALL winop@("%pl[dx=1.]") 
   CALL winop@("%pl[dy=1.]") 

   i = winio@  ('%sf%ts%bf&', 2d0)   

   call winop@ ("%pl[framed,axes_pen=3,width=3,x_axis='Length',y_axis='Width']")

   i = winio@  ('%pv%pl&',800,600,2,x,y)!
   i = winio@  ('%sf%ts%ff&', 1d0)

   i = winio@  ('Set Xmin, Xmax%ta%df%9^rf%df%9^rf%ff&', 1d0,xAxisMin,'+', clearPL, plotSP,  1d0, xAxisMax,'+', clearPL, plotSP)
   i = winio@  ('Set Ymin, Ymax%ta%df%9^rf%df%9^rf%ff&', 1d0,yAxisMin,'+', clearPL, plotSP,  1d0, yAxisMax,'+', clearPL, plotSP)

   i = winio@  ('%cn%^bt[PLOT]%^bt[Clear]%ff&', '+', clearPL, plotSP, clearPL)

   i = winio@  ('%ac[Esc]&', 'exit')
   i = winio@  ('%hw%lw', ihandleSP2, lw_SP2)     

   jj = plotSP()

   end

Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Nov 18, 2017 9:52 am    Post subject: Reply with quote

I can't see a problem at the moment.
Which "min values" are you referring to?
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



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

PostPosted: Sat Nov 18, 2017 10:29 am    Post subject: Reply with quote

Paul,
Apologies for raising this again, but can I reiterate my suggestion for an option to place the text for the scales external to the frame. It's one limitation of the present %pl which I cannot devise a "work around" before the call to %pl, and it really spoils plots like this one.



In this example I am drawing the circles after the plot is formed (there is an invisible graph plotted first to establish the frames).

A quick fix is to use set_opacity@(128) but that results in the plot looking rather "wishy - washy" as we say in Glasgow.

I do have an idea of how I could fix this - but it involves generating two other plots and copying the graphic areas containing the scales into the final plot in which the scales have been suppressed by making the text the same colour as the back-ground - all a bit messy. Hence my gentle reminder.

I cannot simply set the text colour to white before the call to %pl, and add the scale text via the call back as the user specified dx and dy values are not always used.

Same plot, using set_opacity@ tricks:-



It's OK, but external scales would be better

Thanks
Ken Very Happy


Last edited by Kenneth_Smith on Sat Nov 18, 2017 11:56 am; edited 2 times in total
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Sat Nov 18, 2017 11:15 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
I can't see a problem at the moment.
Which "min values" are you referring to?


Paul,
I already wrote my suspicion that you guys at SF do not use debugger, but that you also do not use FTN95 I started to suspect after beginning of this thread Smile Smile Smile This is why the one-line code with 6 bugs I published here at least 3 times and twice sent by PM was not fixed for so long time Smile Smile Smile

So suspecting this I added %df and %9^rd specially to simplify the process of choosing numbers - just click and see that the red dot is at X=1 or 2 , 3 or 4 when Xmin is 0, 1, 2 or 3 but it had to be always at X=1 at any Xmin. Same for Ymin (here watch also how axis name Width becomes not centered, and minus sign is too far from the numbers). But for that it is necessary to compile the code and make an EXE file not just look at the source and do the calculation in the head. Smile
In your head this code works fine and has no errors because compilers are different !!! Smile

Was just kidding.
Or may be not?

Ken,
Hope your suggestion will be realized. But there exist another option. I do not know how difficult is to realize it. It requires the letters with the cast like here. Doable easily? Our students with Python doing this, looks perfect.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Nov 18, 2017 2:48 pm    Post subject: Reply with quote

Dan

Can you check the code that you have posted. I may be missing something but I don't think it does what you say. Try running it after copying it back to your computer.

Ken

I have noted your request. In the meantime one way to fix the presentation is to draw the axes with an offset.

Code:
      CALL winop@("%pl[y_axis=Amplitude@(-30,0)]")
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Sat Nov 18, 2017 4:57 pm    Post subject: Reply with quote

Dan

I have tried to work out what your program is intended to do but I can't make it out. It plants an "ellipse" at (1,1) and the range for the axes is changed via %rf edits. But the changed values are not implemented in the drawing of the graph.

If, in your version of the program, the "ellipse" is not drawn when the xAxisMax value goes negative then that is what should happen.

Apart from the fact that the program is not functional, the only error I can see is that the parameters graph1 (=1) and link_none (=0) have not been defined or set.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Sat Nov 18, 2017 8:20 pm    Post subject: Reply with quote

Paul,
I checked the code above and all works like i described.
Not sure undefined variable was important and not sure i fixed this undefined error correctly, but there is no undefined errors right now in little bit edited code below.

Now i hope that all users with older then 8.20 versions can reproduce this bug as i commented two lines setting dx= and dy=. This compiler needs more active users, this will help its development.

Do the following: for simplicity do not change anything but Xmin

1) When start the code do you see the red dot at X=1, Y=1 ?
2) Change Xmin to -3. Do you see that the red dot still stays at the same point ? Same with Xmin=-2 or -1 or -10.
3) Now set Xmin=1 . Do you see red dot moved to X=2 while it must stay still at X=1? DONE

You may play further and see that at Xmin=2 the red dot moved to 3.
You may also edit the code and set position of red dot at any place, for example at 3,3
Code:
  call get_plot_point@(3d0, 3d0, xEllipse, yEllipse)
But as soon as Xmin becomes >0.5 the displayed position of red dot will be wrong

Code:
module surfplot2mod
   use clrwin

   integer (7) ihandleSP2
   real*8 x(2),y(2), xEllipse, yEllipse
   real*8 xAxisMin, xAxisMax, yAxisMin, yAxisMax

CONTAINS
   INTEGER FUNCTION plotSP()

   x(1)=xAxisMin
   x(2)=xAxisMax
   y(1)=yAxisMin
   y(2)=yAxisMax

   call simpleplot_redraw@

   ixR=7; iYr=7
   call get_plot_point@(1d0, 1d0, xEllipse, yEllipse)
   call draw_filled_ellipse@ (nint(xEllipse), nint(yEllipse),ixR,iYr,rgb@(244,0,0) )
   call UPDATE_WINDOW@(ihandleSP2)

   plotSP= 2
   end function plotSP
!......................................................
   INTEGER FUNCTION clearPL()
     CALL simpleplot_redraw@()
     clearPL = 2
   END FUNCTION clearPL

end module surfplot2mod

!.......................
Program SurfPlot2
use surfplot2mod

   xAxisMin =-4
   xAxisMax = 5
   yAxisMin =-4
   yAxisMax = 5

   x(1)=xAxisMin
   x(2)=xAxisMax
   y(1)=yAxisMin
   y(2)=yAxisMax

   i = winio@  ('%ww%nr&')                           
   call winop@ ('%pl[native,x_array,N_GRAPHS=1]')
   call winop@ ('%pl[scale=linear]')

   CALL winop@("%pl[tick_len=9]")
!   CALL winop@("%pl[dx=1.]") 
!   CALL winop@("%pl[dy=1.]") 

   i = winio@  ('%sf%ts%bf&', 2d0)   

   call winop@ ("%pl[framed,axes_pen=3,width=3,x_axis='Length',y_axis='Width']")

   i = winio@  ('%pv%pl&',800,600,2,x,y)!
   i = winio@  ('%sf%ts%ff&', 1d0)

   i = winio@  ('Set Xmin, Xmax%ta%df%9^rf%df%9^rf%ff&',1d-1,xAxisMin,'+', clearPL, plotSP,  1d0, xAxisMax,'+', clearPL, plotSP)
   i = winio@  ('Set Ymin, Ymax%ta%df%9^rf%df%9^rf%ff&',1d-1,yAxisMin,'+', clearPL, plotSP,  1d0, yAxisMax,'+', clearPL, plotSP)

   i = winio@  ('%cn%^bt[PLOT]%^bt[Clear]%ff&', '+', clearPL, plotSP, clearPL)

   i = winio@  ('%ac[Esc]&', 'exit')
   i = winio@  ('%hw%lw', ihandleSP2, lw_SP2)     

   jj = plotSP()

   end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Nov 20, 2017 11:12 am    Post subject: Reply with quote

Dan

I haven't worked out exactly what is wrong with your code. Either it's related to the order that the callbacks are called or maybe a callback is being called from a callback. If the latter then perhaps PERMIT_ANOTHER_CALLBACK@ might fix it. Anyway here is a modified version of your code that does what I assume you want.

Code:
MODULE surfplot2mod
   USE clrwin
   INTEGER(7) ihandleSP2
   REAL*8 x(2),y(2), xEllipse, yEllipse
   REAL*8 xAxisMin, xAxisMax, yAxisMin, yAxisMax
CONTAINS
   INTEGER FUNCTION plCB()
      ixR=7; iYr=7
      CALL get_plot_point@(1d0, 1d0, xEllipse, yEllipse)
      CALL draw_filled_ellipse@(nint(xEllipse), nint(yEllipse),ixR,iYr,rgb@(244,0,0))
      CALL update_window@(ihandleSP2)
      plCB = 2
   END FUNCTION plCB
!......................................................
   INTEGER FUNCTION plotSP()
   x(1)=xAxisMin
   x(2)=xAxisMax
   y(1)=yAxisMin
   y(2)=yAxisMax
   CALL simpleplot_redraw@
   plotSP = plCB()
   plotSP= 2
   END FUNCTION plotSP
END MODULE surfplot2mod
!.......................
PROGRAM SurfPlot2
USE surfplot2mod
   xAxisMin =-4
   xAxisMax = 5
   yAxisMin =-4
   yAxisMax = 5
   x(1)=xAxisMin
   x(2)=xAxisMax
   y(1)=yAxisMin
   y(2)=yAxisMax
   i = winio@  ('%ww%nr&')                           
   CALL winop@ ('%pl[native,x_array,N_GRAPHS=1]')
   CALL winop@ ('%pl[scale=linear]')
   CALL winop@("%pl[tick_len=9]")
   CALL winop@("%pl[dy=1.0]")
   i = winio@  ('%sf%ts%bf&', 2d0)   
   CALL winop@ ("%pl[framed,axes_pen=3,width=3,x_axis='Length',y_axis='Width']")
   i = winio@  ('%pv%^pl&',800,600,2,x,y,plCB)
   i = winio@  ('%sf%ts%ff&', 1d0)
   i = winio@  ('Set Xmin, Xmax%ta%df%9^rf%df%9^rf%ff&',1.d0,xAxisMin,plotSP,1d0,xAxisMax,plotSP)
   i = winio@  ('Set Ymin, Ymax%ta%df%9^rf%df%9^rf%ff&',1.d0,yAxisMin,plotSP,1d0,yAxisMax,plotSP)
   i = winio@  ('%cn%^bt[PLOT]%ff&',plotSP)
   i = winio@  ('%ac[Esc]&', 'exit')
   i = winio@  ('%hw%lw', ihandleSP2, lw_SP2)     
END
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Tue Nov 21, 2017 12:11 am    Post subject: Reply with quote

Paul,
I see exactly the same problem in you code. The doubledevilry ... like the two headed ridge nearby called Diablo Smile

All,
Please check that if you increase Xmin > 0.5 the red dot moves instead to stay still at x=1 like it should
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Tue Nov 21, 2017 10:31 am    Post subject: Reply with quote

Thanks, John. Letters jammed are OK. I see last month Paul started with scaling option, hopefully he will complete it in the future so that scaling will work with all elements of the plot (text sizes, borders, line widths). Right now it scales only plotting area, as i remember

This message is to all,
Can you please run my code in the page 17 choosing "PL" option gradually decreasing the size of plotting area to zero ? Do you see that the ring pattern is plotted OK? I see all OK, John gets empty plotting area
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Nov 21, 2017 10:46 am    Post subject: Reply with quote

Things are beginning to make sense...

On a different thread http://forums.silverfrost.com/viewtopic.php?t=3505 you will find a reference to unwanted callback reasons "?". One way that these occur is when an action in a callback function leads to another callback function being called. This malfunction is now blocked in the latest ClearWin+ that I am using and which has not yet been released.

This means that you will be getting a different experience from me. It also means that the root problem is (almost certainly) that of one callback leading immediately to a call to another (or worse still) a call to itself.

You might observe this by tracking the callback reason but I suggest that you put this issue on the back burner until you get the next release of the ClearWin+ library.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



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

PostPosted: Tue Nov 21, 2017 5:30 pm    Post subject: Reply with quote

Paul,

Another one for you to look at I am afraid. GET_PLOT_POINT@ only works properly if the range between xmin and xmax spans zero, and the range between ymin and ymax also spans zero.

The following code illustrates the issue. With the initial values, the point is drawn at the correct coordinates (0.5,0.50), but if you change xmin to 0.5 for example, the point is incorrectly drawn at (1.0,0.5). Same occurs with the y axis.

Regards

Ken


Code:
module main_mod
implicit none
integer, parameter :: dp = kind(1.d0)
real(kind=dp):: xmin=0.d0, xmax=1.d0, ymin=0.d0, ymax=1.d0, x = 0.5d0, y = 0.5d0

contains

integer function main01()
include<windows.ins>
integer i
i = winio@('%ws&','Range values for plot')
i = winio@('%nl%ws%ta%rf%ta%ws%ta%rf&',   'Xmin', xmin, 'Xmax', xmax)
i = winio@('%nl%ws%ta%rf%ta%ws%ta%rf&' ,'Ymin', ymin, 'Ymax', ymax)
i = winio@('%nl%ws&','Point to be plotted')
i = winio@('%nl%ws%ta%rf&','X',x)
i = winio@('%nl%ws%ta%rf&','Y',y)
i = winio@('%ta%^bb[plot]',plot)
main01= 1
end function main01

integer function plot()
include<windows.ins>
integer i
real(kind=dp) x1(2), y1(2)

if ( (xmax .le. xmin) .or. (ymax .le. ymin) ) then
  write(6,*) 'ERROR in input data'
  plot = 1
  return
end if

x1(1) = xmin  ; x1(2) = xmax ; y1(1) = ymin ; y1(2) = ymax
i = winio@('%^pl[native,x_array,colour=white,gridlines,framed]&',400,400,2,x1,y1, update)
i = winio@('%ff%cn%bb[OK]')
plot = 1
end function plot

integer function update()
include<windows.ins>
real(kind=dp) xpix, ypix
call GET_PLOT_POINT@(x,y,xpix,ypix)
call draw_filled_ellipse@(nint(xpix),nint(ypix),2,2,rgb@(0,0,0))
update = 1
end function update

end module main_mod

program main
use main_mod
implicit none
integer i
i = main01()
end program main


And a picture. Two examples, left is correct, right is not.



====================
A little more:-

Thinking about this, maybe the function is returning the correct coordinates if the axis were placed over the origin at (0,0). Maybe we need another function that takes account of any displacement of the plot origin from (0,0,)? I guess what I saying is that the returned value is not the one I naturally thought the function would return. Hope this make sense.
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Wed Nov 22, 2017 7:34 am    Post subject: Reply with quote

Problem solved. get_plot_point2 demonstrates that I thought GET_PLOT_POINT@ would do. Note that you need to explicitly know xmin for this to work.


Code:
module main_mod
implicit none
integer, parameter :: dp = kind(1.d0)
real(kind=dp):: xmin=0.d0, xmax=1.d0, ymin=0.d0, ymax=1.d0, x = 0.5d0, y = 0.5d0

contains

integer function main01()
include<windows.ins>
integer i
i = winio@('%ws&','Range values for plot')
i = winio@('%nl%ws%ta%rf%ta%ws%ta%rf&',   'Xmin', xmin, 'Xmax', xmax)
i = winio@('%nl%ws%ta%rf%ta%ws%ta%rf&' ,'Ymin', ymin, 'Ymax', ymax)
i = winio@('%nl%ws&','Point to be plotted')
i = winio@('%nl%ws%ta%rf&','X',x)
i = winio@('%nl%ws%ta%rf&','Y',y)
i = winio@('%ta%^bb[plot]',plot)
main01= 1
end function main01

integer function plot()
include<windows.ins>
integer i
real(kind=dp) x1(2), y1(2)

if ( (xmax .le. xmin) .or. (ymax .le. ymin) ) then
  write(6,*) 'ERROR in input data'
  plot = 1
  return
end if

x1(1) = xmin  ; x1(2) = xmax ; y1(1) = ymin ; y1(2) = ymax
i = winio@('%^pl[native,x_array,colour=white,gridlines,framed]&',400,400,2,x1,y1, update)
i = winio@('%ff%cn%bb[OK]')
plot = 1
end function plot

integer function update()
include<windows.ins>
real(kind=dp) xpix, ypix
!call GET_PLOT_POINT@(x,y,xpix,ypix)
call get_plot_point2(x, y, xmin, ymin, xpix, ypix)
call draw_filled_ellipse@(nint(xpix),nint(ypix),2,2,rgb@(0,0,0))
update = 1
end function update

subroutine get_plot_point2(x, y, xmin, ymin, xpix, ypix)
include<windows.ins>
real(kind=dp), intent(in) :: xmin, ymin, x, y
real(kind=dp), intent(out) :: xpix, ypix
real(kind=dp) :: xpix0, ypix0, xminpix, yminpix
call GET_PLOT_POINT@(0.d0,0.d0,xpix0,ypix0)
call GET_PLOT_POINT@(xmin,ymin,xminpix,yminpix)
call GET_PLOT_POINT@(x,y,xpix,ypix)
xpix = xpix - (xminpix - xpix0)
ypix = ypix - (yminpix - ypix0)
end subroutine get_plot_point2

end module main_mod

program main
use main_mod
implicit none
integer i
i = main01()
end program main
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 ... 12, 13, 14 ... 26, 27, 28  Next
Page 13 of 28

 
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