I am a python beginner and am creating a GUI using PyQt5 and have run into a problem, please help.
This is a squarify graph's example
import pandas as pd
df = pd.DataFrame({'nb_people':[8,3,4,2], 'group':["group A", "group B",
"group C", "group D"] })
squarify.plot(sizes=df['nb_people'], label=df['group'], alpha=.8 )
plt.axis('off')
plt.show()
And this is a function that I'm calling on button click which is plotting a random graph.
def plot(self):
# random data
data = [random.random() for i in range(10)]
# instead of ax.hold(False)
self.figure.clear()
# create an axis
ax = self.figure.add_subplot(111)
# plot data
ax.plot(data, '*-')
# refresh canvas
self.canvas.draw()
How to plot that squarify graph on this GUI?