@@ -15,7 +15,7 @@ program test
15
15
16
16
real (wp), dimension (:),allocatable :: x ! ! x values
17
17
real (wp), dimension (:),allocatable :: y ! ! y values
18
- real (wp), dimension (:),allocatable :: xerr ! ! error values
18
+ real (wp), dimension (:),allocatable :: xerr ! ! error values
19
19
real (wp), dimension (:),allocatable :: yerr ! ! error values for bar chart
20
20
real (wp), dimension (:),allocatable :: sx ! ! sin(x) values
21
21
real (wp), dimension (:),allocatable :: cx ! ! cos(x) values
@@ -32,16 +32,18 @@ program test
32
32
real (wp),parameter :: pi = acos (- 1.0_wp )
33
33
real (wp),parameter :: deg2rad = pi/ 180.0_wp
34
34
35
+ character (len=* ), parameter :: testdir = " test/"
36
+
35
37
! size arrays:
36
- allocate (x(n))
37
- allocate (y(n))
38
+ allocate (x(n))
39
+ allocate (y(n))
38
40
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))
41
+ allocate (sx(n))
42
+ allocate (cx(n))
43
+ allocate (zx(n))
44
+ allocate (tx(n))
45
+ allocate (z(n,n))
46
+ allocate (mat(n,n))
45
47
46
48
! generate some data:
47
49
x = [(real (i,wp), i= 0 ,size (x)- 1 )]/ 5.0_wp
@@ -64,7 +66,8 @@ program test
64
66
call plt% add_plot(x,sx,label= ' $\sin (x)$' ,linestyle= ' b-o' ,markersize= 5 ,linewidth= 2 ,istat= istat)
65
67
call plt% add_plot(x,cx,label= ' $\cos (x)$' ,linestyle= ' r-o' ,markersize= 5 ,linewidth= 2 ,istat= istat)
66
68
call plt% add_plot(x,tx,label= ' $\sin (x) \cos (x)$' ,linestyle= ' g-o' ,markersize= 2 ,linewidth= 1 ,istat= istat)
67
- call plt% savefig(' plottest.png' , pyfile= ' plottest.py' ,istat= istat)
69
+ call plt% savefig(testdir// ' plottest.png' , pyfile= testdir// ' plottest.py' ,&
70
+ istat= istat)
68
71
69
72
! bar chart:
70
73
tx = 0.1_wp ! for bar width
@@ -77,7 +80,8 @@ program test
77
80
legend_fontsize = 20 , raw_strings= .true. )
78
81
call plt% add_bar(x= x,height= sx,width= tx,label= ' $\sin (x)$' ,&
79
82
color= ' r' ,yerr= yerr,xlim= [0.0_wp , 20.0_wp ],align= ' center' ,istat= istat)
80
- call plt% savefig(' bartest.png' , pyfile= ' bartest.py' ,istat= istat)
83
+ call plt% savefig(testdir// ' bartest.png' , pyfile= testdir// ' bartest.py' ,&
84
+ istat= istat)
81
85
82
86
! contour plot:
83
87
x = [(real (i,wp), i= 0 ,n-1 )]/ 100.0_wp
@@ -95,14 +99,15 @@ program test
95
99
call plt% add_contour(x, y, z, linestyle= ' -' , &
96
100
filled= .true. , cmap= ' bone' , colorbar= .true. ,&
97
101
istat= istat)
98
- call plt% savefig(' contour.png' ,pyfile= ' contour.py' ,istat= istat)
102
+ call plt% savefig(testdir // ' contour.png' ,pyfile= testdir // ' contour.py' ,istat= istat)
99
103
100
104
! image plot:
101
105
call plt% initialize(grid= .true. ,xlabel= ' x' ,ylabel= ' y' ,figsize= [20 ,20 ],&
102
106
title= ' imshow test' ,&
103
107
real_fmt= ' (F9.3)' )
104
108
call plt% add_imshow(mat,xlim= [0.0_wp , 100.0_wp ],ylim= [0.0_wp , 100.0_wp ],istat= istat)
105
- call plt% savefig(' imshow.png' , pyfile= ' imshow.py' ,istat= istat)
109
+ call plt% savefig(testdir// ' imshow.png' , pyfile= testdir// ' imshow.py' ,&
110
+ istat= istat)
106
111
107
112
! wireframe plot:
108
113
call plt% initialize(grid= .true. ,xlabel= ' x angle (rad)' ,&
@@ -112,7 +117,8 @@ program test
112
117
call plt% plot_wireframe(x, y, z, label= ' ' , linestyle= ' -' , &
113
118
cmap= ' bone' , colorbar= .true. ,&
114
119
istat= istat)
115
- call plt% savefig(' wireframe.png' , pyfile= ' wireframe.py' ,istat= istat)
120
+ call plt% savefig(testdir// ' wireframe.png' , pyfile= testdir// ' wireframe.py' ,&
121
+ istat= istat)
116
122
117
123
! histogram chart:
118
124
x = [0.194 ,0.501 ,- 1.241 ,1.425 ,- 2.217 ,- 0.342 ,- 0.979 ,0.909 ,0.994 ,0.101 , &
@@ -136,7 +142,8 @@ program test
136
142
legend_fontsize = 20 )
137
143
138
144
call plt% add_hist(x= x, label= ' x' ,istat= istat)
139
- call plt% savefig(' histtest1.png' , pyfile= ' histtest1.py' ,istat= istat)
145
+ call plt% savefig(testdir// ' histtest1.png' , pyfile= testdir// ' histtest1.py' ,&
146
+ istat= istat)
140
147
141
148
call plt% initialize(grid= .true. ,xlabel= ' x' ,&
142
149
title= ' cumulative hist test' ,&
@@ -148,8 +155,8 @@ program test
148
155
legend_fontsize = 20 )
149
156
150
157
call plt% add_hist(x= x, label= ' x' , bins= 8 , cumulative= .true. ,istat= istat)
151
- call plt% savefig(' histtest2.png' , &
152
- pyfile= ' histtest2.py' , &
158
+ call plt% savefig(testdir // ' histtest2.png' , &
159
+ pyfile= testdir // ' histtest2.py' , &
153
160
dpi= ' 200' , &
154
161
transparent= .true. ,istat= istat)
155
162
@@ -171,8 +178,8 @@ program test
171
178
call plt% add_sphere(6378.0_wp ,0.0_wp ,0.0_wp ,0.0_wp ,&
172
179
color= ' Blue' ,n_facets= 500 ,&
173
180
antialiased= .true. ,istat= istat)
174
- call plt% savefig(' orbit.png' , &
175
- pyfile= ' orbit.py' , &
181
+ call plt% savefig(testdir // ' orbit.png' , &
182
+ pyfile= testdir // ' orbit.py' , &
176
183
dpi= ' 200' , &
177
184
transparent= .true. ,istat= istat)
178
185
@@ -189,8 +196,8 @@ program test
189
196
190
197
call plt% add_errorbar(x, y, label= ' y' , linestyle= ' .' , &
191
198
xerr= xerr, yerr= yerr, istat= istat)
192
- call plt% savefig(' errorbar.png' , &
193
- pyfile= ' errorbar.py' , &
199
+ call plt% savefig(testdir // ' errorbar.png' , &
200
+ pyfile= testdir // ' errorbar.py' , &
194
201
dpi= ' 200' , &
195
202
transparent= .true. ,istat= istat, python= ' python' )
196
203
0 commit comments