Skip to content


Subversion checkout URL

You can clone with
Download ZIP


ValueError: stretch is invalid #2006

merged 1 commit into from

3 participants


On current master

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

results in

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

Maybe this is related to commit cc61700


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.


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

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


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


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/
2  lib/matplotlib/
@@ -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']
stretch = int(stretch)
if stretch < 0 or stretch > 1000:
Something went wrong with that request. Please try again.