Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ValueError: stretch is invalid #2006

Merged
merged 1 commit into from

3 participants

@bmu

On current master

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

results in

Traceback (most recent call last):
  File "mpl_xkcd.py", line 19, in <module>
    fig, ax = plt.subplots()
  File "/scratch/matplotlib/lib/matplotlib/pyplot.py", line 1034, in subplots
    ax0 = fig.add_subplot(nrows, ncols, 1, **subplot_kw)
  File "/scratch/matplotlib/lib/matplotlib/figure.py", line 914, in add_subplot
    a = subplot_class_factory(projection_class)(self, *args, **kwargs)
  File "/scratch/matplotlib/lib/matplotlib/axes.py", line 9225, in __init__
    self._axes_class.__init__(self, fig, self.figbox, **kwargs)
  File "/scratch/matplotlib/lib/matplotlib/axes.py", line 450, in __init__
    self._init_axis()
  File "/scratch/matplotlib/lib/matplotlib/axes.py", line 507, in _init_axis
    self.xaxis = maxis.XAxis(self)
  File "/scratch/matplotlib/lib/matplotlib/axis.py", line 645, in __init__
    self.label = self._get_label()
  File "/scratch/matplotlib/lib/matplotlib/axis.py", line 1615, in _get_label
    weight=rcParams['axes.labelweight']),
  File "/scratch/matplotlib/lib/matplotlib/font_manager.py", line 689, in __init__
    self.set_stretch(stretch)
  File "/scratch/matplotlib/lib/matplotlib/font_manager.py", line 872, in set_stretch
    raise ValueError("stretch is invalid")
ValueError: stretch is invalid

Maybe this is related to commit cc61700

@pelson
Collaborator

Thanks for reporting. I can't reproduce this - have you changed any values in rcParams? Did you re-build matplotlib when updating?

I've marked this as a 1.3.x release blocker as I think we need to get to the bottom of this before we can continue with the release.

@bmu

My mplrc is here. There are some changes. However everything worked fine up to today when I pulled the current master.

@pelson pelson referenced this pull request from a commit
@mdboom mdboom Change behavior of `font.*` rcParams so they take effect only on to-b…
…e-created text objects
cc61700
@pelson
Collaborator

Thanks @bmu - I've commented on the commit where I think a bug was introduced.

@mdboom
Owner

@bmu: Can you confirm the attached patch resolves your issue?

@bmu

yup, thist solves the issue. Thanks

@mdboom mdboom merged commit ab5a141 into matplotlib:master

1 check passed

Details default The Travis CI build passed
@mdboom mdboom deleted the mdboom:fix-stretch-invalid branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 15, 2013
  1. @mdboom
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/matplotlib/font_manager.py
View
2  lib/matplotlib/font_manager.py
@@ -862,7 +862,7 @@ def set_stretch(self, stretch):
'ultra-expanded', or a numeric value in the range 0-1000.
"""
if stretch is None:
- stretch = rcParams['font.weight']
+ stretch = rcParams['font.stretch']
try:
stretch = int(stretch)
if stretch < 0 or stretch > 1000:
Something went wrong with that request. Please try again.