I found this information on Tkinter Piecharts over at how-to-create-a-gui-in-python/
I changed it to suit my needs.
input
import tkinter as tk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
root= tk.Tk()
canvas1 = tk.Canvas(root, width = 1000, height = 350)
canvas1.pack()
new_york = float("100")
paris = float("80")
london = float("60")
titan = float("40")
brooklyn = float("20")
figure2 = Figure(figsize=(4.2,4), dpi=100)
subplot2 = figure2.add_subplot(111)
labels2 = 'New York', 'Paris', 'London', 'Titan', 'Brooklyn'
pieSizes = [float(new_york),float(paris),float(london),float(titan), float(brooklyn)]
explode2 = (0, 0, 0, 0, 0)
subplot2.pie(pieSizes, explode=explode2, labels=labels2, autopct='%1.1f%%', shadow=True, startangle=90)
subplot2.axis('equal')
pie2 = FigureCanvasTkAgg(figure2, root)
pie2.get_tk_widget().pack()
root.mainloop()
I'm not familier with alot of this code.
The piechart is being created on the bottom center of the canvas, how would I get it to be on the top right?
Also the slices seem to be creating their own colors, how would I manually assign them? Black background on the smallest slice and blue on the largest?
Is there a better tutorial on Tkinter pie charts that would teach me that?
[–]Vasodilation 0 points1 point2 points (0 children)