Skip to content

Commit d1f5c1d

Browse files
committed
[plotting] Can use scale_x_date with modern plotnine again
1 parent 0391f1e commit d1f5c1d

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

kotori/io/export/plot.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def render_png(self, buffer):
191191
- https://plotnine.readthedocs.io/
192192
"""
193193

194-
from plotnine import ggplot, aes, qplot, geom_line, geom_text, ggtitle, stat_smooth, scale_x_datetime
194+
from plotnine import ggplot, aes, qplot, geom_line, geom_text, ggtitle, stat_smooth, scale_x_date, scale_x_datetime
195195
from plotnine import theme_538, theme_bw, theme_gray, theme_xkcd
196196

197197
# https://stackoverflow.com/questions/24478925/is-it-possible-to-plot-multiline-chart-on-python-ggplot/24479513#24479513
@@ -206,12 +206,10 @@ def render_png(self, buffer):
206206

207207
plot = ggplot(df, aes(x='time', y='value', color='variable'))\
208208
+ geom_line()\
209+
+ scale_x_date(limits=(datetime_min, datetime_max), breaks=locator, labels=formatter)\
209210
+ scale_x_datetime(limits=(datetime_min, datetime_max))\
210211
+ ggtitle(bucket.title.human)
211212

212-
# FIXME: Currently croaks.
213-
# + scale_x_date(limits=(datetime_min, datetime_max), breaks=locator, labels=formatter) \
214-
215213
# Axis labels
216214
plot.xlab = 'Time'
217215
plot.ylab = 'Value'

0 commit comments

Comments
 (0)