def createPiechart(): plt.title('ISCP - Daniël Vercouteren: Pie Chart') dataLabels = "Negatief", "Neutraal", "Positief" dataSize = DatabaseNieuw.getAnalysis() colors = "firebrick", "darkorange", "forestgreen" explode = (0, 0, 0) plt.pie(dataSize, explode=explode, labels=dataLabels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=90) plt.axis('equal') plt.show()
def createBarchart(): plt.xlabel('Sentiment') plt.ylabel('Aantal') plt.title('ISCP - Daniël Vercouteren: Bar Chart') #X is negatief, neutraal, positief #Y is het aantal data = ['Negatief', 'Neutraal', 'Positief'] x = np.arange(len(data)) y = DatabaseNieuw.getAnalysis() width = 0.8 plt.bar(x, y, width, color = "darkblue") plt.xticks(x + 0.4, data) plt.tight_layout() plt.show()