<div dir="ltr"><span style="font-size:12.8px">I'm not going to try to run that code (really a minimal example of ~10 lines should suffice to reproduce your problem).</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I'm surprised this ever worked: </div><span class="im" style="font-size:12.8px"><div><span style="font-size:12.8px">TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSma</span><br style="font-size:12.8px"><span style="font-size:12.8px">llerFont, handlelength = 2.0/1.0)</span><br></div><div><span style="font-size:12.8px"><br></span></div></span><div style="font-size:12.8px"><span style="color:rgb(80,0,80);font-size:12.8px">Here's the new guide to legends:</span></div><div style="font-size:12.8px"><font color="#500050"><span style="font-size:12.8px"><a href="http://matplotlib.org/users/legend_guide.html#plotting-guide-legend" target="_blank">http://matplotlib.org/users/legend_guide.html#plotting-guide-legend</a></span></font><br></div><div style="font-size:12.8px"><font color="#500050"><br></font></div><div style="font-size:12.8px"><font color="#500050">I would definitely upgrade to the newest matplotlib as fixing the legend should be pretty easy.</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 9:52 AM, Jacob Barhak <span dir="ltr"><<a href="mailto:jacob.barhak@gmail.com" target="_blank">jacob.barhak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Sorry Paul,</div><div><br></div><div>The 5 lines with DB in them should ignored. So please comment the 5 lines after the line that things broke in - it is a file that MIST uses and is not needed for this script. You may also make sure the is a Temp sub directory below the execution path since the pdf filename should be stored there.</div><div><br></div><div>Yet after making those fixes, you will find out that the script works on matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error:</div><div><br></div><div>Traceback (most recent call last):<br>  File "PlotGeneration_Mod.py", line 21, in <module><span class=""><br>    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSma<br>llerFont, handlelength = 2.0/1.0)<br></span>  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536, in le<br>gend<br>    raise TypeError('Invalid arguments to legend.')<br>TypeError: Invalid arguments to legend.</div><div><br></div><div><br></div><div>Hopefully this behavior can be explained with changes made. </div><div><br></div><div>I am unsure I wish to upgrade the code, I am considering tow solutions 1) keeping the old matplotlib version, 2) making some code changes to match the newer version.</div><div><br></div><div>Your explanation will help me decide on the best solution.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div> </div><div>                 Jacob</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <span dir="ltr"><<a href="mailto:pmhobson@gmail.com" target="_blank">pmhobson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can you trim this down to a reproducible example?<div><br></div><div>It's hard to debug a "this doesn't work" question when I can't get past the imports ("<span style="font-size:12.8px">import DataDef as DB")</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">At the very least, could you tell use where the error is occurring and what the error message is?</span></div><div><span style="font-size:12.8px">-paul</span></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <span dir="ltr"><<a href="mailto:jacob.barhak@gmail.com" target="_blank">jacob.barhak@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div><div><div dir="ltr"><div>Greetings,</div><div><br></div><div>Are there specific new changes in matplotlib 1.5.1 that break previous code?</div><div><br></div><div>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.</div><div><br></div><div>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?</div><div><br></div><div>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.</div><div> </div><div>I will appreciate your insight.</div><div><br></div><div>              Jacob</div><div><br></div><div><br></div><div>############# Code that Breaks with 1.5.1 ##############</div><div><br></div><div>from __future__ import division<br>import matplotlib<br>matplotlib.use('PDF')<br>import matplotlib.pyplot as plt<br>import matplotlib.font_manager<br>import matplotlib.backends.backend_pdf<br>import DataDef as DB<br>Inf = DB.Inf<br>NaN = DB.NaN<br>inf = DB.inf<br>nan = DB.nan<br>HandlePDF = matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf')<br>HandleFigure = plt.figure()<br>HandleAxes = HandleFigure.add_subplot(111)<br>DefaultLegendFontSize = matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points()<br># New plot sequence<br>HandleAxes.clear()<br>HandleAxes.clear()<br>HandleAxes.set_title('Age - Avg All')<br>HandleAxes.set_xlabel('Time')<br>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')<br>HandleAxes.plot( [] ,[], 'k:' , label = 'File 2')<br>HandleSmallerFont = matplotlib.font_manager.FontProperties(size= DefaultLegendFontSize*1.0 )<br>LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels()<br>TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSmallerFont, handlelength = 2.0/1.0)<br>TheLegend.get_frame().set_alpha(0.5)<br>HandlePDF.savefig(HandleFigure)<br>HandleAxes.clear()<br>HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('Alive', 'Avg All', '')""")<br>HandlePDF.savefig(HandleFigure)<br>HandleAxes.clear()<br>HandleAxes.set_title(' - Rec Count')<br>HandleAxes.set_xlabel('Time')<br>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')<br>HandleAxes.plot( [] ,[], 'k:' , label = 'File 2')<br>HandleSmallerFont = matplotlib.font_manager.FontProperties(size= DefaultLegendFontSize*1.0 )<br>LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels()<br>TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSmallerFont, handlelength = 2.0/1.0)<br>TheLegend.get_frame().set_alpha(0.5)<br>HandlePDF.savefig(HandleFigure)<br># New plot sequence<br>HandleAxes.clear()<br>HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('Alive', 'Avg All', '')""")<br>HandlePDF.savefig(HandleFigure)<br>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')<br>HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count')<br>HandleSmallerFont = matplotlib.font_manager.FontProperties(size= DefaultLegendFontSize*0.714285714286 )<br>LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels()<br>TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSmallerFont, handlelength = 2.0/0.714285714286)<br>TheLegend.get_frame().set_alpha(0.5)<br>HandlePDF.savefig(HandleFigure)<br>HandleAxes.clear()<br>HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('AnError', 'Avg All', '')""")<br>HandlePDF.savefig(HandleFigure)<br>HandleAxes.clear()<br>HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('Alive', 'AlsoAnError', '')""")<br>HandlePDF.savefig(HandleFigure)<br>HandlePDF.close()<br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
<br></div></div>_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>