has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
4.07k stars 225 forks source link

custom linetype fails in`geom_hline #886

Closed ilia-kats closed 4 weeks ago

ilia-kats commented 4 weeks ago

Consider this example:

ggplot(data.mtcars, aes("mpg", "cyl")) + geom_hline(yintercept=0, linetype=(0, 5, 10))

This throws a TypeError: object of type 'int' has no len(). On the other hand,

ggplot(data.mtcars, aes("mpg", "cyl")) + geom_line(linetype=(0,(5, 10)))

works fine. This is on plotnine 0.14.0.

has2k1 commented 4 weeks ago

You are missing some parenthesis in the first snippet, ~linetype=(0, 5, 10)~, linetype=(0, (5, 10)).