@@ -857,23 +857,23 @@ def _print_ps(self, outfile, format, *args,
857857 orientation = orientation .lower ()
858858 cbook ._check_in_list (['landscape' , 'portrait' ],
859859 orientation = orientation )
860- isLandscape = (orientation == 'landscape' )
860+ is_landscape = (orientation == 'landscape' )
861861
862862 self .figure .set_dpi (72 ) # Override the dpi kwarg
863863
864864 if rcParams ['text.usetex' ]:
865865 self ._print_figure_tex (outfile , format , dpi , facecolor , edgecolor ,
866- orientation , isLandscape , papertype ,
866+ orientation , is_landscape , papertype ,
867867 ** kwargs )
868868 else :
869869 self ._print_figure (outfile , format , dpi , facecolor , edgecolor ,
870- orientation , isLandscape , papertype ,
870+ orientation , is_landscape , papertype ,
871871 ** kwargs )
872872
873873 @cbook ._delete_parameter ("3.2" , "dryrun" )
874874 def _print_figure (
875875 self , outfile , format , dpi = 72 , facecolor = 'w' , edgecolor = 'w' ,
876- orientation = 'portrait' , isLandscape = False , papertype = None ,
876+ orientation = 'portrait' , is_landscape = False , papertype = None ,
877877 metadata = None , * ,
878878 dryrun = False , bbox_inches_restore = None , ** kwargs ):
879879 """
@@ -892,7 +892,7 @@ def _print_figure(
892892 metadata must be a dictionary. Currently, only the value for
893893 the key 'Creator' is used.
894894 """
895- isEPSF = format == 'eps'
895+ is_eps = format == 'eps'
896896 if isinstance (outfile , (str , os .PathLike )):
897897 outfile = title = os .fspath (outfile )
898898 title = title .encode ("ascii" , "replace" ).decode ("ascii" )
@@ -906,40 +906,40 @@ def _print_figure(
906906 # find the appropriate papertype
907907 width , height = self .figure .get_size_inches ()
908908 if papertype == 'auto' :
909- if isLandscape :
909+ if is_landscape :
910910 papertype = _get_papertype (height , width )
911911 else :
912912 papertype = _get_papertype (width , height )
913913
914- if isLandscape :
915- paperHeight , paperWidth = papersize [papertype ]
914+ if is_landscape :
915+ paper_height , paper_width = papersize [papertype ]
916916 else :
917- paperWidth , paperHeight = papersize [papertype ]
917+ paper_width , paper_height = papersize [papertype ]
918918
919919 if rcParams ['ps.usedistiller' ] and not papertype == 'auto' :
920920 # distillers will improperly clip eps files if the pagesize is
921921 # 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 :
924924 papertype = _get_papertype (height , width )
925- paperHeight , paperWidth = papersize [papertype ]
925+ paper_height , paper_width = papersize [papertype ]
926926 else :
927927 papertype = _get_papertype (width , height )
928- paperWidth , paperHeight = papersize [papertype ]
928+ paper_width , paper_height = papersize [papertype ]
929929
930930 # 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 )
933933
934934 l , b , w , h = self .figure .bbox .bounds
935935 llx = xo
936936 lly = yo
937937 urx = llx + w
938938 ury = lly + h
939939 rotation = 0
940- if isLandscape :
940+ if is_landscape :
941941 llx , lly , urx , ury = lly , llx , ury , urx
942- xo , yo = 72 * paperHeight - yo , xo
942+ xo , yo = 72 * paper_height - yo , xo
943943 rotation = 90
944944 bbox = (llx , lly , urx , ury )
945945
@@ -981,7 +981,7 @@ def write(self, *args, **kwargs):
981981
982982 def print_figure_impl (fh ):
983983 # write the PostScript headers
984- if isEPSF :
984+ if is_eps :
985985 print ("%!PS-Adobe-3.0 EPSF-3.0" , file = fh )
986986 else :
987987 print ("%!PS-Adobe-3.0\n "
@@ -1053,7 +1053,7 @@ def print_figure_impl(fh):
10531053 print ("end" , file = fh )
10541054 print ("%%EndProlog" , file = fh )
10551055
1056- if not isEPSF :
1056+ if not is_eps :
10571057 print ("%%Page: 1 1" , file = fh )
10581058 print ("mpldict begin" , file = fh )
10591059
@@ -1072,7 +1072,7 @@ def print_figure_impl(fh):
10721072 # write the trailer
10731073 print ("end" , file = fh )
10741074 print ("showpage" , file = fh )
1075- if not isEPSF :
1075+ if not is_eps :
10761076 print ("%%EOF" , file = fh )
10771077 fh .flush ()
10781078
@@ -1084,9 +1084,9 @@ def print_figure_impl(fh):
10841084 with open (tmpfile , 'w' , encoding = 'latin-1' ) as fh :
10851085 print_figure_impl (fh )
10861086 if rcParams ['ps.usedistiller' ] == 'ghostscript' :
1087- gs_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox )
1087+ gs_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox )
10881088 elif rcParams ['ps.usedistiller' ] == 'xpdf' :
1089- xpdf_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox )
1089+ xpdf_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox )
10901090 _move_path_to_path_or_stream (tmpfile , outfile )
10911091
10921092 else :
@@ -1109,7 +1109,7 @@ def print_figure_impl(fh):
11091109
11101110 def _print_figure_tex (
11111111 self , outfile , format , dpi , facecolor , edgecolor ,
1112- orientation , isLandscape , papertype , metadata = None , * ,
1112+ orientation , is_landscape , papertype , metadata = None , * ,
11131113 dryrun = False , bbox_inches_restore = None , ** kwargs ):
11141114 """
11151115 If text.usetex is True in rc, a temporary pair of tex/eps files
@@ -1119,7 +1119,7 @@ def _print_figure_tex(
11191119 metadata must be a dictionary. Currently, only the value for
11201120 the key 'Creator' is used.
11211121 """
1122- isEPSF = format == 'eps'
1122+ is_eps = format == 'eps'
11231123 if is_writable_file_like (outfile ):
11241124 title = None
11251125 else :
@@ -1227,54 +1227,49 @@ def write(self, *args, **kwargs):
12271227 print ("showpage" , file = fh )
12281228 fh .flush ()
12291229
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
12321232 width , height = height , width
12331233 bbox = (lly , llx , ury , urx )
12341234
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
12361236 # resulting ps file has the given size with correct bounding
12371237 # 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
12421242 else :
12431243 temp_papertype = _get_papertype (width , height )
12441244 if papertype == 'auto' :
12451245 papertype = temp_papertype
1246- paperWidth , paperHeight = papersize [temp_papertype ]
1246+ paper_width , paper_height = papersize [temp_papertype ]
12471247 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 ]
12541249
12551250 texmanager = ps_renderer .get_texmanager ()
12561251 font_preamble = texmanager .get_font_preamble ()
12571252 custom_preamble = texmanager .get_custom_preamble ()
12581253
12591254 psfrag_rotated = convert_psfrags (tmpfile , ps_renderer .psfrag ,
12601255 font_preamble ,
1261- custom_preamble , paperWidth ,
1262- paperHeight ,
1256+ custom_preamble , paper_width ,
1257+ paper_height ,
12631258 orientation )
12641259
12651260 if (rcParams ['ps.usedistiller' ] == 'ghostscript'
12661261 or rcParams ['text.usetex' ]):
1267- gs_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox ,
1262+ gs_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox ,
12681263 rotated = psfrag_rotated )
12691264 elif rcParams ['ps.usedistiller' ] == 'xpdf' :
1270- xpdf_distill (tmpfile , isEPSF , ptype = papertype , bbox = bbox ,
1265+ xpdf_distill (tmpfile , is_eps , ptype = papertype , bbox = bbox ,
12711266 rotated = psfrag_rotated )
12721267
12731268 _move_path_to_path_or_stream (tmpfile , outfile )
12741269
12751270
12761271def convert_psfrags (tmpfile , psfrags , font_preamble , custom_preamble ,
1277- paperWidth , paperHeight , orientation ):
1272+ paper_width , paper_height , orientation ):
12781273 """
12791274 When we want to use the LaTeX backend with postscript, we write PSFrag tags
12801275 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,
13191314\end{figure}
13201315\end{document}
13211316""" % (font_preamble , unicode_preamble , custom_preamble ,
1322- paperWidth , paperHeight , paperWidth , paperHeight ,
1317+ paper_width , paper_height , paper_width , paper_height ,
13231318 '\n ' .join (psfrags ), angle , os .path .split (epsfile )[- 1 ])
13241319
13251320 try :
0 commit comments