Skip to content

Instantly share code, notes, and snippets.

@blippy
Created December 18, 2015 17:17
Show Gist options
  • Save blippy/beb6ac98cafcfa471405 to your computer and use it in GitHub Desktop.
Save blippy/beb6ac98cafcfa471405 to your computer and use it in GitHub Desktop.
Simple plot using plplot and Fortran
! compile using the command:
! gfortran `pkg-config --cflags --libs plplot-f95` -o myplot myplot.f90
program myplot
use plplot
implicit none
integer, parameter :: dp=kind(0.0d0)
real(kind=plflt), dimension(3):: x, y
x = [1,2,3]
y = [1, 4, 9]
print *, 'output will go to file myplot.png'
call plsdev('pngqt')
call plsfnam('myplot.png')
call plinit()
call pladv(0)
call plvsta()
call plwind(1.0_dp, 3.0_dp, 1.0_dp, 9.0_dp)
call plbox('bcgnst', 0.0_plflt, 0, 'bcgnstv', 0.0_plflt, 0)
call plcol0(9) ! blue
call plline(x, y)
call plend()
end program myplot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment