Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Plot command in Fortran

Status
Not open for further replies.

mohamedb

Civil/Environmental
Dec 24, 2013
5
0
0
DZ
Hello everybody;
Is there a plot command in fortran? I need to plot graphs directly from output files.
 
Replies continue below

Recommended for you

Standard Fortran output is text based, so unless you have a specific display or printer library/driver, the answer is no, unless you're doing brute force text graphics. It would probably be easier to read the text files into Excel or Matlab

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
Thanks IRstuff. really sometimes I need to plot results in order to show the shape of the graph and evaluate outputs. It is more practical than export results to an other grapher. I think it is possible with matlab.
 
Depends which vendor's Fortran you are using. Some, like IVF and Silverfrost have built in Windows graphical routines if you work in a windows environment.
 
Way back in the days of green and white stripped tractor feed printers, I wrote a plot routine with the help of an old Fortran book that used an asterisk character to make the plot. The idea was to make a 2 dimensional array of single digit characters. I used blanks, asterisks, and numbers to make the axis, then you print the array.

_____________________________________
I have been called "A storehouse of worthless information" many times.
 
Pretty much what IRstuff said is the best I think. Or... rather, just have your fortran code print the data to a simple ascii text output file in a clean format ( ie. spaces between the numeric entries on each line of data ).

You can then very, very easily copy/paste that data into Excel, split the data into individual cells and graph it. I do this type of thing a LOT! In general, to write code in fortran to do the graphics automatically takes a lot of time and effort. This effort is worth it for something you plan on using over and over again or that you wish to sell. But for one-off work, it usually represents a lot of time that you won't ever get back.

I think that most commercial fortran compilers come with additional abilities to do some graphics and such (these abilities are not part of the language standard though). You can also buy packages that work with your fortran to make graphics and such a lot easier. However, any way you slice it... even with nice graphics packages, writing the code to do the graphics neatly and correctly is often just as hard or harder than the code that did your engineering calculations for you and is thus... not worth the effort.

Dan :)
 
Plotting in FORTRAN (and other common programming languages) can easily be done using for e.g. DISLIN a "A Data Plotting Library" ( (Max Planck Institute for Solar System Research)
"...DISLIN is a high-level and easy to use plotting library for displaying data as curves, bar graphs, pie charts, 3D-colour plots, surfaces, contours, and maps. The library contains about 500 plotting and parameter setting routines. The approach used is to have only a few graphics routines with short parameter lists. A large variety of parameter setting routines can then be used to create customized graphics. Several output formats are supported such as X11, VGA, PostScript, PDF, SVG, CGM, HPGL, TIFF, GIF, PNG and BMP. DISLIN is available for the programming languages C, Fortran 77, Fortran 90, Perl, Python and Java..."

You don't need a DISLIN license for a non-commercial use of DISLIN, otherwise a licence is available for low price.
 
Status
Not open for further replies.
Back
Top