Skip to content

Minus sign not shown in xkcd theme #451

Closed

Description

@bersbersbers
import pandas as pd
from plotnine import aes, ggplot, theme_xkcd

df = pd.DataFrame([[-10, 10], [10, -10]], columns=["x", "y"])
print(ggplot(df) + aes(x="x", y="y") + theme_xkcd())

This yields this:
image

Manually adding

matplotlib.rcParams["axes.unicode_minus"] = False

solves the problem, but I had expected this section to take care of this:

d = {'axes.unicode_minus': False,
'path.sketch': (scale, length, randomness),
'path.effects': [
patheffects.withStroke(
linewidth=stroke_size,
foreground=stroke_color)]
}
self._rcParams.update(d)

Activity

  1. has2k1 commented on Oct 26, 2020

    @has2k1
    Owner

    I cannot reproduce it!

    import pandas as pd
    from plotnine import aes, ggplot, theme_xkcd
    df = pd.DataFrame([[-10, 10], [10, -10]], columns=["x", "y"])
    ggplot(df) + aes(x="x", y="y") + theme_xkcd()

    xkcd-minus

  2. bersbersbers commented on Oct 27, 2020

    @bersbersbers
    Author

    Well, you are using a different font, aren't you? I should have stated that I have installed* xkcd.ttf from http://simonsoftware.se/other/xkcd.ttf, which does not have glyphs for the unicode minus used for the negative axis labels. But I guess this is exactly what 'axes.unicode_minus': False is for, so I'd expect that to work, too.

    (*)

    wget http://simonsoftware.se/other/xkcd.ttf -O ~/.pyenv/versions/3.8.6/lib/python3.8/site-packages/matplotlib/mpl-data/fonts/ttf/xkcd.ttf
    rm ~/.cache/matplotlib/fontlist-v330.json
    
  3. has2k1 commented on Nov 30, 2020

    @has2k1
    Owner

    Fixed in 0bdec2a.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions