We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpl_to_plotly
While mpl_to_plotly is little known and receives little love, this bug is pretty easy to fix. Would you be open to a PR?
import matplotlib.pyplot as plt from plotly.tools import mpl_to_plotly from plotly.offline import plot
In matplotlib this produces a barplot with labels:
labels = ['a', 'b', 'c'] values = [1, 2, 3] f = plt.figure(figsize=(6, 4)) plt.bar(labels, values) plt.tight_layout()
But conversion to plotly looses the labels:
plotly_fig = mpl_to_plotly(f) plot(plotly_fig)
A minimal fix would be to modify prep_ticks by appending:
prep_ticks
if axis_dict.get("type") == "date": return axis_dict vals = [] texts = [] for tick in axis.majorTicks: vals.append(tick.get_loc()) texts.append(tick.label1.get_text()) if texts: axis_dict = {} axis_dict['tickmode'] = 'array' axis_dict['tickvals'] = vals axis_dict['ticktext'] = texts return axis_dict
which produces:
prep_ticks is defined in:
plotly.py/plotly/matplotlylib/mpltools.py
Lines 428 to 514 in c54a2bd
The text was updated successfully, but these errors were encountered:
thanks very much @krassowski - yes, we would be very happy to get a PR. thanks - @gvwilson
Sorry, something went wrong.
No branches or pull requests
While
mpl_to_plotly
is little known and receives little love, this bug is pretty easy to fix. Would you be open to a PR?In matplotlib this produces a barplot with labels:
But conversion to plotly looses the labels:
A minimal fix would be to modify
prep_ticks
by appending:which produces:
prep_ticks
is defined in:plotly.py/plotly/matplotlylib/mpltools.py
Lines 428 to 514 in c54a2bd
The text was updated successfully, but these errors were encountered: