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 

Failure of %pl[native] options frame, framed and etched

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Kenneth_Smith



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

PostPosted: Thu Dec 03, 2020 4:04 pm    Post subject: Failure of %pl[native] options frame, framed and etched Reply with quote

Paul, one for you to look at when you have the chance. In this example, the specific combination of 11 data points with x values running from -10 to 0 causes the %pl option frame to fail. The left-hand vertical frame element is not drawn. This also happens with the alternative options framed and etched.

Code:
module example
use clrwin
implicit none
integer, parameter :: dp = kind(1.d0)
integer,parameter  :: npts = 11
real(kind=dp)      :: x(1:npts) = 0.d0, y(1:npts) = 0.d0, a(1:3) = (/0.d0,0.d0,1.d0/)
real(kind=dp)      :: xmin = -10.d0, xmax = 0.d0

contains

  integer function gui()
  integer :: iw
    iw = winio@('%mn[Exit]&','exit')
    iw = winio@('%bg&',rgb@(250,250,250))
    iw = winio@('%2.1ob&')
    iw = winio@('%nl y = c*x^2 + b*x + a&')
    iw = winio@('%2nlxmin%ta%`bg[white]%8rf%2nlxmax%ta%`bg[white]%8rf&',xmin,xmax)
    iw = winio@('%2nla%ta%`bg[white]%8rf%2nlb%ta%`bg[white]%8rf%2nlc%ta%`bg[white]%8rf&',a(1),a(2),a(3))
    iw = winio@('%2nl%cn%^bb[Update plot]%cb&',plot_cb)
    call winop@('%pl[native,x_array,frame,link=curves,colour=blue,width=2,gridlines,symbol=13]')
    iw = winio@('%pl&',600,400,npts,x,y)
    iw = winio@('%cb')
    gui = 2
  end function gui

  integer function plot_cb()
  integer i
  integer :: iw
  real(kind=dp) inc
    if (xmax .le. xmin) then      ! ERROR
        iw = winio@('XMAX must be greater than XMIN%2nl%cn%bb[OK]')
        x = 0.d0 ; y = 0.d0 ; call SIMPLEPLOT_REDRAW@() ; plot_cb =2 ; return
    else                          ! NORMAL
        inc = (xmax - xmin)/dble(npts-1)
        x(1) = xmin
        do i = 2, npts, 1
          x(i) = x(i-1) + inc
        end do
        do i = 1,npts, 1
          y(i) = a(1) + x(i)*a(2) + x(i)*x(i)*a(3)
          !! print*, i, x(i), y(i)
        end do
        call SIMPLEPLOT_REDRAW@()
    end if
    plot_cb = 2
  end function plot_cb
end module example

program main
use example
i = gui()
end program main


PS There are other combinations of XMIN, XMAX, and NPTS which have this issue. XMAX = 0 is common to all of these.
Quote:
NPTS = 2, XMIN = -10, XMAX = 0
NPTS = 3, XMIN = -10, XMAX = 0
NPTS = 5, XMIN = -10, XMAX = 0
NPTS = 6, XMIN = -10, XMAX = 0
NPTS = 9, XMIN = -10, XMAX = 0
NPTS = 11, XMIN = -10, XMAX = 0
NPTS = 17, XMIN = -10, XMAX = 0
NPTS = 21, XMIN = -10, XMAX = 0
NPTS = 2, XMIN = -10.1, XMAX = 0
NPTS = 3, XMIN = -10.1, XMAX = 0
NPTS = 19, XMIN = -10.1, XMAX = 0


Last edited by Kenneth_Smith on Fri Dec 04, 2020 1:24 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Dec 03, 2020 4:57 pm    Post subject: Reply with quote

Ken

Thanks. I have noted this.
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
Page 1 of 1

 
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