From: Luka Djigas on
On Thu, 25 Sep 2008 06:04:02 -0700 (PDT), peter.king(a)imperial.ac.uk
wrote:

>I am using Windows XP professional and a free Fortran compiler FORCE
>(2.08 I think it is a front end for the g-77 compiler). I am trying to
>find a simple library of basics graphics routines (xy plots, basic
>symbol plotting etc) for use with this (or any other easy to use
>Fortran compiler). I am not a computer scientist and just want
>something very easy to use without knowledge of c, unix or similar.


I'm using www.dislin.de - user friendly syntax, nice looking plots.
Available for a number of compilers...
Anyway, check out the page.

Author also lurks on this group - helpful chap.

--
luka digas
From: e p chandler on
On Sep 25, 9:04 am, peter.k...(a)imperial.ac.uk wrote:
> I am using Windows XP professional and a free Fortran compiler FORCE
> (2.08 I think it is a front end for the g-77 compiler). I am trying to
> find a simple library of basics graphics routines (xy plots, basic
> symbol plotting etc) for use with this (or any other easy to use
> Fortran compiler). I am not a computer scientist and just want
> something very easy to use without knowledge of c, unix or similar.

Along with other suggestions, look at GrWin. Has drivers for PGPLOT.
Binaries available for G77 (MinGW & Cygwin). IIRC it has its own
routines for opening windows, plotting points, etc.

http://spdg1.sci.shizuoka.ac.jp/grwinlib/english/

JAPI has plotting capabilities along with more general GUI stuff. see
http://www.japi.de/

Based on Java. Uses the older AWT (Abstract Windowing Toolkit) instead
of more modern packages (Swing?)

It is not under active development. Also on XP (and probably Vista)
you have to permit some socket calls through the "Windows FIrewall".
You may also have to start the JRE first.

There are other choices involving WxWidgets, and Tcl/Tk, but as Gary
Scott says, the easiest way is to purchase a commerical library!

- e

From: Michael Prager on
peter.king(a)imperial.ac.uk wrote:

> I am using Windows XP professional and a free Fortran compiler FORCE
> (2.08 I think it is a front end for the g-77 compiler). I am trying to
> find a simple library of basics graphics routines (xy plots, basic
> symbol plotting etc) for use with this (or any other easy to use
> Fortran compiler). I am not a computer scientist and just want
> something very easy to use without knowledge of c, unix or similar.

Peter,

I'll add a little to what has already been said. I am far from
an expert in this area, but have looked into libraries and used
a couple.

Most graphics routines callable directly from high-level
languages such as Fortran are not simpleto use. They require a
great deal of setup to define what you want plotted.

Routines that plot directly to a physical device (and I would
include a file as a physical device) are complex enough. The
ones that plot to a window on the screen are even more complex,
as you have to specify all the window properties before you
specify what should be plotted.

I generally write data from Fortran and then use R to plot them.
R is a free and flexible statistics language with excellent
graphics. I have written libraries to export complicated data
structures to R, but for simple data, an ASCII file works just
as well.

Appended is a short Fortran 90 program that generates random
data, writes the data and a short R script to two files, and
issues a SYSTEM call to plot the data. The plot is then saved to
a PNG file. If you have any interest in R, you will find this a
more rewarding path to follow than learning arcane graphics
library.

Unless I have made errors (not uncommon), the program is
standard conforming except for the SYSTEM call, but every
compiler offers that in some form.

However, to use the appended program with a Fortran 77 compiler,
you will need to change the array operations to DO loops and
revise the declarations and comment characters.

Finally, many of us would recommend updating to Fortran 95,
which is very close to a superset of Fortran 77. It has many
useful new features, including far better error checking and
some quite useful array operations.

Hope that helps.

Mike P.

P.S. Note that my or your newsreader may cause some Fortran
lines to wrap inappropriately. I hope that if that occurs, it
will be clear enough where the problem is.

program rplot

implicit none
integer, parameter :: ndat = 100
integer :: i
real, dimension(ndat) :: x, y, error

! Generate data w/ array operations (Fortran-90 or higher)
call random_number(x)
call random_number(error)
y = 5.0 * x + error

! Write the data to a file
open(unit = 20, file = "fortran.dat", action = "write",
status = "unknown")
write(20, *) "x y error"
do i = 1, ndat
write(20, 500) x(i), y(i), error(i)
end do
close(20)
500 format(3(3x, es12.4))

! Write an R script file
open(unit = 30, file = "myprogram.r", action = "write",
status = "unknown")
write(30, *) "xy = read.table('fortran.dat', header = TRUE)"
write(30, *) "windows()"
write(30, *) "with(xy, plot(x,y))"
write(30, *) "savePlot(filename = 'myplot.png', type = 'png')
write(30, *) "winDialog('ok', 'Click to quit')"
close(30)

! Use a system call to run R and plot the data
call system("rterm.exe --no-restore --no-save --vanilla <
myprogram.r")

stop
end program rplot

--
Mike Prager, NOAA, Beaufort, NC
Address spam-trapped; remove color to reply.
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.
From: Michael Prager on
Murphy's Law again . . . the terminating " is missing from the
savePlot line in my example, just posted.

--
Mike Prager, NOAA, Beaufort, NC
Address spam-trapped; remove color to reply.
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.
From: michels on
On 25 Sep., 17:34, Michael Prager <Mike.Prager.ind...(a)noaa.gov> wrote:
> peter.k...(a)imperial.ac.uk wrote:
> > I am using Windows XP professional and a free Fortran compiler FORCE
> > (2.08 I think it is a front end for the g-77 compiler). I am trying to
> > find a simple library of basics graphics routines (xy plots, basic
> > symbol plotting etc) for use with this (or any other easy to use
> > Fortran compiler). I am not a computer scientist and just want
> > something very easy to use without knowledge of c, unix or similar.
>
> Peter,
>
> I'll add a little to what has already been said. I am far from
> an expert in this area, but have looked into libraries and used
> a couple.
>
> Most graphics routines callable directly from high-level
> languages such as Fortran are not simpleto use. They require a
> great deal of setup to define what you want plotted.
>
> Routines that plot directly to a physical device (and I would
> include a file as a physical device) are complex enough. The
> ones that plot to a window on the screen are even more complex,
> as you have to specify all the window properties before you
> specify what should be plotted.
>
> I generally write data from Fortran and then use R to plot them.
> R is a free and flexible statistics language with excellent
> graphics.  I have written libraries to export complicated data
> structures to R, but for simple data, an ASCII file works just
> as well.
>
> Appended is a short Fortran 90 program that generates random
> data, writes the data and a short R script to two files, and
> issues a SYSTEM call to plot the data. The plot is then saved to
> a PNG file.  If you have any interest in R, you will find this a
> more rewarding path to follow than learning arcane graphics
> library.
>
> Unless I have made errors (not uncommon), the program is
> standard conforming except for the SYSTEM call, but every
> compiler offers that in some form.
>
> However, to use the appended program with a Fortran 77 compiler,
> you will need to change the array operations to DO loops and
> revise the declarations and comment characters.
>
> Finally, many of us would recommend updating to Fortran 95,
> which is very close to a superset of Fortran 77.  It has many
> useful new features, including far better error checking and
> some quite useful array operations.
>
> Hope that helps.
>
> Mike P.
>
> P.S. Note that my or your newsreader may cause some Fortran
> lines to wrap inappropriately.  I hope that if that occurs, it
> will be clear enough where the problem is.
>
> program rplot
>
>    implicit none
>    integer, parameter      :: ndat = 100
>    integer                 :: i
>    real, dimension(ndat)   :: x, y, error
>
>    ! Generate data w/ array operations (Fortran-90 or higher)
>    call random_number(x)
>    call random_number(error)
>    y = 5.0 * x + error
>
>    ! Write the data to a file
>    open(unit = 20, file = "fortran.dat", action = "write",
> status = "unknown")
>    write(20, *) "x  y  error"
>    do i = 1, ndat
>       write(20, 500) x(i), y(i), error(i)
>    end do
>    close(20)
>    500   format(3(3x, es12.4))
>
>    ! Write an R script file
>    open(unit = 30, file = "myprogram.r", action = "write",
> status = "unknown")
>    write(30, *) "xy = read.table('fortran.dat', header = TRUE)"
>    write(30, *) "windows()"
>    write(30, *) "with(xy, plot(x,y))"
>    write(30, *) "savePlot(filename = 'myplot.png', type = 'png')
>    write(30, *) "winDialog('ok', 'Click to quit')"
>    close(30)
>
>    ! Use a system call to run R and plot the data
>    call system("rterm.exe --no-restore --no-save --vanilla <
> myprogram.r")
>
>    stop
> end program rplot
>
> --
> Mike Prager, NOAA, Beaufort, NC
> Address spam-trapped; remove color to reply.
> * Opinions expressed are personal and not represented otherwise.
> * Any use of tradenames does not constitute a NOAA endorsement.

If you plot your data directly with Dislin, your little program will
look like:

program rplot
use dislin

implicit none
integer, parameter :: ndat = 100
integer :: i
real, dimension(ndat) :: x, y, error

! Generate data w/ array operations (Fortran-90 or higher)
call random_number(x)
call random_number(error)
y = 5.0 * x + error

call metafl ('png') ! for creating a PNG file
call disini ()
call qplot (x, y, ndat)

stop
end program rplot

If you you like to plot on the screen, you can replace the keyword
'png' by the keyword
'cons' in the routine metafl.

qplot is just a quickplot routine for displaying a curve. If you want
to have a better control
over the scaling and other parameters, you can replace it by:

call metafl ('png')
call disini ()

call name ('X-axis', 'x') ! setting the X-axis title
call name ('Y-axis', 'y') ! setting the Y-axis title

call graf (0., 1., 0., 0.2, 0., 6., 0., 1.) ! plotting an axis
system
call curve (x, y, ndat) ! plotting the curve
call disfin ()

It doesn't look very complicate, or?

Regards,

Helmut

First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: segmentation fault
Next: Segmentation Fault using cron