python - How to plot Counter object in horizontal bar chart? -


i have counter object. i'd plot horizontal bar chart http://matplotlib.org/examples/lines_bars_and_markers/barh_demo.html

how can that?

this example page mentioned modified use counter object:

 """ simple demo of horizontal bar chart. """ import matplotlib.pyplot plt; plt.rcdefaults() import numpy np import matplotlib.pyplot plt   # counter data, counter counter object keys = counter.keys() y_pos = np.arange(len(keys)) # counts each key, assuming values numerical performance = [counter[k] k in keys] # not sure if want :s error = np.random.rand(len(keys))  plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4) plt.yticks(y_pos, keys) plt.xlabel('counts per key') plt.title('how fast want go today?')  plt.show() 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -