@@ -857,23 +857,23 @@ def _print_ps(self, outfile, format, *args,
857
857
orientation = orientation .lower ()
858
858
cbook ._check_in_list (['landscape' , 'portrait' ],
859
859
orientation = orientation )
860
- isLandscape = (orientation == 'landscape' )
860
+ is_landscape = (orientation == 'landscape' )
861
861
862
862
self .figure .set_dpi (72 ) # Override the dpi kwarg
863
863
864
864
if rcParams ['text.usetex' ]:
865
865
self ._print_figure_tex (outfile , format , dpi , facecolor , edgecolor ,
866
- orientation , isLandscape , papertype ,
866
+ orientation , is_landscape , papertype ,
867
867
** kwargs )
868
868
else :
869
869
self ._print_figure (outfile , format , dpi , facecolor , edgecolor ,
870
- orientation , isLandscape , papertype ,
870
+ orientation , is_landscape , papertype ,
871
871
** kwargs )
872
872
873
873
@cbook ._delete_parameter ("3.2" , "dryrun" )
874
874
def _print_figure (
875
875
self , outfile , format , dpi = 72 , facecolor = 'w' , edgecolor = 'w' ,
876
- orientation = 'portrait' , isLandscape = False , papertype = None ,
876
+ orientation = 'portrait' , is_landscape = False , papertype = None ,
877
877
metadata = None , * ,
878
878
dryrun = False , bbox_inches_restore = None , ** kwargs ):
879
879
"""
@@ -892,7 +892,7 @@ def _print_figure(
892
892
metadata must be a dictionary. Currently, only the value for
893
893
the key 'Creator' is used.
894
894
"""
895
- isEPSF = format == 'eps'
895
+ is_eps = format == 'eps'
896
896
if isinstance (outfile , (str , os .PathLike )):
897
897
outfile = title = os .fspath (outfile )
898
898
title = title .encode ("ascii" , "replace" ).decode ("ascii" )
@@ -906,40 +906,40 @@ def _print_figure(
906
906
# find the appropriate papertype
907
907
width , height = self .figure .get_size_inches ()
908
908
if papertype == 'auto' :
909
- if isLandscape :
909
+ if is_landscape :
910
910
papertype = _get_papertype (height , width )
911
911
else :
912
912
papertype = _get_papertype (width , height )
913
913
914
- if isLandscape :
915
- paperHeight , paperWidth = papersize [papertype ]
914
+ if is_landscape :
915
+ paper_height , paper_width = papersize [papertype ]
916
916
else :
917
- paperWidth , paperHeight = papersize [papertype ]
917
+ paper_width , paper_height = papersize [papertype ]
918
918
919
919
if rcParams ['ps.usedistiller' ] and not papertype == 'auto' :
920
920
# distillers will improperly clip eps files if the pagesize is
921
921
# too small
922
- if width > paperWidth or height > paperHeight :
923
- if isLandscape :
922
+ if width > paper_width or height > paper_height :
923
+ if is_landscape :
924
924
papertype = _get_papertype (height , width )
925
- paperHeight , paperWidth = papersize [papertype ]
925
+ paper_height , paper_width = papersize [papertype ]
926
926
else :
927
927
papertype = _get_papertype (width , height )
928
- paperWidth , paperHeight = papersize [papertype ]
928
+ paper_width , paper_height = papersize [papertype ]
929
929
930
930
# center the figure on the paper
931
- xo = 72 * 0.5 * (paperWidth - width )
932
- yo = 72 * 0.5 * (paperHeight - height )
931
+ xo = 72 * 0.5 * (paper_width - width )
932
+ yo = 72 * 0.5 * (paper_height - height )
933
933
934
934
l , b , w , h = self .figure .bbox .bounds
935
935
llx = xo
936
936
lly = yo
937
937
urx = llx + w
938
938
ury = lly + h
939
939
rotation = 0
940
- if isLandscape :
940
+ if is_landscape :
941
941
llx , lly , urx , ury = lly , llx , ury , urx
942
- xo , yo = 72 * paperHeight - yo , xo
942
+ xo , yo = 72 * paper_height - yo , xo
943
943
rotation = 90
944
944
bbox = (llx , lly , urx , ury )
945
945
@@ -981,7 +981,7 @@ def write(self, *args, **kwargs):
981
981
982
982
def print_figure_impl (fh ):
983
983
# write the PostScript headers
984
- if isEPSF :
984
+ if is_eps :
985
985
print ("%!PS-Adobe-3.0 EPSF-3.0" , file = fh )
986
986
else :
987
987
print ("%!PS-Adobe-3.0\n "
@@ -1053,7 +1053,7 @@ def print_figure_impl(fh):
1053
1053
print ("end" , file = fh )
1054
1054
print ("%%EndProlog" , file = fh )
1055
1055
1056
- if not isEPSF :
1056
+ if not is_eps :
1057
1057
print ("%%Page: 1 1" , file = fh )
1058
1058
print ("mpldict begin" , file = fh )
1059
1059
@@ -1072,7 +1072,7 @@ def print_figure_impl(fh):
1072
1072
# write the trailer
1073
1073
print ("end" , file = fh )
1074
1074
print ("showpage" , file = fh )
1075
- if not isEPSF :
1075
+ if not is_eps :
1076
1076
print ("%%EOF" , file = fh )
1077
1077
fh .flush ()
1078
1078
@@ -1084,9 +1084,9 @@ def print_figure_impl(fh):
1084
1084
with open (tmpfile , 'w' , encoding = 'latin-1' ) as fh :
1085
1085
print_figure_impl (fh )
1086
1086
if rcParams ['ps.usedistiller' ] == 'ghostscript' :
1087
- gs_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox )
1087
+ gs_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox )
1088
1088
elif rcParams ['ps.usedistiller' ] == 'xpdf' :
1089
- xpdf_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox )
1089
+ xpdf_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox )
1090
1090
_move_path_to_path_or_stream (tmpfile , outfile )
1091
1091
1092
1092
else :
@@ -1109,7 +1109,7 @@ def print_figure_impl(fh):
1109
1109
1110
1110
def _print_figure_tex (
1111
1111
self , outfile , format , dpi , facecolor , edgecolor ,
1112
- orientation , isLandscape , papertype , metadata = None , * ,
1112
+ orientation , is_landscape , papertype , metadata = None , * ,
1113
1113
dryrun = False , bbox_inches_restore = None , ** kwargs ):
1114
1114
"""
1115
1115
If text.usetex is True in rc, a temporary pair of tex/eps files
@@ -1119,7 +1119,7 @@ def _print_figure_tex(
1119
1119
metadata must be a dictionary. Currently, only the value for
1120
1120
the key 'Creator' is used.
1121
1121
"""
1122
- isEPSF = format == 'eps'
1122
+ is_eps = format == 'eps'
1123
1123
if is_writable_file_like (outfile ):
1124
1124
title = None
1125
1125
else :
@@ -1227,54 +1227,49 @@ def write(self, *args, **kwargs):
1227
1227
print ("showpage" , file = fh )
1228
1228
fh .flush ()
1229
1229
1230
- if isLandscape : # now we are ready to rotate
1231
- isLandscape = True
1230
+ if is_landscape : # now we are ready to rotate
1231
+ is_landscape = True
1232
1232
width , height = height , width
1233
1233
bbox = (lly , llx , ury , urx )
1234
1234
1235
- # set the paper size to the figure size if isEPSF . The
1235
+ # set the paper size to the figure size if is_eps . The
1236
1236
# resulting ps file has the given size with correct bounding
1237
1237
# box so that there is no need to call 'pstoeps'
1238
- if isEPSF :
1239
- paperWidth , paperHeight = self .figure .get_size_inches ()
1240
- if isLandscape :
1241
- paperWidth , paperHeight = paperHeight , paperWidth
1238
+ if is_eps :
1239
+ paper_width , paper_height = self .figure .get_size_inches ()
1240
+ if is_landscape :
1241
+ paper_width , paper_height = paper_height , paper_width
1242
1242
else :
1243
1243
temp_papertype = _get_papertype (width , height )
1244
1244
if papertype == 'auto' :
1245
1245
papertype = temp_papertype
1246
- paperWidth , paperHeight = papersize [temp_papertype ]
1246
+ paper_width , paper_height = papersize [temp_papertype ]
1247
1247
else :
1248
- paperWidth , paperHeight = papersize [papertype ]
1249
- if (width > paperWidth or height > paperHeight ) and isEPSF :
1250
- paperWidth , paperHeight = papersize [temp_papertype ]
1251
- _log .info ('Your figure is too big to fit on %s paper. '
1252
- '%s paper will be used to prevent clipping.' ,
1253
- papertype , temp_papertype )
1248
+ paper_width , paper_height = papersize [papertype ]
1254
1249
1255
1250
texmanager = ps_renderer .get_texmanager ()
1256
1251
font_preamble = texmanager .get_font_preamble ()
1257
1252
custom_preamble = texmanager .get_custom_preamble ()
1258
1253
1259
1254
psfrag_rotated = convert_psfrags (tmpfile , ps_renderer .psfrag ,
1260
1255
font_preamble ,
1261
- custom_preamble , paperWidth ,
1262
- paperHeight ,
1256
+ custom_preamble , paper_width ,
1257
+ paper_height ,
1263
1258
orientation )
1264
1259
1265
1260
if (rcParams ['ps.usedistiller' ] == 'ghostscript'
1266
1261
or rcParams ['text.usetex' ]):
1267
- gs_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox ,
1262
+ gs_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox ,
1268
1263
rotated = psfrag_rotated )
1269
1264
elif rcParams ['ps.usedistiller' ] == 'xpdf' :
1270
- xpdf_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox ,
1265
+ xpdf_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox ,
1271
1266
rotated = psfrag_rotated )
1272
1267
1273
1268
_move_path_to_path_or_stream (tmpfile , outfile )
1274
1269
1275
1270
1276
1271
def convert_psfrags (tmpfile , psfrags , font_preamble , custom_preamble ,
1277
- paperWidth , paperHeight , orientation ):
1272
+ paper_width , paper_height , orientation ):
1278
1273
"""
1279
1274
When we want to use the LaTeX backend with postscript, we write PSFrag tags
1280
1275
to a temporary postscript file, each one marking a position for LaTeX to
@@ -1319,7 +1314,7 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
1319
1314
\end{figure}
1320
1315
\end{document}
1321
1316
""" % (font_preamble , unicode_preamble , custom_preamble ,
1322
- paperWidth , paperHeight , paperWidth , paperHeight ,
1317
+ paper_width , paper_height , paper_width , paper_height ,
1323
1318
'\n ' .join (psfrags ), angle , os .path .split (epsfile )[- 1 ])
1324
1319
1325
1320
try :
0 commit comments