@@ -16,6 +16,7 @@ program test
16
16
17
17
real (wp), dimension (:),allocatable :: x ! ! x values
18
18
real (wp), dimension (:),allocatable :: y ! ! y values
19
+ real (wp), dimension (:),allocatable :: xerr ! ! error values
19
20
real (wp), dimension (:),allocatable :: yerr ! ! error values for bar chart
20
21
real (wp), dimension (:),allocatable :: sx ! ! sin(x) values
21
22
real (wp), dimension (:),allocatable :: cx ! ! cos(x) values
@@ -166,5 +167,23 @@ program test
166
167
dpi= ' 200' , &
167
168
transparent= .true. ,istat= istat)
168
169
170
+ ! Errorbar plot:
171
+ call plt% initialize(grid= .true. ,&
172
+ xlabel= ' x' ,ylabel= ' y' ,&
173
+ title= ' Errorbar Plot Example' ,&
174
+ figsize= [20 ,10 ] )
175
+
176
+ x = [(real (i,wp), i= 0 , 360 , 10 )]
177
+ y = 10.0_wp * cos (x * deg2rad)
178
+ xerr = sin (x * deg2rad) * 5.0_wp
179
+ yerr = sin (y * deg2rad) * 10.0_wp
180
+
181
+ call plt% add_errorbar(x, y, label= ' y' , linestyle= ' .' , &
182
+ xerr= xerr, yerr= yerr, istat= istat)
183
+ call plt% savefig(' errorbar.png' , &
184
+ pyfile= ' errorbar.py' , &
185
+ dpi= ' 200' , &
186
+ transparent= .true. ,istat= istat)
187
+
169
188
end program test
170
189
! *****************************************************************************************
0 commit comments