[Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code?

Jacob Barhak jacob.barhak at gmail.com
Thu Mar 24 04:02:05 EDT 2016


Greetings,

Are there specific new changes in matplotlib 1.5.1 that break previous code?

Below is a script that works nicely with matplotlib 1.3.1 and breaks on
matplotlib 1.5.1 that comes with the new anaconda on Windows.

I am trying to decide if a downgrade of the matplotlib version is the best
solution or is there another simple fix that will make the code work again?

Note that this is code generated by the MIST system test code, so do not
look for logical output - the current goal is just to pass the test by not
breaking on any commands.

I will appreciate your insight.

              Jacob


############# Code that Breaks with 1.5.1 ##############

from __future__ import division
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
import matplotlib.font_manager
import matplotlib.backends.backend_pdf
import DataDef as DB
Inf = DB.Inf
NaN = DB.NaN
inf = DB.inf
nan = DB.nan
HandlePDF =
matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf')
HandleFigure = plt.figure()
HandleAxes = HandleFigure.add_subplot(111)
DefaultLegendFontSize =
matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points()
# New plot sequence
HandleAxes.clear()
HandleAxes.clear()
HandleAxes.set_title('Age - Avg All')
HandleAxes.set_xlabel('Time')
HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None,
30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, 33.0,
33.0, 33.0, 33.0], 'ko-' , label = 'File 1')
HandleAxes.plot( [] ,[], 'k:' , label = 'File 2')
HandleSmallerFont = matplotlib.font_manager.FontProperties(size=
DefaultLegendFontSize*1.0 )
LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels()
TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSmallerFont, handlelength = 2.0/1.0)
TheLegend.get_frame().set_alpha(0.5)
HandlePDF.savefig(HandleFigure)
HandleAxes.clear()
HandleAxes.set_title("""Create Plots Warning: No parameter entry :
('Alive', 'Avg All', '')""")
HandlePDF.savefig(HandleFigure)
HandleAxes.clear()
HandleAxes.set_title(' - Rec Count')
HandleAxes.set_xlabel('Time')
HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None,
900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, 711,
772], 'ko-' , label = 'File 1')
HandleAxes.plot( [] ,[], 'k:' , label = 'File 2')
HandleSmallerFont = matplotlib.font_manager.FontProperties(size=
DefaultLegendFontSize*1.0 )
LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels()
TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSmallerFont, handlelength = 2.0/1.0)
TheLegend.get_frame().set_alpha(0.5)
HandlePDF.savefig(HandleFigure)
# New plot sequence
HandleAxes.clear()
HandleAxes.set_title("""Create Plots Warning: No parameter entry :
('Alive', 'Avg All', '')""")
HandlePDF.savefig(HandleFigure)
HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0,
32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None,
900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label =
'File 1 - nested record count')
HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count')
HandleSmallerFont = matplotlib.font_manager.FontProperties(size=
DefaultLegendFontSize*0.714285714286 )
LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels()
TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSmallerFont, handlelength = 2.0/0.714285714286)
TheLegend.get_frame().set_alpha(0.5)
HandlePDF.savefig(HandleFigure)
HandleAxes.clear()
HandleAxes.set_title("""Create Plots Warning: No parameter entry :
('AnError', 'Avg All', '')""")
HandlePDF.savefig(HandleFigure)
HandleAxes.clear()
HandleAxes.set_title("""Create Plots Warning: No parameter entry :
('Alive', 'AlsoAnError', '')""")
HandlePDF.savefig(HandleFigure)
HandlePDF.close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/abbeace5/attachment.html>


More information about the Matplotlib-users mailing list