|
|
Up |
|
|
  |
Author: Robert SingerRobert Singer Date: Sep 16, 2008 19:28
Offtopic really for it's not a a fortran language question, but I'm
sure many in here have dealt with the problem at some point in time.
|
| Show full article (1.30Kb) |
|
| | 13 Comments |
|
  |
Author: nospamnospam Date: Sep 16, 2008 20:38
Robert Singer ____.com> wrote:
> As far as I know fortran has no intristics for rounding numbers, so
> that would be one part of the problem.
Sure it does. And that part is even a Fortran-specific question, so you
ger "credit" for being on topic after all. :-)
See such things as anint. You have to scale as needed to get the
appropriate rounding, but that's trivially doable. How to do things like
rounding has come up here more than once, with several answers. Anint is
one (or just plain aint, as you are probably talking about rounding
down, also known as truncation, or rounding up, instead of rounding to
nearest). Doing internal writes is another way.
For example, 5.*aint(x/5) should round down to a multiple of 5.
> I guess just determining the xmax and multiplying it by 1,1 and then
> rounding up could solve the dilemma, but I'm still interested to hear
> your opinion.
The rounding part is simple, per above.
|
| Show full article (2.29Kb) |
|
| | no comments |
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: Sep 16, 2008 23:17
Robert Singer wrote:
> First, Let me describe what I'm interested in; most of you have used
> excel or some similar program; when you put an array of data in it and
> plot a graph/chart (x-y type), he will automatically determine the
> upper and lower limit of the graph.
(snip)
> Okey, the first step is to determine xmin, xmax and the same for y,
> for the given array. That is not a problem.
> As far as I know fortran has no intristics for rounding numbers, so
> that would be one part of the problem.
X and Y are separate, so just consider one. This is based on
one I have used and modified over the years:
You need Xmin, Xmax, and the desired axis length: Axlen
(number of intermediate tick marks.) Compute the value
for the low end (TL) and tick increment (TX).
real table(14)
! available scale factors, with power of 10 removed
! up to 20 allows for some roundoff that might occur
! on 10th inch graph paper, you might want /1, 2, 5, 10, 20/
data table/1.,1.2,1...
|
| Show full article (2.43Kb) |
| no comments |
|
  |
Author: dpbdpb Date: Sep 16, 2008 22:56
Robert Singer wrote:
> Offtopic really for it's not a a fortran language question, but I'm
...
> plot a graph/chart (x-y type), ... automatically determine the
> upper and lower limit of the graph.
...
Richard has given the gist; like most I've also had routines that did
such but haven't had to use them in ages. My recollection is that mine
did basically what Richard describes but used predefined factors of
1,2,4,5,10 as the ranges and basically turned into a CASE statement block.
--
|
| |
| no comments |
|
  |
Author: James ParslyJames Parsly Date: Sep 17, 2008 07:01
My approach is pretty much as others have described:
1. Get min and max based on data
2. Try a step size.
For integer data I try 1,2,5,10,20,50,... Round min down to next lower
multiple of step size.
Round max up to next higher multiple of step size.
3. Determine number of tick mark labels that the step size would require. If
too many (>10), back to step 2
to try the next step size.
One other thing to consider.
Do you want to have a default range? We often plot water releases from
dams. We make the default range
of data go from 0 to turbine discharge capaciity, but will increase the
range if there is plot data outside the default
(when the dam is spilling water). Having a default range makes it easier to
compare graphs.
"glen herrmannsfeldt" ugcs.caltech.edu> wrote in message
news:nZGdnQcWOaOeAU3VnZ2dnUVZ_qrinZ2d@comcast.com...
> Robert Singer wrote:
>
>> First, Let me describe what I'm interested in; most of you...
|
| Show full article (3.40Kb) |
| no comments |
|
  |
