@@ -16,6 +16,7 @@ program test
1616
1717 real (wp), dimension (:),allocatable :: x ! ! x values
1818 real (wp), dimension (:),allocatable :: y ! ! y values
19+ real (wp), dimension (:),allocatable :: xerr ! ! error values
1920 real (wp), dimension (:),allocatable :: yerr ! ! error values for bar chart
2021 real (wp), dimension (:),allocatable :: sx ! ! sin(x) values
2122 real (wp), dimension (:),allocatable :: cx ! ! cos(x) values
@@ -166,5 +167,23 @@ program test
166167 dpi= ' 200' , &
167168 transparent= .true. ,istat= istat)
168169
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+
169188 end program test
170189! *****************************************************************************************
0 commit comments