I'm trying to create a pie chart with matplotlib to add it to a tkinter graphical interface, but I get this error.
The code that is
Labels = 'Pendientes positivas', 'Pendientes negativas', 'Resistencias horizontales' sizes = (pendientes_positivas, pendientes_negativas, horizontales) graficoTorta = plt.subplots() graficoTorta.pie(sizes, labels = Labels) canvas = FigureCanvasTkAgg(graficoTorta, frame_Resistencias_M5) canvas.get_tk_widget().place(x = 400, y = 60)
Variables in sizes are integers that acquire their values in another part of the program.
In addition, when I open the list of classes, I do not see 'foot & # 39; as an attribute
I do not know if this has anything to do but I imagine that it should be there.
I am based on a code taken from an example of the documentation of matplotlib
import matplotlib.pyplot as plt # Pie chart, where the slices will be ordered and plotted counter-clockwise: labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' sizes = (15, 30, 45, 10) explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') fig1, ax1 = plt.subplots() ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90) ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. plt.show()
What does the following chart generate for me?