plotnine icon indicating copy to clipboard operation
plotnine copied to clipboard

xkcd style & whiskers of box plot

Open zhouzq-thu opened this issue 7 years ago • 1 comments

Could the bars (same as boxplot) be in xkcd style?

import pandas as pd
import numpy as np

from plotnine import *
from plotnine.data import mtcars

p = ggplot(aes(x='factor(am)'), mtcars)
p + geom_bar() + theme_xkcd()

2

The whiskers of box plot are influenced by the transparency (alpha=0.2).

p = ggplot(aes(x='factor(am)', y='mpg'), mtcars)
p + geom_boxplot(
    aes(fill='factor(cyl)'),
    color='k',
    alpha=0.2,
    outlier_color='r',
    outlier_size=1.5,
    ) + theme_xkcd()

1

Problem about line width and background of legend

p = ggplot(aes(x='factor(am)', y='mpg'), mtcars)
p + geom_boxplot(
    aes(fill='factor(cyl)'),
    color='k',
    alpha=0.2,
    outlier_color='r',
    outlier_size=1.5,
    ) + theme_bm()

download

zhouzq-thu avatar Apr 26 '18 16:04 zhouzq-thu

  • [ ] The bar style issue is a due to Matplotlib; the alteration of linestyles that creates the XKCD style does not apply universally. I do not know if it is easily fixable.

  • [x] The whiskers should not be influenced by the alpha transparency.

  • [x] The legend linewidth does not look right, need to confirm if it looks the same in pdf.

has2k1 avatar Apr 27 '18 08:04 has2k1