@@ -14,24 +14,35 @@ program test
14
14
15
15
integer ,parameter :: n = 100
16
16
17
- real (wp), dimension (n) :: x ! ! x values
18
- real (wp), dimension (n) :: y ! ! y values
19
- real (wp), dimension (n) :: yerr ! ! error values for bar chart
20
- real (wp), dimension (n) :: sx ! ! sin(x) values
21
- real (wp), dimension (n) :: cx ! ! cos(x) values
22
- real (wp), dimension (n) :: zx ! !
23
- real (wp), dimension (n) :: tx ! ! sin(x)*cos(x) values
24
- real (wp), dimension (n,n) :: z ! ! z matrix for contour plot
17
+ real (wp), dimension (:),allocatable :: x ! ! x values
18
+ real (wp), dimension (:),allocatable :: y ! ! y values
19
+ real (wp), dimension (:),allocatable :: yerr ! ! error values for bar chart
20
+ real (wp), dimension (:),allocatable :: sx ! ! sin(x) values
21
+ real (wp), dimension (:),allocatable :: cx ! ! cos(x) values
22
+ real (wp), dimension (:),allocatable :: zx ! !
23
+ real (wp), dimension (:),allocatable :: tx ! ! sin(x)*cos(x) values
24
+ real (wp), dimension (:,:),allocatable :: z ! ! z matrix for contour plot
25
+ real (wp), dimension (:,:),allocatable :: mat ! ! image values
25
26
type (pyplot) :: plt ! ! pytplot handler
26
27
integer :: i ! ! counter
27
28
integer :: j ! ! counter
28
29
real (wp) :: r2 ! ! temp variable
29
- real (wp), dimension (n,n) :: mat ! ! image values
30
30
integer :: istat ! ! status code
31
31
32
32
real (wp),parameter :: pi = acos (- 1.0_wp )
33
33
real (wp),parameter :: deg2rad = pi/ 180.0_wp
34
34
35
+ ! size arrays:
36
+ allocate (x(n))
37
+ allocate (y(n))
38
+ allocate (yerr(n))
39
+ allocate (sx(n))
40
+ allocate (cx(n))
41
+ allocate (zx(n))
42
+ allocate (tx(n))
43
+ allocate (z(n,n))
44
+ allocate (mat(n,n))
45
+
35
46
! generate some data:
36
47
x = [(real (i,wp), i= 0 ,size (x)- 1 )]/ 5.0_wp
37
48
sx = sin (x)
@@ -63,7 +74,7 @@ program test
63
74
axes_labelsize = 20 ,&
64
75
xtick_labelsize = 20 ,&
65
76
ytick_labelsize = 20 ,&
66
- legend_fontsize = 20 )
77
+ legend_fontsize = 20 , raw_strings = .true. )
67
78
call plt% add_bar(x= x,height= sx,width= tx,label= ' $\sin (x)$' ,&
68
79
color= ' r' ,yerr= yerr,xlim= [0.0_wp , 20.0_wp ],align= ' center' ,istat= istat)
69
80
call plt% savefig(' bartest.png' , pyfile= ' bartest.py' ,istat= istat)
@@ -81,8 +92,8 @@ program test
81
92
ylabel= ' y angle (rad)' ,figsize= [10 ,10 ],&
82
93
title= ' Contour plot test' , real_fmt= ' *' ,&
83
94
axisbelow= .false. )
84
- call plt% add_contour(x, y, z, label = ' contour ' , linestyle= ' -' , &
85
- linewidth = 2 , filled= .true. , cmap= ' bone' , colorbar= .true. ,&
95
+ call plt% add_contour(x, y, z, linestyle= ' -' , &
96
+ filled= .true. , cmap= ' bone' , colorbar= .true. ,&
86
97
istat= istat)
87
98
call plt% savefig(' contour.png' ,pyfile= ' contour.py' ,istat= istat)
88
99
@@ -114,7 +125,7 @@ program test
114
125
ytick_labelsize = 20 ,&
115
126
legend_fontsize = 20 )
116
127
117
- call plt% add_hist(x= x, label= ' x' , normed = .true. , istat= istat)
128
+ call plt% add_hist(x= x, label= ' x' ,istat= istat)
118
129
call plt% savefig(' histtest1.png' , pyfile= ' histtest1.py' ,istat= istat)
119
130
120
131
call plt% initialize(grid= .true. ,xlabel= ' x' ,&
@@ -138,7 +149,7 @@ program test
138
149
title= ' Orbit' ,&
139
150
axis_equal= .true. ,&
140
151
mplot3d= .true. ,&
141
- figsize= [20 ,10 ])
152
+ figsize= [20 ,10 ] )
142
153
143
154
x = [(real (i,wp), i= 0 ,size (x)- 1 )]/ 5.0_wp
144
155
sx = 7000.0_wp * cos (x * deg2rad)
0 commit comments