Python Turtle dynamic pie chart.

This is the place for queries that don't fit in any of the other categories.

Python Turtle dynamic pie chart.

Postby Lysdexic94 » Sun Apr 06, 2014 2:22 am

hi all im fairly new to coding and was hoping someone could help
im trying to make a dynamic pie chart which reacts to different inputs of data.
firstly this data
Code: Select all
chart_title = 'Tourism GDP by States/Territories in Australia'
segment_labels = ['QLD', 'VIC', 'NSW', 'SA', 'WA', 'TAS', 'NT', 'ACT']
percentages = [0.24, 0.22, 0.328, 0.06, 0.082, 0.03, 0.02, 0.02]

Its meant to look like this
pie chart
1964798_449171295214367_160692630_n.jpg (45.02 KiB) Viewed 606 times
however my code for the segments
Code: Select all
def segment(percentages):
    rollingPercent = 0
    for percent in percentages:
        segment = percent * 360
        rollingPercent += segment

makes my pie chart look like
my pie chart
Untitled.png (11.82 KiB) Viewed 606 times

could someone tell me why?
and also how or what kind of functions i can use to separate the largest segment of the pie chart
Last edited by Mekire on Sun Apr 06, 2014 3:52 am, edited 1 time in total.
Reason: First post lock.
Posts: 1
Joined: Sat Apr 05, 2014 12:42 pm

Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot] and 6 guests