What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code?

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>

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past the
imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and what
the error message is?
-paul

···

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/8f958aeb/attachment.html>

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>
    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536,
in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

···

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> > wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/890a7043/attachment.html>

try taking out the zero in the legend() call. The call signature does not
support more than 2 positional arguments, I don't think. I don't know what
that zero would have mean.

Most likely, we tightened our error-checking since the v1.3.1 days.

···

On Thu, Mar 24, 2016 at 12:52 PM, Jacob Barhak <jacob.barhak at gmail.com> wrote:

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>
    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536,
in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> >> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/1d955ebd/attachment-0001.html>

my guess is that that's the location argument.

···

On Thu, Mar 24, 2016 at 10:02 AM, Benjamin Root <ben.v.root at gmail.com> wrote:

try taking out the zero in the legend() call. The call signature does not
support more than 2 positional arguments, I don't think. I don't know what
that zero would have mean.

Most likely, we tightened our error-checking since the v1.3.1 days.

On Thu, Mar 24, 2016 at 12:52 PM, Jacob Barhak <jacob.barhak at gmail.com> > wrote:

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>
    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line
536, in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> >>> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/c673be95/attachment.html>

I'm not going to try to run that code (really a minimal example of ~10
lines should suffice to reproduce your problem).

I'm surprised this ever worked:
TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSma
llerFont, handlelength = 2.0/1.0)

Here's the new guide to legends:
http://matplotlib.org/users/legend_guide.html#plotting-guide-legend

I would definitely upgrade to the newest matplotlib as fixing the legend
should be pretty easy.

···

On Thu, Mar 24, 2016 at 9:52 AM, Jacob Barhak <jacob.barhak at gmail.com> wrote:

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>
    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536,
in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> >> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/3467e2da/attachment-0001.html>

See https://github.com/matplotlib/matplotlib/pull/3943

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.

Running this code on 1.4 should produce a deprecation warning.

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.

Tom

···

On Thu, Mar 24, 2016 at 12:52 PM Jacob Barhak <jacob.barhak at gmail.com> wrote:

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>

    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536,
in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> >> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/66dcffa9/attachment.html>

The zero might have been a position, which zero means "best". I should
point out that we are not very strict about keeping backwards compatibility
for automated legend placement. So, I hope your tests aren't depending on
the legend to always be in the exact same place in the figure.

Try specifying "loc=0" to keep the zero in-play in that call.

···

On Thu, Mar 24, 2016 at 1:02 PM, Benjamin Root <ben.v.root at gmail.com> wrote:

try taking out the zero in the legend() call. The call signature does not
support more than 2 positional arguments, I don't think. I don't know what
that zero would have mean.

Most likely, we tightened our error-checking since the v1.3.1 days.

On Thu, Mar 24, 2016 at 12:52 PM, Jacob Barhak <jacob.barhak at gmail.com> > wrote:

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>
    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line
536, in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> >>> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/f8649a34/attachment-0001.html>

I think what helped more than anything else was the full traceback. But
yes: short code example >> long code example >> no code example.

···

On Thu, Mar 24, 2016 at 1:04 PM, Thomas Caswell <tcaswell at gmail.com> wrote:

See https://github.com/matplotlib/matplotlib/pull/3943

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.

Running this code on 1.4 should produce a deprecation warning.

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.

Tom

On Thu, Mar 24, 2016 at 12:52 PM Jacob Barhak <jacob.barhak at gmail.com> > wrote:

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>

    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line
536, in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> >>> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/b2086da7/attachment.html>

Thanks Ben, Thanks Thomas, Thanks Paul,

Your suggestion of adding loc = 0 fixed the code. I just tested it after
adding loc in 3 places in the code.

Here is the corrected line for a possible future reader.

TheLegend = HandleAxes.legend(LineHandles, LabelHandles, loc = 0, prop =
HandleSmallerFont, handlelength = 2.0/1.0)

I will incorporate this code into future releases on MIST, until then, I
will point towards an older version.

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.

I appreciate your rapid and well focused replies.

               Jacob

···

On Thu, Mar 24, 2016 at 12:07 PM, Benjamin Root <ben.v.root at gmail.com> wrote:

I think what helped more than anything else was the full traceback. But
yes: short code example >> long code example >> no code example.

On Thu, Mar 24, 2016 at 1:04 PM, Thomas Caswell <tcaswell at gmail.com> > wrote:

See https://github.com/matplotlib/matplotlib/pull/3943

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.

Running this code on 1.4 should produce a deprecation warning.

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.

Tom

On Thu, Mar 24, 2016 at 12:52 PM Jacob Barhak <jacob.barhak at gmail.com> >> wrote:

Sorry Paul,

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.

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:

Traceback (most recent call last):
  File "PlotGeneration_Mod.py", line 21, in <module>

    TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop =
HandleSma
llerFont, handlelength = 2.0/1.0)
  File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line
536, in le
gend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

Hopefully this behavior can be explained with changes made.

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.

Your explanation will help me decide on the best solution.

                 Jacob

On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson <pmhobson at gmail.com> >>> wrote:

Can you trim this down to a reproducible example?

It's hard to debug a "this doesn't work" question when I can't get past
the imports ("import DataDef as DB")

At the very least, could you tell use where the error is occurring and
what the error message is?
-paul

On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak <jacob.barhak at gmail.com> >>>> wrote:

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()

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160324/1b466c06/attachment-0001.html>