Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Creating a Fortran program to plot a graph

Status
Not open for further replies.

bigomanclad

Programmer
Aug 1, 2008
1
GB
Hi,

I have a programme which plots a table from an array perfectly fine, however I would like to now plot a graph based on this array which has the titles and numbering on it. Would someone please be able to help me?

Many thanks
 
1) Which OS are you using
2) Which compiler are you using
3) Do you just want a simple character based graph or something like gnuplot (4) Does it have to be in Fortran or can you use an external package like Excel.
 
I was trying to call gnuplot from a fortran program, I´m using Force 2.0 and gnuplot both for windows, I tried using the sentence call system like this:

CALL SYSTEM('C:\...\wgnuplot.exe gnuplot>load "graph"') or

CALL SYSTEM('Start W/ C:\...\wgnuplot.exe gnuplot>load "graph"')

none of them work the compiler says "unknown escape sequence "\.." for each bar in the sentence

what am I doing wrong?
 
In windows, ... is not a recognized path.

Once you've replaced all the ... with .., if it still doesn't work, replace all \ with \\.
 
It works! I have changed all the \ by \\ in the paths and Gnuplot pops up, but I can´t plot or load the graphics, do you know why?

This is the sentence I´ve tried:

call system ('Start C:\\...\\GnuPlot\\bin\\wgnuplot.exe gnuplot>load "graph" ')

I'm not sure if the " are right so I´ve tried with others but it didn´t work.

Thanks a lot
 
IMHO, you try to mix batch mode with interactive gnuplot-commands.
load is an interactive gnuplot command. In batch mode you should pass as argument to the gnuplot your graph definition file.
Your command line C:\\...\\GnuPlot\\bin\\wgnuplot.exe gnuplot>load "graph" is not good.
What should this gnuplot>load "graph" mean?

First try to run gnuplot with your graph definition file as an argument on command line. I would suggest something like this:
Code:
c:\path_to_gnuplot\wgnuplot.exe c:\path_to_input_file\myfile
When the above command line works, then call it from Fortran with
Code:
call system ("c:\path_to_gnuplot\wgnuplot.exe c:\path_to_input_file\myfile")
or when this doesn't work then try \\ instead of \:
Code:
call system ("c:\\path_to_gnuplot\\wgnuplot.exe c:\\path_to_input_file\\myfile")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top