@@ -405,7 +405,7 @@ end subroutine add_3d_plot
405405!
406406! Add a bar plot.
407407
408- subroutine add_bar (me , left , height , label , width , bottom , color )
408+ subroutine add_bar (me , left , height , label , width , bottom , color , yerr )
409409
410410 class(pyplot), intent (inout ) :: me ! ! pyplot handler
411411 real (wp), dimension (:), intent (in ) :: left ! ! left bar values
@@ -414,36 +414,42 @@ subroutine add_bar(me, left, height, label, width, bottom, color)
414414 real (wp), dimension (:), intent (in ), optional :: width ! ! width values
415415 real (wp), dimension (:), intent (in ), optional :: bottom ! ! bottom values
416416 character (len=* ), intent (in ), optional :: color ! ! plot color
417-
418- character (len= :), allocatable :: xstr ! ! x axis values stringified
419- character (len= :), allocatable :: ystr ! ! y axis values stringified
420- character (len= :), allocatable :: wstr ! ! width values stringified
421- character (len= :), allocatable :: bstr ! ! bottom values stringified
422- character (len= :), allocatable :: plt_str ! ! plot string
423- character (len=* ), parameter :: xname = ' x' ! ! x axis name
424- character (len=* ), parameter :: yname = ' y' ! ! y axis name
425- character (len=* ), parameter :: wname = ' w' ! ! width name
426- character (len=* ), parameter :: bname = ' b' ! ! bottom name
417+ real (wp), dimension (:), intent (in ), optional :: yerr ! ! yerr values
418+
419+ character (len= :), allocatable :: xstr ! ! x axis values stringified
420+ character (len= :), allocatable :: ystr ! ! y axis values stringified
421+ character (len= :), allocatable :: wstr ! ! width values stringified
422+ character (len= :), allocatable :: bstr ! ! bottom values stringified
423+ character (len= :), allocatable :: plt_str ! ! plot string
424+ character (len= :), allocatable :: yerr_str ! ! yerr values stringified
425+ character (len=* ), parameter :: xname = ' x' ! ! x axis name
426+ character (len=* ), parameter :: yname = ' y' ! ! y axis name
427+ character (len=* ), parameter :: wname = ' w' ! ! width name
428+ character (len=* ), parameter :: bname = ' b' ! ! bottom name
429+ character (len=* ), parameter :: yerrname = ' yerr' ! ! yerr name
427430
428431 if (allocated (me% str)) then
429432
430433 ! convert the arrays to strings:
431- call vec_to_string(left, xstr, me% use_numpy)
432- call vec_to_string(height, ystr, me% use_numpy)
433- if (present (width)) call vec_to_string(width, wstr, me% use_numpy)
434- if (present (bottom)) call vec_to_string(bottom, bstr, me% use_numpy)
434+ call vec_to_string(left, xstr, me% use_numpy)
435+ call vec_to_string(height, ystr, me% use_numpy)
436+ if (present (width)) call vec_to_string(width, wstr, me% use_numpy)
437+ if (present (bottom)) call vec_to_string(bottom, bstr, me% use_numpy)
438+ if (present (yerr)) call vec_to_string(yerr, yerr_str, me% use_numpy)
435439
436440 ! write the arrays:
437441 call me% add_str(trim (xname)// ' = ' // xstr)
438442 call me% add_str(trim (yname)// ' = ' // ystr)
439443 if (present (width)) call me% add_str(trim (wname)// ' = ' // wstr)
440444 if (present (bottom)) call me% add_str(trim (bname)// ' = ' // bstr)
445+ if (present (yerr)) call me% add_str(trim (yerrname)// ' = ' // yerr_str)
441446 call me% add_str(' ' )
442447
443448 ! create the plot string:
444449 plt_str = ' ax.bar(' // &
445450 ' left=' // trim (xname)// ' ,' // &
446451 ' height=' // trim (yname)// ' ,'
452+ if (present (yerr)) plt_str= plt_str// ' yerr=' // trim (yerrname)// ' ,'
447453 if (present (width)) plt_str= plt_str// ' width=' // trim (wname)// ' ,'
448454 if (present (bottom)) plt_str= plt_str// ' bottom=' // trim (bstr)// ' ,'
449455 if (present (color)) plt_str= plt_str// ' color="' // trim (color)// ' ",'
@@ -544,7 +550,6 @@ subroutine matrix_to_string(v, str, use_numpy)
544550 logical , intent (in ) :: use_numpy ! ! activate numpy python module usage
545551
546552 integer :: i ! ! counter
547- integer :: j ! ! counter
548553 character (len= :),allocatable :: tmp ! ! dummy string
549554
550555 str = ' ['
0 commit comments