Until now I've spend several hours to get axis scaling in plotnine done. Everything I've found until now does not work.
Is it the data, is it the code defining the graph, hope any of you would be able to see what is wrong.
The data looks like:
Data types are:
concat object
direction object
date_trunc timedelta64[ns]
comment object
timestamp datetime64[ns]
dtype: object
The following code creates a graph as expected:
ch_time_plot = (p9.ggplot(data= ch_time,
mapping= p9.aes(x= 'timestamp',
y= 'date_trunc',
color= 'direction'))
+ p9.geom_line()
+ p9.theme(axis_text_x= p9.element_text(rotation=90))
)
# ch_time_plot += p9.ylim(0,5)
# => TypeError: Discrete value supplied to continuous scale
# ch_time_plot += p9.expand_limits(y=0)
# => AttributeError: 'int' object has no attribute 'value'
# ch_time_plot += p9.scale_y_continuous(limits = (1, 10))
# => TypeError: Discrete value supplied to continuous scale
ch_time_plot
What I want to achieve is that always the origin of the y axis (0) is shown. As soon I comment out one of the lines shown in the code (which should do this) I get an error message and no more graph.
What is wrong with my code?