Skip to content

BUG: Setting ticksize xx-small broken by #17348 #17670

Closed

Description

@larsoner

On commit 9909aeb this code works fine:

import matplotlib.pyplot as plt
plt.rcParams['xtick.labelsize'] = 'xx-small'
fig, ax = plt.subplots()

After #17348 (specifically 222b3ba) I get:

Traceback
>>> Traceback (most recent call last):
  File "/home/larsoner/python/matplotlib/lib/matplotlib/fontconfig_pattern.py", line 127, in parse
    self._parser.parseString(pattern)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1945, in parseString
    raise exc
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1935, in parseString
    loc, tokens = self._parse(instring, 0)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1836, in _parseCache
    value = self._parseNoCache(instring, loc, doActions, callPreParse)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1675, in _parseNoCache
    loc, tokens = self.parseImpl(instring, preloc, doActions)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 4050, in parseImpl
    loc, exprtokens = e._parse(instring, loc, doActions)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1836, in _parseCache
    value = self._parseNoCache(instring, loc, doActions, callPreParse)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1679, in _parseNoCache
    loc, tokens = self.parseImpl(instring, preloc, doActions)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 3796, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected end of text, found '-'  (at char 2), (line:1, col:3)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/larsoner/python/matplotlib/lib/matplotlib/backends/backend_qt5.py", line 471, in _draw_idle
    self.draw()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/backends/backend_agg.py", line 397, in draw
    self.figure.draw(self.renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/figure.py", line 1681, in draw
    mimage._draw_list_compositing_images(
  File "/home/larsoner/python/matplotlib/lib/matplotlib/image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/cbook/deprecation.py", line 410, in wrapper
    return func(*inner_args, **inner_kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axes/_base.py", line 2747, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1149, in draw
    ticks_to_draw = self._update_ticks()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1007, in _update_ticks
    major_locs = self.get_majorticklocs()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1268, in get_majorticklocs
    return self.major.locator()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/ticker.py", line 2169, in __call__
    return self.tick_values(vmin, vmax)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/ticker.py", line 2177, in tick_values
    locs = self._raw_ticks(vmin, vmax)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/ticker.py", line 2116, in _raw_ticks
    nbins = np.clip(self.axis.get_tick_space(),
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 2203, in get_tick_space
    size = self._get_tick_label_size('x') * 3
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1328, in _get_tick_label_size
    return mtext.FontProperties(size).get_size_in_points()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/font_manager.py", line 628, in __init__
    self.set_fontconfig_pattern(family)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/font_manager.py", line 840, in set_fontconfig_pattern
    for key, val in parse_fontconfig_pattern(pattern).items():
  File "/home/larsoner/python/matplotlib/lib/matplotlib/fontconfig_pattern.py", line 129, in parse
    raise ValueError(
ValueError: Could not parse font string: 'xx-small'
Expected end of text, found '-'  (at char 2), (line:1, col:3)
Traceback (most recent call last):
  File "/home/larsoner/python/matplotlib/lib/matplotlib/fontconfig_pattern.py", line 127, in parse
    self._parser.parseString(pattern)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1945, in parseString
    raise exc
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1935, in parseString
    loc, tokens = self._parse(instring, 0)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1836, in _parseCache
    value = self._parseNoCache(instring, loc, doActions, callPreParse)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1675, in _parseNoCache
    loc, tokens = self.parseImpl(instring, preloc, doActions)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 4050, in parseImpl
    loc, exprtokens = e._parse(instring, loc, doActions)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1836, in _parseCache
    value = self._parseNoCache(instring, loc, doActions, callPreParse)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 1679, in _parseNoCache
    loc, tokens = self.parseImpl(instring, preloc, doActions)
  File "/home/larsoner/.local/lib/python3.8/site-packages/pyparsing.py", line 3796, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected end of text, found '-'  (at char 2), (line:1, col:3)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/larsoner/python/matplotlib/lib/matplotlib/backends/backend_qt5.py", line 471, in _draw_idle
    self.draw()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/backends/backend_agg.py", line 397, in draw
    self.figure.draw(self.renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/figure.py", line 1681, in draw
    mimage._draw_list_compositing_images(
  File "/home/larsoner/python/matplotlib/lib/matplotlib/image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/cbook/deprecation.py", line 410, in wrapper
    return func(*inner_args, **inner_kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axes/_base.py", line 2747, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1149, in draw
    ticks_to_draw = self._update_ticks()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1007, in _update_ticks
    major_locs = self.get_majorticklocs()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1268, in get_majorticklocs
    return self.major.locator()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/ticker.py", line 2169, in __call__
    return self.tick_values(vmin, vmax)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/ticker.py", line 2177, in tick_values
    locs = self._raw_ticks(vmin, vmax)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/ticker.py", line 2116, in _raw_ticks
    nbins = np.clip(self.axis.get_tick_space(),
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 2203, in get_tick_space
    size = self._get_tick_label_size('x') * 3
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axis.py", line 1328, in _get_tick_label_size
    return mtext.FontProperties(size).get_size_in_points()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/font_manager.py", line 628, in __init__
    self.set_fontconfig_pattern(family)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/font_manager.py", line 840, in set_fontconfig_pattern
    for key, val in parse_fontconfig_pattern(pattern).items():
  File "/home/larsoner/python/matplotlib/lib/matplotlib/fontconfig_pattern.py", line 129, in parse
    raise ValueError(
ValueError: Could not parse font string: 'xx-small'
Expected end of text, found '-'  (at char 2), (line:1, col:3)

cc author of the PR @QuLogic and committer @timhoffm

Activity

  1. larsoner commented on Jun 18, 2020

    @larsoner
    ContributorAuthor

    I can confirm that git revert 222b3ba (followed by a conflict resolution) fixes this minimal example for me.

  2. added this to the v3.3.0 milestone on Jun 18, 2020
  3. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Jun 18, 2020
  4. tacaswell commented on Jun 18, 2020

    @tacaswell
    Member

    I have a fix for this coming.

  5. added 2 commits that reference this issue on Jun 18, 2020
    cede71d
    4d2a112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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