Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5962257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:04:49+00:00 2026-05-22T19:04:49+00:00

I am creating a pie chart using PyChart library in Python. Here is my

  • 0

I am creating a pie chart using PyChart library in Python.
Here is my code:

from pychart import *
import sys

data = [("foo", 10), ("bar", 20), ("baz", 30), ("ao", 40)]
theme.use_color = True
theme.get_options()

ar = area.T(size = (150, 150), legend = legend.T(),
            x_grid_style = None, y_grid_style = None)

plot = pie_plot.T(data = data, arc_offsets = [0, 0, 0, 0], label_offset = 20, arrow_style = arrow.a3)
ar.add_plot(plot)
ar.draw()

How can I display data in (%) on this pie chart?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:04:50+00:00Added an answer on May 22, 2026 at 7:04 pm

    Would converting the data to percentages before passing it to the plot function work?

    For example:

    def to_percents(data):
        total = float(sum(v for _, v in data))
        data[:] = [(k, v / total) for k, v in data]
        return data
    
    data = to_percents([("foo", 1), ("bar", 3), ("baz", 5), ("ao", 7)])
    print data
    

    Output:

    [('foo', 0.0625), ('bar', 0.1875), ('baz', 0.3125), ('ao', 0.4375)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a simple pie chart with three data points. The first and second
I'm using fusioncharts free and creating some 3d pie charts like so... <div style=margin:0
Creating My Windows Form Application and using ADO.Net as Data Access layer and SQL
Creating a batch script in Windows XP. Here's a snippet of code I'm having
Creating a site in with FrogCMS and using alot of jquery to create an
Creating a blog from scratch is a difficult process but I've been plodding along
Creating a document fragment using plain Javascript is dead simple: var docFragment = document.createDocumentFragment();
Creating a website using simple html(not html5) and css but got stock in mouseover
I want to create a pie chart in JavaScript. On searching I found the
I'm assigned with new task for creating chart application in iphone like.,(BarChart,PieChart,etc..,).But,i have no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.