ogpf ((http://mfort.codeplex.com/) ) is an object based module developed in Fortran 2003 / 2008 with object-oriented concept. It implements an interface to 2D/3D plotting in gnuplot.
The syntax ensembles the plot and surf commands in Matlab and Octave. There are some helper functions like linspace, and meshgrid to facilitate the plotting procedure.
There are these main procedures in ogpf
plot
plot a single vector v
plot a vector y against vector x
plot up to four pairs of x-y set at the same time
plot a matrix Y versus a vector x
surf
surface plot
mesh plot
contour plot
script
meshgrid
linspace
ogpf implements the interface through an object called gpf. It contains many methods and properties for making publication quality plots using gnuplot.
script method
The script method is a powerful procedure accepts almost any gnuplot valid command and create a script file to be executed by gnuplot.
interactive mode
It is possible to run the gnuplot interactively from fortran.
Save to file
There is an option, to save the ogpf output into a file which can be invoked later from gnuplot.
How to use
Requirements
- A fortran compiler supports Fortran 2003, like gfortran 4.7 (http://gcc.gnu.org/GFortran), other Fortran compilers also can be used.
- gnuplot 4.5 and later (http://gnuplot.info)
Make sure gnuplot is in your path. (Open a command window and type gnuplot to see if it is in your path)
Download the source code and demo file from download area
Create a fortran project contains the ogpf.f90 and demo.f90, compile, and build it
Run the executable (output of step 2) and select the example you like to run
> ogpf ((http://mfort.codeplex.com/) ) is an object based module developed
> in Fortran 2003 / 2008 with object-oriented concept. It implements an
> interface to 2D/3D plotting in gnuplot.
> The syntax ensembles the plot and surf commands in Matlab and Octave.
> There are some helper functions like linspace, and meshgrid to
> facilitate the plotting procedure.
> There are these main procedures in ogpf
> plot
> plot a single vector v
> plot a vector y against vector x
> plot up to four pairs of x-y set at the same time
> plot a matrix Y versus a vector x
> surf
> surface plot
> mesh plot
> contour plot
> script
> meshgrid
> linspace
> ogpf implements the interface through an object called gpf. It contains
> many methods and properties for making publication quality plots using
> gnuplot.
> script method
> The script method is a powerful procedure accepts almost any gnuplot
> valid command and create a script file to be executed by gnuplot.
> interactive mode
> It is possible to run the gnuplot interactively from fortran.
> Save to file
> There is an option, to save the ogpf output into a file which can be
> invoked later from gnuplot.
> How to use
> Requirements
> - A fortran compiler supports Fortran 2003, like gfortran 4.7
> (http://gcc.gnu.org/GFortran), other Fortran compilers also can be used.
> - gnuplot 4.5 and later (http://gnuplot.info)
> Make sure gnuplot is in your path. (Open a command window and type
> gnuplot to see if it is in your path)
> Download the source code and demo file from download area
> Create a fortran project contains the ogpf.f90 and demo.f90,
> compile, and build it
> Run the executable (output of step 2) and select the example you
> like to run
Given that bash, dash, etc., have a particular meaning for $$, and that
most implementations of a system call in a UNIX-like environment tend to
invoke a shell interpreter, the demos are doomed to fail (by default)
under Linux, Mac OS X, etc. Using a suffix other than $$$ (or enclosing
the filename in single quotes, or better yet, using a random name), fixes
the issue.
One could also make /bin/sh point to .../wine/fakedlls/cmd.exe, but
wouldn't that be weird? ;-)
-- John
John,
The code has been tested under windows (xp, vista, 7) and it wroks fine! I had many feedbacks from windows user, indicating it works under different windows system! I have not Mac or Linux on my system to make a test! By the way, I have corrected the temporary file name!
Please let me know, if other issues are existed!
On Wed, 08 Feb 2012 23:36:21 -0700, Mohammad <mohammad.rahm...@gmail.com>
wrote:
> John,
> The code has been tested under windows (xp, vista, 7) and it wroks
> fine! I had many feedbacks from windows user, indicating it works under
> different windows system! I have not Mac or Linux on my system to make a
> test! By the way, I have corrected the temporary file name!
> Please let me know, if other issues are existed!
> /Mohammad
Line 45 in ogpf.f90 should rather be:
! CHARACTER(LEN=*), PARAMETER :: operating_system ='linux'
Or, since you're using that variable only to delete the file, try a
system-independent method (between lines 419 and 430):
!Delete the temporary file
inquire (FILE = fileName, EXIST = fileFound)
if (fileFound) then
open (NEWUNIT = tmpUnit, FILE = fileName, ACTION = 'WRITE', STATUS
= 'OLD', IOSTAT = ios)
if (ios == 0) CLOSE (tmpUnit, STATUS = 'DELETE')
endif
Of course, the fileFound, tmpUnit and ios variables need to be properly
declared.
JWM <jwmwal...@gmail.com> wrote:
> Or, since you're using that variable only to delete the file, try a
> system-independent method (between lines 419 and 430):
> !Delete the temporary file
> inquire (FILE = fileName, EXIST = fileFound)
> if (fileFound) then
> open (NEWUNIT = tmpUnit, FILE = fileName, ACTION = 'WRITE', STATUS
> = 'OLD', IOSTAT = ios)
> if (ios == 0) CLOSE (tmpUnit, STATUS = 'DELETE')
> endif
Unfortunately, that's not really system independent. It assumes that the
file in question can be opened as sequential access unformatted. It is
not necessarily so that you can open an arbitrary file that way on any
system. That is more than just an abstract possibility. I have seen
systems that would try to read at least the record header from the
initial record when opening the file. They would then get upset when the
first few bytes of the file did not look like a plausible unformatted
sequential record header for a reasonable record size.
I have had Fortran programs fail for exactly that reason, which is why
my personal library includes a delete_file subroutine in my collection
of system-dependent I/O routines. My default version of that subroutine
does things essentially identical to the above sample, but I do keep it
with my other system-dependent routines to facilitate porting in cases
where it doesn't work.
Not to speak of potential problems with permissions for opening with
action='write'. Yes, there are cases where you might have permissions to
delete a file, but not to write to it.
-- Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
>> Or, since you're using that variable only to delete the file, try a
>> system-independent method (between lines 419 and 430):
>> !Delete the temporary file
>> inquire (FILE = fileName, EXIST = fileFound)
>> if (fileFound) then
>> open (NEWUNIT = tmpUnit, FILE = fileName, ACTION = 'WRITE',
>> STATUS
>> = 'OLD', IOSTAT = ios)
>> if (ios == 0) CLOSE (tmpUnit, STATUS = 'DELETE')
>> endif
> Unfortunately, that's not really system independent. It assumes that the
> file in question can be opened as sequential access unformatted.
Shouldn't it be sequential access formatted?
In the actual source code, by the time the file needs to be deleted, it
has already been opened at least once, with no explicit ACCESS or FORM (so
it's assumed sequential formatted). That's why I didn't set the
access/form explicitly.
> >> Or, since you're using that variable only to delete the file, try a
> >> system-independent method (between lines 419 and 430):
> >> !Delete the temporary file
> >> inquire (FILE = fileName, EXIST = fileFound)
> >> if (fileFound) then
> >> open (NEWUNIT = tmpUnit, FILE = fileName, ACTION = 'WRITE',
> >> STATUS
> >> = 'OLD', IOSTAT = ios)
> >> if (ios == 0) CLOSE (tmpUnit, STATUS = 'DELETE')
> >> endif
> > Unfortunately, that's not really system independent. It assumes that the
> > file in question can be opened as sequential access unformatted.
> Shouldn't it be sequential access formatted?
Ah, yes. Sorry. I'm used to always specifying form explicitly, so I have
to stop and think to recall the defaults; didn't stop long enough this
time. (The fact that I'd have to stop and think about the defaults is
exactly why I tend to specify explicitly).
> In the actual source code, by the time the file needs to be deleted, it
> has already been opened at least once, with no explicit ACCESS or FORM (so
> it's assumed sequential formatted). That's why I didn't set the
> access/form explicitly.
Ok. I didn't read the full file. I was just reacting to the comment
about that being system-independent and I clearly didn't look at enough
of the context.
-- Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
> ogpf ((http://mfort.codeplex.com/) ) is an object based module developed in Fortran 2003 / 2008 with object-oriented concept. It implements an interface to 2D/3D plotting in gnuplot.
> The syntax ensembles the plot and surf commands in Matlab and Octave. There are some helper functions like linspace, and meshgrid to facilitate the plotting procedure.
> There are these main procedures in ogpf
> plot
> plot a single vector v
> plot a vector y against vector x
> plot up to four pairs of x-y set at the same time
> plot a matrix Y versus a vector x
> surf
> surface plot
> mesh plot
> contour plot
> script
> meshgrid
> linspace
> ogpf implements the interface through an object called gpf. It contains many methods and properties for making publication quality plots using gnuplot.
> script method
> The script method is a powerful procedure accepts almost any gnuplot valid command and create a script file to be executed by gnuplot.
> interactive mode
> It is possible to run the gnuplot interactively from fortran.
> Save to file
> There is an option, to save the ogpf output into a file which can be invoked later from gnuplot.
> How to use
> Requirements
> - A fortran compiler supports Fortran 2003, like gfortran 4.7 (http://gcc.gnu.org/GFortran), other Fortran compilers also can be used.
> - gnuplot 4.5 and later (http://gnuplot.info)
> Make sure gnuplot is in your path. (Open a command window and type gnuplot to see if it is in your path)
> Download the source code and demo file from download area
> Create a fortran project contains the ogpf.f90 and demo.f90, compile, and build it
> Run the executable (output of step 2) and select the example you like to run