@@ -39,6 +39,7 @@ module pyplot_module
3939 logical :: show_legend = .false. ! ! show legend into plot
4040 logical :: use_numpy = .true. ! ! use numpy python module
4141 logical :: mplot3d = .false. ! ! it is a 3d plot
42+ logical :: polar = .false. ! ! it is a polar plot
4243 logical :: axis_equal = .false. ! ! equal scale on each axis
4344
4445 contains
@@ -99,7 +100,7 @@ end subroutine add_str
99100
100101 subroutine initialize (me , grid , xlabel , ylabel , zlabel , title , legend , use_numpy , figsize , &
101102 font_size , axes_labelsize , xtick_labelsize , ytick_labelsize , ztick_labelsize , &
102- legend_fontsize , mplot3d , axis_equal )
103+ legend_fontsize , mplot3d , axis_equal , polar )
103104
104105 class(pyplot), intent (inout ) :: me ! ! pyplot handler
105106 logical , intent (in ), optional :: grid ! ! activate grid drawing
@@ -116,8 +117,9 @@ subroutine initialize(me, grid, xlabel, ylabel, zlabel, title, legend, use_numpy
116117 integer , intent (in ), optional :: ytick_labelsize ! ! size of y axis tick lables
117118 integer , intent (in ), optional :: ztick_labelsize ! ! size of z axis tick lables
118119 integer , intent (in ), optional :: legend_fontsize ! ! size of legend font
119- logical , intent (in ), optional :: mplot3d ! ! set true for 3d plots
120+ logical , intent (in ), optional :: mplot3d ! ! set true for 3d plots (cannot use with polar)
120121 logical , intent (in ), optional :: axis_equal ! ! set true for axis = 'equal'
122+ logical , intent (in ), optional :: polar ! ! set true for polar plots (cannot use with mplot3d)
121123
122124 character (len= max_int_len) :: width_str ! ! figure width dummy string
123125 character (len= max_int_len) :: height_str ! ! figure height dummy string
@@ -150,6 +152,11 @@ subroutine initialize(me, grid, xlabel, ylabel, zlabel, title, legend, use_numpy
150152 else
151153 me% mplot3d = .false.
152154 end if
155+ if (present (polar)) then
156+ me% polar = polar
157+ else
158+ me% polar = .false.
159+ end if
153160 if (present (axis_equal)) then
154161 me% axis_equal = axis_equal
155162 else
@@ -191,6 +198,8 @@ subroutine initialize(me, grid, xlabel, ylabel, zlabel, title, legend, use_numpy
191198
192199 if (me% mplot3d) then
193200 call me% add_str(' ax = fig.gca(projection='' 3d'' )' )
201+ elseif (me% polar) then
202+ call me% add_str(' ax = fig.gca(projection='' polar'' )' )
194203 else
195204 call me% add_str(' ax = fig.gca()' )
196205 end if
0 commit comments