Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Version 2.2.0rc1 triggers TypeError #10476

Closed
@ewels

Description

@ewels

Bug report

Bug summary

MatPlotLib release v2.2.0rc1 triggers a previously unseen TypeError:

  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/offsetbox.py", line 81, in _get_packed_offsets
    sep = (total - sum(w_list)) / (len(w_list) - 1.)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'

Code for reproduction

The line of code that triggers the error is within my Python tool MultiQC here.

Actual outcome

Module bismark raised an exception: Traceback (most recent call last):
  File "/Users/philewels/GitHub/MultiQC/scripts/multiqc", line 427, in multiqc
    output = mod()
  File "/Users/philewels/GitHub/MultiQC/multiqc/modules/bismark/bismark.py", line 167, in __init__
    self.bismark_mbias_plot()
  File "/Users/philewels/GitHub/MultiQC/multiqc/modules/bismark/bismark.py", line 496, in bismark_mbias_plot
    plot = linegraph.plot(datasets, pconfig)
  File "/Users/philewels/GitHub/MultiQC/multiqc/plots/linegraph.py", line 139, in plot
    return matplotlib_linegraph(plotdata, pconfig)
  File "/Users/philewels/GitHub/MultiQC/multiqc/plots/linegraph.py", line 402, in matplotlib_linegraph
    plt.tight_layout(rect=[0,0.08,1,0.92])
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/pyplot.py", line 1366, in tight_layout
    fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/figure.py", line 2273, in tight_layout
    pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/tight_layout.py", line 328, in get_tight_layout_figure
    pad=pad, h_pad=h_pad, w_pad=w_pad)
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/tight_layout.py", line 115, in auto_adjust_subplotpars
    if ax.get_visible()])
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 4179, in get_tightbbox
    bb.append(child._legend_box.get_window_extent(renderer))
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/offsetbox.py", line 262, in get_window_extent
    w, h, xd, yd, offsets = self.get_extent_offsets(renderer)
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/offsetbox.py", line 384, in get_extent_offsets
    for c in self.get_visible_children()]
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/offsetbox.py", line 255, in get_extent
    w, h, xd, yd, offsets = self.get_extent_offsets(renderer)
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/offsetbox.py", line 474, in get_extent_offsets
    sep, self.mode)
  File "/Users/philewels/miniconda2/envs/work/lib/python2.7/site-packages/matplotlib/offsetbox.py", line 81, in _get_packed_offsets
    sep = (total - sum(w_list)) / (len(w_list) - 1.)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'

Expected outcome

Last tested on MatPlotLib v2.1.2 and worked fine. Code has been in use for over two years.

Matplotlib version

  • Operating system: OSX, Linux
  • Matplotlib version: v2.2.0rc1
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 2.7, 3.4, 3.5, 3.6
  • Other libraries: MultiQC: https://github.com/ewels/MultiQC

matplotlib installed using pip, python installed using conda locally (OSX) and on Travis CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions