Skip to content

Commit 27eb63b

Browse files
committed
added readme.
1 parent e2b1d29 commit 27eb63b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Pyplot-Fortran
2+
=============================
3+
4+
A simple module for generating plots from Fortran using Python's matplotlib.pyplot.
5+
6+
Overview
7+
---------------
8+
9+
Currently, this module can be used to generate simple x-y plots from Fortran. Eventually, it may be expanded to provide additional features and other types of plots.
10+
11+
The way it works is simply to generate a Python script with the plotting code, which
12+
is then executed from the command line using the Fortran ```execute_command_line``` function.
13+
14+
Example
15+
---------------
16+
17+
The following example generates a plot of the sine function.
18+
19+
```Fortran
20+
program test
21+
22+
use,intrinsic :: iso_fortran_env, only: wp => real64
23+
use pyplot_module
24+
25+
implicit none
26+
27+
real(wp),dimension(100) :: x,sx
28+
type(pyplot) :: plt
29+
integer :: i
30+
31+
!generate some data:
32+
x = [(real(i,wp), i=0,size(x)-1)]/5.0_wp
33+
sx = sin(x)
34+
35+
!plot it:
36+
call plt%initialize(grid=.true.,xlabel='angle (rad)',&
37+
title='Plot of $\sin(x)$',legend=.true.)
38+
call plt%add_plot(x,sx,label='$\sin(x)$',linestyle='b-o',markersize=5,linewidth=2)
39+
call plt%savefig('sinx.png', pyfile='sinx.py')
40+
41+
end program test
42+
43+
```
44+
45+
See also
46+
---------------
47+
* [Mathplotlib](http://matplotlib.org)

0 commit comments

Comments
 (0)