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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a x-window fortran graphic-lib

Status
Not open for further replies.

rambazamba

Technical User
May 22, 2012
2
DE
Hi!

For my study project in computational physics i need to program some cellular automata. Unfortunatly i have to do it in Fortran, in which i don't have any experience.
Anyway the code is not very difficult so i managed to program some automata with two different rules :) So far so good, but i really need to find a way how i can display the result in an quick and easy way. I'm working both on a Linux and a MacOSX Machine, so the best way is to find a easy x-Window Graphic lib. I'm using gfortran compiler if this is important?

Maybe someone can recommend one?

thousand thanks in advance!

rambazamba
 
Hey Norbert!

Thank you for the Link! Gnufor2 lookes like a very easy way to do exactly what i want to. But until know i spent a couple of hours solving problems to get the testfile to run.

Now everything seems to work with the test.f90 - but not with my own source code.

I don't get the problem, i'm doing it exactly as in the testfile. Unfortunatly there is no further documentation to this library or any similar gnuplot interface libs i found on the internet.

My Problem is:
After the calculation is done, i have a NxN matrix with ones and zeros and i want them to be visualised as "1 = pixel is black" or "zero = pixel is white".
Is there any other easy way to get this result?

Thanks again

Greetings

rambazamba
 
I do it using gnuplot.

Store only the ones like this in plot.dat

1 1 1.00000000000000
1 2 1.00000000000000
1 5 1.00000000000000
1 6 1.00000000000000
1 10 1.00000000000000
...

Use the gnuplot script

Code:
set term gif
set output "plot.eps"

set size square

unset xlabel
unset ylabel
unset xtic
unset ytic

unset border

set pointsize 1

plot 'plot.dat' u 1:2 notitle  w p pt 5 lc rgb "black"
 
My bad..

Just keep the row and column indices in 'plot.dat', no need to store 1.00000

make the first two lines on the script consistent

set term gif
set output "plot.gif"

OR

set term eps
set output "plot.eps"
 
What size is your matrix, that is how big is your n ? You could just define a printout matrix that shows blanks for every 0 and X for every 1 and write it to your screen. If N is not more than your textural screen resolution (150 by 150 or so) you may get a good impression of your results.

If your matrix is bigger you could create and fill a bitmap with your results. But I am not familiar with neither Linux nor MAC on how such an image could be displayed.

Norbert

The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top