Author: Kevin G. RhoadsKevin G. Rhoads Date: Sep 17, 2008 09:42
In addition to suggestions received so far, I will note that
if one uses log base 10 (i.e., common logs) it is possible
to find the next higher power of ten that contains the
values in question. This is useful for a starting range
when scaling may be wildly disparate form one set to the next.
It is also useful for gridding and generating tick marks.
Example (F77 from early 1980s, target processor M680000):
*----------
ENTRY GENTIX
TIKS = .TRUE.
GRDS = .FALSE.
XOR = .TRUE.
6789 CONTINUE
XRANGE = XMAX - XMIN
YRANGE = YMAX - YMIN
XPOW = ALOG10(XRANGE)
YPOW =...
|
| Show full article (3.31Kb) |
| no comments |
|
  |
Author: GaryScottGaryScott Date: Sep 17, 2008 15:34
On Sep 17, 11:42Â am, "Kevin G. Rhoads" alum.mit.edu> wrote:
> In addition to suggestions received so far, I will note that
> if one uses log base 10 (i.e., common logs) it is possible
> to find the next higher power of ten that contains the
> values in question. Â This is useful for a starting range
> when scaling may be wildly disparate form one set to the next.
> It is also useful for gridding and generating tick marks.
>
> Example (F77 from early 1980s, target processor M680000):
>
> *----------
> Â Â Â ENTRY GENTIX
> Â Â Â TIKS = .TRUE.
> Â Â Â GRDS = .FALSE.
> Â Â Â XOR = .TRUE.
> Â 6789 CONTINUE
> Â Â Â XRANGE = XMAX - XMIN
> Â Â Â YRANGE = YMAX - YMIN
> Â Â Â XPOW = ALOG10(XRANGE)
> Â Â Â YPOW = ALOG10(YRANGE) ...
|
| Show full article (4.14Kb) |
| no comments |
|
  |
Author: dpbdpb Date: Sep 17, 2008 15:45
GaryScott wrote:
...[old sample code elided]...
> Yuck...I'm sure glad I use GINO...3D graphing, surface plots, dynamic
> view rotation, imports/exports lots of other formats.
Yeah, I just quit worrying about plotting inside the Fortran
cod
--export data to Matlab or autogenerate Tecplot data/macro files for
the graphics is my choice these days...
--
|
| |
| no comments |
|
  |
Author: Robert SingerRobert Singer Date: Sep 17, 2008 16:13
On Wed, 17 Sep 2008 17:45:54 -0500, dpb non.net> wrote:
>GaryScott wrote:
>
>...[old sample code elided]...
>
>> Yuck...I'm sure glad I use GINO...3D graphing, surface plots, dynamic
>> view rotation, imports/exports lots of other formats.
>
>Yeah, I just quit worrying about plotting inside the Fortran
>code--export data to Matlab or autogenerate Tecplot data/macro files for
>the graphics is my choice these days...
I've used tecplot in the past, version 8 (I think; was a long time
ago). Very nice and friendly piece of software, unfortunately a little
on the expensive side (maybe things changed now, although I somehow
doubt it).
But I do not see how tecplot even compares to plotting inside fortran.
Aside the tecplot sdk which I see on their web, I cannot get tecplto
plots inside my program to act interactivly. Tecplot is post-plotting.
|
| Show full article (0.87Kb) |
| no comments |
|
  |
|
|
  |
Author: Robert SingerRobert Singer Date: Sep 17, 2008 16:28
On Wed, 17 Sep 2008 00:56:49 -0500, dpb non.net> wrote:
>Robert Singer wrote:
>> Offtopic really for it's not a a fortran language question, but I'm
>...
>> plot a graph/chart (x-y type), ... automatically determine the
>> upper and lower limit of the graph.
>...
>
>Richard has given the gist; like most I've also had routines that did
>such but haven't had to use them in ages. My recollection is that mine
>did basically what Richard describes but used predefined factors of
>1,2,4,5,10 as the ranges and basically turned into a CASE statement block.
Yes, I agree. What I was missing, and what Richard first mentioned,
was the log10 part. I was having trouble figuring how to round it up
to a "nice" value, and just didn't think of changing the axis system
(interesting how fortran programmers have a pragmatic view on these
problems).
|
| Show full article (1.04Kb) |
| no comments |
|
RELATED THREADS |
  |
|
|
|
|
|