Hi,
  I have pie charts with relatively long texts assigned to each slice of the 
pie.
The text is drawn horizontally. Instead, I would like to have it rotated at the
same angle as the slice itself (i.e. centered at the "axis" of the slice). In 
this
way the text would not overlap other text of adjacent slices (or at least if the
text starts far enough from the pie).

The example below is a bit over-twisted but I really want to be able to read at
least a portion of those ['my text4', 'my text5', 'my text6', 'my text7'] 
legends.

import pylab
F = pylab.gcf()
F.set_size_inches(17, 17)
ax_pie = pylab.axes([0.30, 0.30, 0.4, 0.4])
_data = [0.17, 0.23, 0.599, 0.001, 0.003, 0.003, 0.003]
_colors=['red', 'green', 'blue', 'black', 'white', 'yellow', 'violet']
_labels=['my text1', 'my text2', 'my text3', 'my text4', 'my text5', 'my 
text6', 'my text7']
ax_pie.pie(_data, colors=_colors, labels=_labels, labeldistance=1.5, 
autopct='%1.1f%%')
pylab.axis('equal')
pylab.title("blah")
pylab.show()


  I tried to search for some example of this or documentation of the pie 
function
but it seems it is either not possible or not documented. ;-)


Some relatively close matches I found:

http://matplotlib.sourceforge.net/examples/pylab_examples/text_rotation.html 
(this
could maybe help but I do not know at what angle is each slice rendered by 
pylab.pie())

http://matplotlib.sourceforge.net/examples/pylab_examples/text_rotation_relative_to_line.html
(maybe this would work if all text should be drawn at a SAME angle but that is 
not what I want)

Some other shots:
http://stackoverflow.com/questions/9220933/plotting-a-pie-chart-in-matplotlib-at-a-specific-angle-with-the-fracs-on-the-wed

http://guutaranoheya.web.fc2.com/math/matplotlib_ex.html (search for "rotation")

Thank you for your help,
Martin

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to