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.

4 Years
Discussion Span
Last Post by vegaseat

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 !

Edited by Gribouillis


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)

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')


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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.