@@ -163,20 +163,30 @@ end subroutine add_str
163
163
!
164
164
! SOURCE
165
165
166
- subroutine initialize (me ,grid ,xlabel ,ylabel ,title ,legend ,use_numpy ,figsize )
166
+ subroutine initialize (me ,grid ,xlabel ,ylabel ,title ,legend ,use_numpy ,figsize ,&
167
+ font_size ,axes_labelsize ,xtick_labelsize ,ytick_labelsize ,legend_fontsize )
167
168
168
169
implicit none
169
170
170
- class(pyplot),intent (inout ) :: me
171
- logical ,intent (in ),optional :: grid
172
- character (len=* ),intent (in ),optional :: xlabel
173
- character (len=* ),intent (in ),optional :: ylabel
174
- character (len=* ),intent (in ),optional :: title
175
- logical ,intent (in ),optional :: legend
176
- logical ,intent (in ),optional :: use_numpy
171
+ class(pyplot),intent (inout ) :: me
172
+ logical ,intent (in ),optional :: grid
173
+ character (len=* ),intent (in ),optional :: xlabel
174
+ character (len=* ),intent (in ),optional :: ylabel
175
+ character (len=* ),intent (in ),optional :: title
176
+ logical ,intent (in ),optional :: legend
177
+ logical ,intent (in ),optional :: use_numpy
177
178
integer ,dimension (2 ),intent (in ),optional :: figsize
179
+ integer ,intent (in ),optional :: font_size
180
+ integer ,intent (in ),optional :: axes_labelsize
181
+ integer ,intent (in ),optional :: xtick_labelsize
182
+ integer ,intent (in ),optional :: ytick_labelsize
183
+ integer ,intent (in ),optional :: legend_fontsize
178
184
179
- character (len= max_int_len) :: width_str, height_str
185
+ character (len= max_int_len) :: width_str, height_str,font_size_str,&
186
+ axes_labelsize_str,xtick_labelsize_str,&
187
+ ytick_labelsize_str,legend_fontsize_str
188
+
189
+ character (len=* ),parameter :: default_font_size_str = ' 10' ! the default font size for plots
180
190
181
191
call me% destroy()
182
192
@@ -194,6 +204,11 @@ subroutine initialize(me,grid,xlabel,ylabel,title,legend,use_numpy,figsize)
194
204
call integer_to_string(figsize(1 ), width_str)
195
205
call integer_to_string(figsize(2 ), height_str)
196
206
end if
207
+ call optional_int_to_string(font_size, font_size_str, default_font_size_str)
208
+ call optional_int_to_string(axes_labelsize, axes_labelsize_str, default_font_size_str)
209
+ call optional_int_to_string(xtick_labelsize,xtick_labelsize_str,default_font_size_str)
210
+ call optional_int_to_string(ytick_labelsize,ytick_labelsize_str,default_font_size_str)
211
+ call optional_int_to_string(legend_fontsize,legend_fontsize_str,default_font_size_str)
197
212
198
213
me% str = ' '
199
214
@@ -205,14 +220,12 @@ subroutine initialize(me,grid,xlabel,ylabel,title,legend,use_numpy,figsize)
205
220
if (me% use_numpy) call me% add_str(' import numpy as np' )
206
221
call me% add_str(' ' )
207
222
208
- ! .... these also need to be optional user inputs ....
209
-
210
- call me% add_str(' matplotlib.rcParams["font.size"] = 10' )
211
223
call me% add_str(' matplotlib.rcParams["font.family"] = "Serif"' )
212
- call me% add_str(' matplotlib.rcParams["axes.labelsize"] = 10' )
213
- call me% add_str(' matplotlib.rcParams["xtick.labelsize"] = 10' )
214
- call me% add_str(' matplotlib.rcParams["ytick.labelsize"] = 10' )
215
- call me% add_str(' matplotlib.rcParams["legend.fontsize"] = 10' )
224
+ call me% add_str(' matplotlib.rcParams["font.size"] = ' // trim (font_size_str))
225
+ call me% add_str(' matplotlib.rcParams["axes.labelsize"] = ' // trim (axes_labelsize_str))
226
+ call me% add_str(' matplotlib.rcParams["xtick.labelsize"] = ' // trim (xtick_labelsize_str))
227
+ call me% add_str(' matplotlib.rcParams["ytick.labelsize"] = ' // trim (ytick_labelsize_str))
228
+ call me% add_str(' matplotlib.rcParams["legend.fontsize"] = ' // trim (legend_fontsize_str))
216
229
217
230
call me% add_str(' ' )
218
231
0 commit comments