<div dir="ltr"><div>Thanks Ben, Thanks Thomas, Thanks Paul,</div><div><br></div><div>Your suggestion of adding loc = 0 fixed the code. I just tested it after adding loc in 3 places in the code.</div><div><br></div><div>Here is the corrected line for a possible future reader.</div><div><br></div><div>TheLegend = HandleAxes.legend(LineHandles, LabelHandles, loc = 0, prop = HandleSmallerFont, handlelength = 2.0/1.0)</div><div><br></div><div>I will incorporate this code into future releases on MIST, until then, I will point towards an older version.</div><div><br></div><div>Making code stricter is a good idea in many cases, and it seems that you added deprecation warnings, so this is normal, yet there is a trickle down price with changing code. I guess we see it now.</div><div><br></div><div>I appreciate your rapid and well focused replies.</div><div><br></div><div>               Jacob</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 12:07 PM, Benjamin Root <span dir="ltr"><<a href="mailto:ben.v.root@gmail.com" target="_blank">ben.v.root@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">I think what helped more than anything else was the full traceback. But yes:  short code example >> long code example >> no code example.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 1:04 PM, Thomas Caswell <span dir="ltr"><<a href="mailto:tcaswell@gmail.com" target="_blank">tcaswell@gmail.com</a>></span> wrote:<br><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 dir="ltr">See <a href="https://github.com/matplotlib/matplotlib/pull/3943" target="_blank">https://github.com/matplotlib/matplotlib/pull/3943</a><div><br></div><div>You are using an API for legend that we no longer support.  You just have to pass `loc` as a keyword argument rather than as the third positional.</div><div><br></div><div>Running this code on 1.4 should produce a deprecation warning.</div><div><br></div><div>In the future, please send the mailing list the minimal amount of code to reproduce your problem.  People around here are typically more than happy to help, but please be respectful of our time and make it easy to help you.</div><div><br></div><div>Tom</div></div><div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Mar 24, 2016 at 12:52 PM Jacob Barhak <<a href="mailto:jacob.barhak@gmail.com" target="_blank">jacob.barhak@gmail.com</a>> wrote:<br></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 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></div></div><div dir="ltr"><div><br>    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSma<br>llerFont, handlelength = 2.0/1.0)<br></div></div><div dir="ltr"><div>  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></div><div dir="ltr"><div><br></div><div> </div><div>                 Jacob</div></div><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:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><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" target="_blank" rel="noreferrer">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></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" target="_blank" rel="noreferrer">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<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" target="_blank" rel="noreferrer">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>