Using Plplot from fortran in Kubuntu 8.04

I installed libplplot from Kubuntu Adept package manager, and chose “libplplot-fortran9″ package.

To test the code, I created the following fortran program:

program testplplot2d
use plplot
implicit none
real(plflt),dimension(6) :: x,y
real(plflt)::xmin,xmax,ymin,ymax
x=(/1,2,3,4,5,6/)
y=x**2
write(*,*) y
call plinit()
xmin=1.0
xmax=6.0
ymin=1.0
ymax=40.0
call plcol0(1)
call plenv(xmin,xmax,ymin,ymax,0,0)
call pllab('X','Y','Test 1D plot')
call plpoin(x,y,9)
call plline(x,y)
y=x**3
call plpoin(x,y,9)
call plline(x,y)
call plend()

end program testplplot2d

and then compiled it using this command:

gfortran -o simple simple.f90 `PKG_CONFIG_PATH=/usr/lib/pkgconfig pkg-config --cflags --libs plplotd-f95`

When I run ./simple, it asks me to choose the output device, and I chose “1″ which is the XWin display, and it plots as shown in the image below:
simple

About these ads

One Response

  1. Hi,

    Thanks a lot! It works fine for me.

    Cheers:)
    Prateek

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: