You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is an interesting idea. It would be great to have a basic implementation as a starting point to see how best this could be handled and what APIs (if any) it might break.
Since Axes.bar does not currently support arrays of strings for the first argument, this would be strictly new functionality and hence should not break any existing APIs.
My thinking was to simply add a few lines to bar() in _axes.py that do something like:
if all(isinstance(s, str) for s in left):
labels = left
left = range(1, len(left)+1)
align = 'center'
else:
labels = None
and then further below in the bar() function do something like
if labels != None:
if orientation == 'horizontal':
self.xaxis.set_ticks(left)
self.xaxis.set_ticklabels(labels)
else:
self.yaxis.set_ticks(left)
self.yaxis.set_ticklabels(labels)
(Though I'm not much of a Python hacker. I mainly use matplotlib from the Julia via the PyPlot.jl package.)
stevengj
added a commit
to JuliaPy/PyPlot.jl
that referenced
this issue
Jan 4, 2014
It's pretty common to have bar charts where the x axis is a set of string labels rather than numbers. This can currently be done in pyplot with e.g.
but it would be much nicer to simply support
Similarly for
barh
and possibly some other plot types.cc: @alanedelman
The text was updated successfully, but these errors were encountered: