AttributeError: 'NoneType' object has no attribute 'x'[BUG]
rleyvasal opened this issue · comments
datar version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of datar and its backends.
Issue Description
I am running the plotnine
example on the repo page and I get an error message AttributeError: 'NoneType' object has no attribute 'x'
when running the code below.
# works with plotnine
# example grabbed from https://github.com/has2k1/plydata
from datar import f # this line not in the documentation
import numpy
from datar.base import sin, pi
from datar.tibble import tibble
from datar.dplyr import mutate, if_else
from plotnine import ggplot, aes, geom_line, theme_classic
df = tibble(x=numpy.linspace(0, 2 * pi, 500))
(
df
>> mutate(y=sin(f.x), sign=if_else(f.y >= 0, "positive", "negative"))
>> ggplot(aes(x="x", y="y"))
+ theme_classic()
+ geom_line(aes(color="sign"), size=1.2)
)
Also, can you add from datar import f
line of code to the the documentation example? - without it, the code does not run
Expected Behavior
Running the code show plotnine
plot
Installed Versions
datar
0.8.5 is out of date. Can you try the latest version?
It works in the latest version of datar, after running:
pip install -U datar
pip install -U datar[pandas]
Note: from datar import f
line still needs to be added for the code to run.
Mind submitting a PR?
Submitted PR