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 ... 9, 10, 11 ... 26, 27, 28  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
John-Silver



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

PostPosted: Sat Oct 14, 2017 2:05 pm    Post subject: Reply with quote

which results in ......

Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Sat Oct 14, 2017 11:19 pm    Post subject: Reply with quote

one other comment is that if I introduce a pivot to allow re-sixģzing of the window it produces this on resize , not sure what the problem is. It happens with your original code as well as my modified one) ....

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



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

PostPosted: Sun Oct 15, 2017 4:30 pm    Post subject: Reply with quote

John,
You can define the margins as integer variables and build up the pl string as follows before the final call to pl.

Code:
module pl_routines
implicit none
contains
  subroutine set_pl_margins(top, bottom, left, right)
  include<windows.ins>
  integer, intent(in) :: top, bottom, left, right
  character(len=5), parameter :: fmt1 = '(I5)'
  character(len=5)  t_txt, b_txt, l_txt, r_txt
  character(len=12):: start_str = '%pl[margin=('
  character(len=2 ):: end_str = ')]'
  character(len=80)   str
  write(t_txt,fmt1) top      ;  write(b_txt,fmt1) bottom
  write(l_txt,fmt1) left     ;  write(r_txt,fmt1) right
  ! Call to %pl[margin...] is left, top, right, bottom
  str = start_str//trim(adjustl(l_txt))//','&
                 //trim(adjustl(t_txt))//','&
                 //trim(adjustl(r_txt))//','&
                 //trim(adjustl(b_txt))//end_str
    write(6,*) str
    call winop@(str)   
  end subroutine set_pl_margins 
end module pl_routines

program test
use pl_routines
implicit none
include<windows.ins>
integer, parameter :: npts = 11
real(kind=2) x(1:npts), y(1:npts)
integer i, t, b, l, r
  t = 200 ; b = 200 ; l = 100 ; r = 100
  do i = 1,npts
    x(i) = i-1
    y(i) = (i-1)**2
  end do
  i = winio@('%mn[Exit]&','exit')
  i = winio@('%fn[Tahoma]&')
  i = winio@('%ts&', 1.5d0)
  call winop@('%pl[native,x_array,N_GRAPHS=1]')
  call winop@('%pl[y_min=0,y_max=100,x_min=0,x_max=10]')
  call winop@('%pl[link=curves, colour=blue, symbol=11, pen_style=0]')
  call set_pl_margins(t,b,l,r)   !top, bottom, left, right
  i = winio@('%`bg[white]&')
  i = winio@('%pl',600,500,npts,x,y)
end program test

Back to top
View user's profile Send private message Visit poster's website
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Sun Oct 15, 2017 11:08 pm    Post subject: Reply with quote

Small change of subject. I have an idea how to plot full-colour area plots rather like Dan has asked for. The only thing that prevents this is that colours are defined by names. I need to be able to use RGB values (as obtained from function RGB@). This should really not be a major problem to implement ?

I would then divide the data set into multiple sets for different value ranges and plot each with a different colour. This would need more than the very limited set of named colours, to allow the use of a full colour palette.

Of course a much neater way to do this would be to allow a separate RGB value to be associated with each X,Y pair - i.e. each point would have its own colour, so we would have 3 arrays, X,Y, RGB. Any chance of doing this ?
Back to top
View user's profile Send private message Visit poster's website
DanRRight



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

PostPosted: Mon Oct 16, 2017 1:30 am    Post subject: Reply with quote

Silicondale, I agree, that would be good addition to Paul's reported concatenation few days back, I do not know how it was done but suspect this way

%pl(X,Y)

where X(i,j) and Y(i,j) are 2D arrays and number of plots j can be very large.

In this case adding color

%pl(X,Y,iColor)

besides expanding functionality of usual X-Y plotting will automatically turn native %pl into 2D surface plotter. But suspect this stuff will be for the future, after our usual 1D X-Y plots will be made perfect


Last edited by DanRRight on Mon Oct 16, 2017 7:46 am; edited 1 time in total
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Oct 16, 2017 4:56 am    Post subject: Reply with quote

Ken,

I think silicondale got with your example problem with resizing.

To do resize just add %ww%pv to %pl'

Code:
i = winio@('%ww%pv%pl%es',600,500,npts,x,y)


By some reason resizing does not work if %ww is absent. In many other cases %ww indeed is redundant (unless this is not some Clearwin bug and %ww must be always present)

In my turn I have difficulty compiling your latest posted codes because always have error

' PROCESSING MODULE [<PL_ROUTINES> FTN95/Win32 v8.10.0]
*** This statement contains an illegal character - ' ''
*** This statement contains an illegal character - ' ''
*** This statement contains an illegal character - ' ''

Is this some kind of a celtic space of some UTF8 character coding ? Smile. Removing all spaces solves the problem.

Do others also have similar problems?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Oct 16, 2017 7:35 am    Post subject: Reply with quote

Silicondale

I am not sure if this is what you need but you can set the colour via

call winopt@("%pl[colour=#bbggrr]")

where bb is the hex value for the blue component etc.

For example:

call winopt@("%pl[colour=#FF0000]")

for blue etc.

It's a little more tricky if the colour is "dynamic". For example if the colour has components R,G,B then you would need something like...

Code:
        write(str,"(a,z6.6,a)") "%pl[colour=#", RGB@(B,G,R), "]"
        CALL winop@(trim(str))


because we need the reverse order to that given by RGB@.

p.s. This post is incorrect. See new post in this thread.


