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 

Set tight axis limits

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



Joined: 10 Sep 2006
Posts: 105
Location: United Kingdom

PostPosted: Mon Jan 08, 2024 3:42 pm    Post subject: Set tight axis limits Reply with quote

Hello

Quick query. How do you set tight limits on an axis? Currently a plot goes from 0 to 105 on x-axis but I need it to be tight in the range 0-100. An example code would be useful.

Thanks

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


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

PostPosted: Mon Jan 08, 2024 5:42 pm    Post subject: Reply with quote

arctica

Please post the code that needs to be refined.
Back to top
View user's profile Send private message AIM Address
arctica



Joined: 10 Sep 2006
Posts: 105
Location: United Kingdom

PostPosted: Mon Jan 08, 2024 5:49 pm    Post subject: Reply with quote

Here is the code

Code:

program Riemann_Zeta

  use clrwin
  integer :: iw

  integer, parameter :: k = 10001
  integer, allocatable :: t(:)
  real, allocatable :: vec(:)
  real, dimension(k) :: zeta
  integer :: i, j, n, im, export_cb
  real :: real_part(k), imaginary_part(k), start, finish, a, inc
  complex :: s(k)
  external :: export_cb

  call clock@(start)

  open(25,file='complex_zeta.csv',status='replace')
 
  t=(/0, (i,i=1,k)/)

  a = 0.    ! initial value
  inc = 0.01 ! increment value
  n = 10001   ! number of values 
  allocate(vec(n))
  vec = [(a + (i-1) * inc, i=1,n)]  ! array constructor

  do j = 1, k
     s(j) = cmplx(0.5,vec(j)) ! Generate array of complex numbers (0-100)
  end do

     zeta = zeta_3(s,10000) ! Compute complex Zeta function values

  real_part = real(zeta_3(s,10000))
  imaginary_part = aimag(zeta_3(s,10000))

  !do i = 1, k
  write(25,'(f15.12,",",f15.12,",",f15.12)') (real_part(i), imaginary_part(i), vec(i), i=1,k) ! write data to csv file
  !end do

  close(25)
  call clock@(finish)

  print *, zeta_3(cmplx(0.5,1.0),10000) ! complex number fixed value

  print *, 'Processing time was ', finish-start, ' seconds'

  iw = winio@('%mn[Exit]&','Exit')
  iw = winio@('%mn[Export]&',export_cb)
  iw = winio@('%fn[Times New Roman]%ts%bf&',1.5d0)
  call winop@('%pl[native,x_array,frame,gridlines,width=1.5,link=curves,colour=red,colour=blue]')
  call winop@('%pl[xaxis="Real(t)",yaxis="Zeta(s)"]')
  call winop@('%pl[Title="Riemann Zeta function (s = 0.5 + i*t)"]')
  iw = winio@('%pl&',1400,800,k,dble(vec),dble(real_part),dble(imaginary_part))
  !iw=winio@('%PL[file=testplot.jpg, N_GRAPHS=1]', 1000, 800, k, dble(real_part), dble(imaginary_part))
  iw = winio@('')

contains
 
elemental function zeta_3(s,n) result(zs1)
   integer,allocatable :: nn(:)
   integer, intent(in) :: n
   complex zs1
   complex, intent(in) :: s
   allocate (nn(n))
   nn = (/(i,i=1,n)/)
   zs1 = sum((-1)**(nn + 1)/(nn**s ))
   zs1 = 1/(1 - 2**( 1-s ))*zs1
end function zeta_3

end program

integer function export_cb()
use clrwin
  im = EXPORT_IMAGE@('plot.jpg')
  export_cb = 2
end function export_cb


Still learning about Clearwin.
Back to top
View user's profile Send private message
Kenneth_Smith



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

PostPosted: Mon Jan 08, 2024 8:42 pm    Post subject: Reply with quote

Add
Code:
  call winop@('%pl[x_min=0,x_max=100]')

immediately before
Code:
iw = winio@('%pl&',1400,800,k,dble(vec),dble(real_part),dble(imaginary_part))
Back to top
View user's profile Send private message Visit poster's website
arctica



Joined: 10 Sep 2006
Posts: 105
Location: United Kingdom

PostPosted: Wed Jan 10, 2024 8:25 am    Post subject: Reply with quote

Thanks Kenneth! That worked fine.

Lester
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
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