Python Matplotlib polar Labeling -


hi im wishing label polar bar chart in form whereby labels rotating differing amounts can read clock. know there rotation in plt.xlabel rotate 1 amount have many values , not have them crossing graph.

http://i.stack.imgur.com/peeo3.jpg

this figuratively graph orientations in same way, akin this; need using matplotlib , pandas if possible. in advance help!

http://i.stack.imgur.com/fo9qn.gif

some example names might farming, generalists, food , drink if these not correctly rotated overlap graph , difficult read.


from pandas import dataframe,series import pandas pd import matplotlib.pylab plt pylab import * import numpy np   data = pd.read_csv('/.../data.csv')  data=dataframe(data) n = len(data)   data1=dataframe(data,columns=['x']) data1=data1.get_values()  plt.figure(figsize=(8,8)) ax = plt.subplot(projection='polar') plt.xlabel("aas",fontsize=24) ax.set_theta_zero_location("n") bars = ax.bar(theta, data1,width=width, bottom=0.0,color=colours) 

i label bars according names can obtain in list, there number of values , able read data names.

the very meager beginnings of answer (i doing similar, threw quick hack go in right direction):

# number of labels you'd in [521]: n = 5  # on circle show in [522]: theta = numpy.linspace(0., 2 * numpy.pi, n + 1, endpoint = true) in [523]: theta = theta[1:]  # create figure in [524]: fig = plt.figure(figsize = (6,6), facecolor = 'white', edgecolor = none) # create axis, notice polar = true in [525]: ax = plt.subplot2grid((1, 1), (0,0), polar = true)  # create white bars you're focusing on labels in [526]: ax.bar(theta, numpy.ones_like(theta), align = 'center',  ...:             color = 'white', edgecolor = 'white')  # create text you're looking add, here use numbers counter = 1 n in [527]: counter = 1 in [528]: t, o in zip(theta, numpy.ones_like(theta)): ...:          ax.text(t, 1 - .1, counter, horizontalalignment = 'center', verticalalignment = 'center', rotation = t * 100) ...: counter += 1 in [529]: ax.set_yticklabels([]) in [530]: ax.set_xticklabels([]) in [531]: ax.grid(false) in [531]: plt.show() 

rotated numbers @ edges


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -