Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib pie chart move autotext

for patch, txt in zip(patches, autotexts):
    # the angle at which the text is located
    ang = (patch.theta2 + patch.theta1) / 2.
    # new coordinates of the text, 0.7 is the distance from the center 
    x = patch.r * 0.7 * np.cos(ang*np.pi/180)
    y = patch.r * 0.7 * np.sin(ang*np.pi/180)
    # if patch is narrow enough, move text to new coordinates
    if (patch.theta2 - patch.theta1) < 10.:
        txt.set_position((x, y))
Comment

PREVIOUS NEXT
Code Example
Python :: rĂșllandi veltandi standandi sitjandi 
Python :: plt.axes muktiple plots 
Python :: pip is not recognized as an internal or external command 
Python :: How to check whether a nested hash element exists in python 
Python :: get picamera feed 
Python :: axes increase fonsize of values python 
Python :: real python linear regression 
Python :: object creation using class constructor 
Python :: 2checkout ipn validation response python 
Python :: how to insert value in admin panel in django 
Python :: how to assign a value to a key dictionary in a list python 
Python :: Pandas: Filter column value in array/list - ValueError: The truth value of a Series is ambiguous 
Python :: python multilevel list comprehension 
Python :: convert json file to dict - if comming as list 
Python :: vijay 
Python :: python send text 
Python :: colab erase recycle bin drive 
Python :: how to add import pydictionary in python 
Python :: Backend not found Request Method: GET Request URL: http://127.0.0.1:8000/oauth/login/google-oauth2/ Raised by: social_django.views.au 
Python :: Python print traceback when error occurs in a class 
Python :: python tuple first column 
Python :: To fix this error install pymongo with the srv extra 
Python :: python list of all definitions in python file 
Python :: python tkinter gui does not update until function completes 
Python :: python too many values to unpack 
Python :: how to track exact location of a phone number in python 
Python :: change value of element 
Python :: python show difference between two strings and colorize it 
Python :: how to print tic tac toe border on terminal in python 
Python :: how i make viribal inside a string in python 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =