@@ -405,7 +405,7 @@ end subroutine add_3d_plot
405
405
!
406
406
! Add a bar plot.
407
407
408
- subroutine add_bar (me , left , height , label , width , bottom , color )
408
+ subroutine add_bar (me , left , height , label , width , bottom , color , yerr )
409
409
410
410
class(pyplot), intent (inout ) :: me ! ! pyplot handler
411
411
real (wp), dimension (:), intent (in ) :: left ! ! left bar values
@@ -414,36 +414,42 @@ subroutine add_bar(me, left, height, label, width, bottom, color)
414
414
real (wp), dimension (:), intent (in ), optional :: width ! ! width values
415
415
real (wp), dimension (:), intent (in ), optional :: bottom ! ! bottom values
416
416
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
427
430
428
431
if (allocated (me% str)) then
429
432
430
433
! 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)
435
439
436
440
! write the arrays:
437
441
call me% add_str(trim (xname)// ' = ' // xstr)
438
442
call me% add_str(trim (yname)// ' = ' // ystr)
439
443
if (present (width)) call me% add_str(trim (wname)// ' = ' // wstr)
440
444
if (present (bottom)) call me% add_str(trim (bname)// ' = ' // bstr)
445
+ if (present (yerr)) call me% add_str(trim (yerrname)// ' = ' // yerr_str)
441
446
call me% add_str(' ' )
442
447
443
448
! create the plot string:
444
449
plt_str = ' ax.bar(' // &
445
450
' left=' // trim (xname)// ' ,' // &
446
451
' height=' // trim (yname)// ' ,'
452
+ if (present (yerr)) plt_str= plt_str// ' yerr=' // trim (yerrname)// ' ,'
447
453
if (present (width)) plt_str= plt_str// ' width=' // trim (wname)// ' ,'
448
454
if (present (bottom)) plt_str= plt_str// ' bottom=' // trim (bstr)// ' ,'
449
455
if (present (color)) plt_str= plt_str// ' color="' // trim (color)// ' ",'
@@ -544,7 +550,6 @@ subroutine matrix_to_string(v, str, use_numpy)
544
550
logical , intent (in ) :: use_numpy ! ! activate numpy python module usage
545
551
546
552
integer :: i ! ! counter
547
- integer :: j ! ! counter
548
553
character (len= :),allocatable :: tmp ! ! dummy string
549
554
550
555
str = ' ['
0 commit comments