We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,745 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Creating a chart in python

Im thinking about making a little system for an imaginary retailer, Im going to have a section for the employers and there sales figures, Was just wondering If there was something like an import function for graphs? Im a bit of a noob so go easy

2
Contributors
3
Replies
1 Hour
Discussion Span
2 Months Ago
Last Updated
35
Views
mrpython1
Newbie Poster
5 posts since Feb 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

I would use the Python third party module matplot (pylab), free from:
http://matplotlib.org/contents.html

For a nice example see:
http://matplotlib.org/examples/mplot3d/bars3d_demo.html

vegaseat
DaniWeb's Hypocrite
Moderator
6,464 posts since Oct 2004
Reputation Points: 1,447
Solved Threads: 1,608
Skill Endorsements: 35

Ill have a play around with that, thankyou!!

mrpython1
Newbie Poster
5 posts since Feb 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Just a typical example ...

''' mp_barchart_horizontal2.py
make a simple horizontal bar chart

downloaded Windows installer (Python 3.3 version)
matplotlib-1.2.0.win32-py3.3.exe
from
http://matplotlib.org/downloads.html

tested with Python33
for result see: http://prntscr.com/theqs
'''

from pylab import *

# names of sales persons
persons = ['Tom', 'Jean', 'Paul', 'Mike', 'Beth']
# monthly sales numbers for each the above sales persons
x = [12600, 13400, 16350, 17100, 14700]
# centers the bars on the y axis
y = [0.5, 1.5, 2.5, 3.5, 4.5]

# horizontal bar is barh()
barh(y, x, align='center')
yticks(y, persons)
xlabel('$ sales')
title('Weekly Sales Numbers May 2012')
grid(True)

show()
vegaseat
DaniWeb's Hypocrite
Moderator
6,464 posts since Oct 2004
Reputation Points: 1,447
Solved Threads: 1,608
Skill Endorsements: 35

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0664 seconds using 2.68MB