 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
stenlou
Joined: 24 Jun 2008 Posts: 30 Location: Germany and Denmark
|
Posted: Thu Nov 21, 2013 8:47 am Post subject: Re: Variable Multiple X-Y Plots |
|
|
John
You can do this both ways. I assume you are aware of Simpleplot.
In clearwin you setup a window with the list of you variables (I assume one list for X and another for Y) that the user can select.
Read the two variable into two one-dimensional arrays and then plot these using Simpleplot.
Sten
ps need more help? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Mon Dec 09, 2013 8:56 am Post subject: |
|
|
If you are using %gr then you can probably call clear_screen@ and then draw everything that the user has selected. |
|
Back to top |
|
 |
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Mon Dec 09, 2013 12:17 pm Post subject: Variable Multiple X-Y Plots |
|
|
John,
I would read-in all data, then create a WINIO window containing e.g. at the top or at the left side a multiple selection box %ms to select the five columns to be displayed and may be some more switches and buttons to control the graphics. Add a callback function to remove the oldest selection when the user selects too many values.
Then place a (scalable) %gr graphics window at the right or bottom inside the same window.
Check the actual graphics size with
Code: | IXRESOL = CLEARWIN_INFO@ ('SCREEN_WIDTH')
IYRESOL = CLEARWIN_INFO@ ('SCREEN_DEPTH')
| Check the range of your data to be displayed and scale it down to pixel values.
Then you have e.g. the following functions available:
Code: | CALL Draw_Line_Between@ (iX1, iY1, iX2, iY2, nColor)
CALL Draw_Rectangle@ (iX1, iY1, iX2, iY2, nColor)
CALL Draw_Ellipse@ (iX1, iY1, iRA, iRB, nColor)
CALL POLYLINE@ (iXP, iYP, nPol, nColor)
CALL Rotate_Font@ (ROTA)
CALL Bold_Font@ (irb_ColorMode)
CALL Draw_Characters@ (Text(1:LTX), IX1, IY1, nColor)
CALL Draw_Point@ (iX, iY, nColor)
| Take care, that you pixel coordinates are inside [-32767, +32767]
I hope this will help a little.
Erwin |
|
Back to top |
|
 |
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Mon Dec 09, 2013 12:59 pm Post subject: |
|
|
From my experience it has advantages to have all coordinates in pixel, e.g. when you add text or self-made symbols.
Find the largest and smallest X,Y values of the selected vectors, build the difference max-min and bring it in relation to your drawing window. this gives the scale factor.
Reduce your coordinates to the min-values and multiply it with the scale. Then all your drawing will fit to your %gr window.
The coordinates in the listed drawing functions are integer*2 values!
-32767 to +32767 is definitely enough for all available screens. Your drawing window might be only 1800 x 1100.
Erwin |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Tue Dec 10, 2013 8:41 am Post subject: |
|
|
Quote: | The coordinates in the listed drawing functions are integer*2 values! |
This was the case for DBOS graphics. So if the routines (e.g. draw_line@) are ported from DBOS then the arguments will be 16 bit integers. However, most of these routines have 32 bit alternatives (e.g. draw_line_between@) and these are the ones that are listed in ftn95.chm and online. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2924 Location: South Pole, Antarctica
|
Posted: Tue Dec 10, 2013 6:16 pm Post subject: |
|
|
draw_line@ looks better then draw_line_between@.
Is it possible just to make two equivalent and both 32bit? Who cares about DBOS now, and even few still care they will not notice 16-->32 bit change under the hood. Both functions use integer*4 parameters by the way and no one knows or cares what's inside of these functions if both work absolutely fine without slightest difference to outside world. In short, there is no reason to make draw_like@ obsolete |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Tue Dec 10, 2013 7:58 pm Post subject: |
|
|
Quote: | draw_line@ looks better then draw_line_between@. |
These two routines are the same internally. The same code just different integer types on entry. So the appearance ought to be identical. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2924 Location: South Pole, Antarctica
|
Posted: Wed Dec 11, 2013 2:18 am Post subject: |
|
|
I use draw_line@ exclusively for Win32 application with entry variables of integer*4. Is it different for draw_line_between@ ? |
|
Back to top |
|
 |
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Wed Dec 11, 2013 10:00 am Post subject: |
|
|
Dan,
as long as formal integer*2 parameters in functions are no arrays, they can be called as well with integer*4 values because of byte-shift. (I think)
Erwin |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Wed Dec 11, 2013 12:19 pm Post subject: |
|
|
The following code demonstrates that you can provide an I*4 variable to a routine expecting an I*2 or I*1 variable, as long as there is no overflow. If an integer*2 array is expected then this approach will not work.
The same approach can NOT be used when mixing REAL*8 and REAL*4, as the exponent is in a different location.
Code: | integer*8 ix, iy
real*8 rx, ry
!
ix = 1024
iy = 767
!
call draw_line_i4 (ix, iy)
call draw_line_i2 (ix, iy)
call draw_line_i1 (ix, iy)
!
rx = 1024
ry = 768
!
call draw_line_r8 (rx, ry)
call draw_line_r4 (rx, ry)
end
subroutine draw_line_i4 (ix, iy)
integer*4 ix(2), iy(2)
write (*,*) 'I4_x',ix
write (*,*) 'I4_y',iy
end
subroutine draw_line_i2 (ix, iy)
integer*2 ix(4), iy(4)
write (*,*) 'I2_x',ix
write (*,*) 'I2_y',iy
end
subroutine draw_line_i1 (ix, iy)
integer*1 ix(8), iy(8)
write (*,*) 'I1_x',ix
write (*,*) 'I1_y',iy
end
subroutine draw_line_r4 (rx, ry)
real*4 rx(2), ry(2)
write (*,*) 'R4_',rx,ry
end
subroutine draw_line_r8 (rx, ry)
real*8 rx, ry
write (*,*) 'R8_',rx,ry
end
|
Last edited by JohnCampbell on Thu Dec 12, 2013 12:27 am; edited 1 time in total |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2924 Location: South Pole, Antarctica
|
Posted: Wed Dec 11, 2013 5:19 pm Post subject: |
|
|
That means that draw_line@ if it is 16bit inside will still be useful till Gigapixel-scale (2^16 x 2^16) image sizes. This confirms that it is too early to retire it, it will serve for one-two more human generations fine.
I suppose that the only reason to keep draw_line@ as is not changing inside to integer*4 is due to FTN95 option which checks dummy and real argument mismatch. If this is not true, then changing its internals to I4 will not break any legacy codes and reinstate it as current. Did I miss something else? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Wed Dec 11, 2013 9:08 pm Post subject: |
|
|
DRAW_POLYLINE@ is documented as using default integer (i.e. INTEGER*4) arrays. The documentation is in FTN95.chm and online.
INTEGER*4 means 4 byte (32 bit integer).
As noted elsewhere on this thread, with a few exceptions, all the old routines are available (with different names) with INTEGER*2 arguments replaced by INTEGER*4 arguments.
The way to remove the limitations is for users to use the newer names and not the old DBOS names. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2924 Location: South Pole, Antarctica
|
Posted: Thu Dec 12, 2013 5:16 pm Post subject: |
|
|
Because it's simple, natural and "essential" like everything in Fortran (btw, due to these properties of Fortran language and all Fortran functions it will live forever never being obsolete or substituted by other languages). If also Fortran will have graphics inside its Standard, draw_line will be the #1 function there. The draw_line_between will never be there because it sounds like a desperate struggle to find different reasonable term then draw_line.
Also 72 character sources will live 50 years at least or more because most of libraries were written at the time of early Fortran. And based on my codes with a lot of graphics, the source readability is way better if you fit graphics command in one single line. You will have hard time doing that shortening names and math inside its arguments with draw_line_between as i struggle to fit in one line even draw_line. With 132-character sources this is less an issue, but you have to have good multimonitor setup (or soon 4K monitor) to have several editor panels open simultaneously for better visibility of complex sources. BTW, I just found completely forgotten several instances of draw_line_between in my codes but seems the fact that it sounds unnatural and cumbersome i preferred not not to use it
Last edited by DanRRight on Thu Dec 12, 2013 6:04 pm; edited 4 times in total |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Thu Dec 12, 2013 6:39 pm Post subject: |
|
|
The routines for drawing lines are here...
http://www.silverfrost.com/ftn95-help/clearwinp/overview/graphicsfunctions_lines_fill_.aspx
DRAW_LINE@ is no longer documented. You will need to find an old DBOS (hard copy) manual to find the documentation. If you do manage to do this and then test it out, you will find that the result is exactly the same as DRAW_LINE_BETWEEN@.
Theses old routines are no longer supported in the sense that we do not provide documentation for them. However, they do work perfectly well because internally they use the same code. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2924 Location: South Pole, Antarctica
|
Posted: Sat Dec 14, 2013 9:39 pm Post subject: |
|
|
Someone may still keep old Fortran77 manuals. I think I recycled them 3 years ago not being able to handle huge mess of different paper stuff i had. Should probably keep them, will be a treasure rarity few decades from now as the most innovating, most expensive, most unknown to the scientific and engineering public (because of most not advertised) Fortran compiler of all times  |
|
Back to top |
|
 |
|
|
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
|