Last edited by PaulLaidler on Mon Nov 06, 2017 4:27 pm; edited 1 time in total
Back to top
View user's profile Send private message AIM Address
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Mon Oct 16, 2017 8:01 am    Post subject: Reply with quote

Paul - many thanks for that. Certainly goes some of the way towards what we need, especially your 'dynamic colour' workaround. Ideally we should be able to attach a different colour to each individual point, but this is certainly a start. Could of course split the data into thousands of separate one-element arrays each with its own colour, but that wouldn't really be workable with %pl as it is!

By the way, I have been using winop@ but this is the first time I have seen winopt@ - can you point me to any documentation, please?

Odd that you use #bbggrr - the standard that I think is more commonly used (such as in HTML coding, for example) is #rrggbb
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Mon Oct 16, 2017 8:57 am    Post subject: Reply with quote

winopt@ was just my typing error. It should be winop@.
I am guessing that #bbggrr is somebody's standard. Is it not HTML?
Back to top
View user's profile Send private message AIM Address
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Mon Oct 16, 2017 10:38 am    Post subject: Reply with quote

Paul - many thanks. yes, I saw your example was winop@ so realised (after posting) that it was just a mistype.

HTML standard is #rrggbb -- see https://www.w3schools.com/colors/default.asp for details.

Maybe I'm misunderstanding something, but the RGB@ documentation (in the FTN95 help file) has the arguments in the order RED GREEN BLUE. I supply values Red=127 Green=0 and Blue=0 which should give a dark red colour. The RGB@ function gives value 127 or Hex 00007F - which is dark blue.
However if I supply Red=0 Green=0 Blue=127 which should give dark blue, the RGB@(0,0,127) = 8323072 = Hex 7F0000 = dark red.

Not sure what is going on here! Maybe generation of the Hex #rrggbb colour code should not just be using the Z6.6 format but should take each byte separately in the order R, G, B - probably easiest to do by avoiding RGB@ altogether but using the red, greem, and blue separately.

This works correctly:

Code:

      write(pltext,"(a,3z2.2,a)") '%pl[colour=#', ir,ig,ib, ']'
      call winop@(trim(pltext))
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Mon Oct 16, 2017 11:25 am    Post subject: Reply with quote

It's just that RGB@ gives the wrong order for this context so you have to use it in an unnatural way (i.e. we need a BGR@ function at this point).

Anyway, your approach is better.
Back to top
View user's profile Send private message AIM Address
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Mon Oct 16, 2017 1:04 pm    Post subject: Reply with quote

Here is a simple demo of surface display using %pl, that Dan wanted to achieve. Using 4 arrays for different data value ranges, with different colours, small filled square symbols. Could generalise this, but stuck with limitation of 10 arrays - and messy coding as we need to hold the data in 10 separate sets of x,y arrays instead of a single set and a colour-code array.



This is what I would like to achieve (and I suspect a bit closer to what Dan wants), with an unlimited number of different colours.



For that, we would need to be able to supply x,y,rgb arrays to %pl, not just x,y[/img]
Back to top
View user's profile Send private message Visit poster's website
Kenneth_Smith



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

PostPosted: Mon Oct 16, 2017 1:26 pm    Post subject: Reply with quote

Silicondale, Paul did say in an earlier post that the limit on the number of plots (10) has been removed, so when the next DLL comes out you will be able to expand on your 1st 2-d plot. We'll also get grid lines then Very Happy
Back to top
View user's profile Send private message Visit poster's website
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Mon Oct 16, 2017 1:36 pm    Post subject: Reply with quote

Thanks, Ken - I missed that one! That is good news.

What I shall need to do now is work out how to tidy up the coding - and add a colour palette to the side of the plot. Adding a general feature such as copying and pasting a graphics region on to the plot could allow that!

Fortunately for most of what I need, I don't have to go into the complexities of log-log plots, etc!

..... a little later .....

OK, have now hit limit of N-GRAPHS (tried 16, doesn't work. 10 works). Have also added a colour ramp.



Just a couple of problems with this.
(1) the y axis annotation doesn't appear. Since I can't see it anywhere (I tried a wider margin but that didn't help) I can't move it to somewhere visible.
(2) I'd like to be able to put the colour ramp into one of the margins, so it will get saved in any exported jpg or png file - but can't find any way to do this.
Back to top
View user's profile Send private message Visit poster's website
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Tue Oct 17, 2017 5:55 pm    Post subject: Auto scaling for neat lower and upper limits Reply with quote

btw - there has been some discussion on setting 'nice' limits. For what it's worth here's a very old subroutine (you can see from the fixed-format coding!) that I have used for decades to do exactly that job

Code:
      subroutine v_autsca (upr, alr)
      implicit double precision (a-h,o-z)
c
c ************************************************************
c * v_autsca  auto-scaling algorithm ... sets min and max    *
c *         values for plotting at round numbers which       *
c *         include the full data range. alr and upr on input*
c *         hold the raw values, on output hold the rounded  *
c *         values                                           *
c ************************************************************
c first make sure alr and upr are the right way round!
      if (upr.lt.alr) then
        t = upr
        upr = alr
        alr = t
      end if
c
      range = abs(upr - alr)
      if ( range.le.1.0e-6 ) go to 9000
      rl = alog10(range)
      lr = int(rl) - 1
      size = 10.0**lr
      up = upr/size
      al = alr/size
      up = (aint(up) + 1.0)*size
      al = (aint(al))*size
      upr = up
      alr = al
9000  return
      end
Back to top
View user's profile Send private message Visit poster's website
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 ... 9, 10, 11 ... 26, 27, 28  Next
Page 10 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