I'm trying to represent my data using a bar graph, the data being displayed is goodVotes, neutralVotes and badVotes on the x-axis for each of my pieces of data (records in an sqlite3 database).

I wish the "bookName" of each record to be displayed on the x axis of the BAR GRAPH along with it's corresponding good, neutral and bad votes. Then the bars to be displayed depending on the amoun of votes they have. I want sizing to be (width) to be based on screen size (i have a screenWidth and screenHeight variable already set up) as i have 15 different x-axis variables each contaiing good, neutral and bad votes section.

Every gui problem has already been solved by vegaseat. Type tkinter bargraph in daniweb's search form and you'll find many examples, like this one, still fully working after 7 years !

The matplot libray is the work horse for any type of plotting with Python ...

''' mp_barchart_vertical2.py
make a simple vertical 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
'''

from pylab import *

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

# vertical bar is bar()
bar(x, y, align='center')
xticks(x, persons)
ylabel('$ sales')
title('Weekly Sales Numbers May 2012')
grid(True)

show()

It also allows you to save the plot to a grahics file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.