spotify / chartify

Python library that makes it easy for data scientists to create charts.
Apache License 2.0
3.54k stars 324 forks source link

Log axis breaks bar plots #46

Open cphalpert opened 6 years ago

cphalpert commented 6 years ago

Example:

import pandas as pd
import numpy as np
import chartify
df = pd.DataFrame({'values': [1000, 10, 100, 20]})
df['labels'] = df['values']

# breaks
ch = chartify.Chart(x_axis_type='categorical', y_axis_type='log')
ch.plot.bar(df, 'labels', 'values')
ch.show()

# works
factors = [str(x) for x in [1000, 100, 10, 1]]
ch = chartify.Chart(x_axis_type='categorical', y_axis_type='log')
ch.plot._set_categorical_axis_default_factors(True, factors)
ch.figure.vbar(x=factors, top=[1000, 100, 10, 1], bottom=0.1, width=1, fill_color='blue')
ch.show()

Related to: https://github.com/bokeh/bokeh/issues/6671 https://github.com/bokeh/bokeh/issues/6536

bryevdv commented 5 years ago

Just an FYI, @birdsarah is planning to take a look at the Bokeh issue soon

birdsarah commented 5 years ago

@cphalpert, this is coming along nicely. (I'm so glad you raised it as I face this problem all the time). If you have any API opinions or other thoughts, https://github.com/bokeh/bokeh/pull/8569 would be a great place to give me your feedback.