@@ -42,6 +42,7 @@ module pyplot_module
42
42
logical :: mplot3d = .false. ! ! it is a 3d plot
43
43
logical :: polar = .false. ! ! it is a polar plot
44
44
logical :: axis_equal = .false. ! ! equal scale on each axis
45
+ logical :: axisbelow = .true. ! ! axis below other chart elements
45
46
46
47
character (len= :),allocatable :: real_fmt ! ! real number formatting
47
48
@@ -108,7 +109,7 @@ end subroutine add_str
108
109
109
110
subroutine initialize (me , grid , xlabel , ylabel , zlabel , title , legend , use_numpy , figsize , &
110
111
font_size , axes_labelsize , xtick_labelsize , ytick_labelsize , ztick_labelsize , &
111
- legend_fontsize , mplot3d , axis_equal , polar , real_fmt , use_oo_api )
112
+ legend_fontsize , mplot3d , axis_equal , polar , real_fmt , use_oo_api , axisbelow )
112
113
113
114
class(pyplot), intent (inout ) :: me ! ! pyplot handler
114
115
logical , intent (in ), optional :: grid ! ! activate grid drawing
@@ -130,6 +131,7 @@ subroutine initialize(me, grid, xlabel, ylabel, zlabel, title, legend, use_numpy
130
131
logical , intent (in ), optional :: polar ! ! set true for polar plots (cannot use with mplot3d)
131
132
character (len=* ), intent (in ), optional :: real_fmt ! ! format string for real numbers (examples: '(E30.16)' [default], '*')
132
133
logical , intent (in ), optional :: use_oo_api ! ! avoid matplotlib's GUI by using the OO interface (cannot use with showfig)
134
+ logical , intent (in ), optional :: axisbelow ! ! to put the grid lines below the other chart elements [default is true]
133
135
134
136
character (len= max_int_len) :: width_str ! ! figure width dummy string
135
137
character (len= max_int_len) :: height_str ! ! figure height dummy string
@@ -240,6 +242,13 @@ subroutine initialize(me, grid, xlabel, ylabel, zlabel, title, legend, use_numpy
240
242
if (grid) call me% add_str(' ax.grid()' )
241
243
end if
242
244
245
+ if (present (axisbelow)) then
246
+ me% axisbelow = axisbelow
247
+ else
248
+ me% axisbelow = .true. ! default
249
+ end if
250
+ if (me% axisbelow) call me% add_str(' ax.set_axisbelow(True)' )
251
+
243
252
if (present (xlabel)) call me% add_str(' ax.set_xlabel("' // trim (xlabel)// ' ")' )
244
253
if (present (ylabel)) call me% add_str(' ax.set_ylabel("' // trim (ylabel)// ' ")' )
245
254
if (present (zlabel)) call me% add_str(' ax.set_zlabel("' // trim (zlabel)// ' ")' )
0 commit comments