PyQt5.QtChart - How to change QPieSeries color?
-
I'm trying to create a pie chart using
QPieSeriesfromPyQtChartbut when i run the program i get this:

Where the colors are very similar, so my question is if there is a way to change this chart colors? to make them more different.
The code:
# Libraries import sys # PyQt5 from PyQt5.QtWidgets import * from PyQt5.QtGui import QCursor, QPainter, QPalette, QColor from PyQt5.QtChart import * class MainWindow(QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.setCentralWidget(self.create_pie_chart()) def create_pie_chart(self): series = QPieSeries() series.append("C++", 80) series.append("C#", 95) series.append("C", 61) series.append("Python", 150) series.append("Java", 82) series.append("JavaScript", 90) series.append("Shell", 70) chart = QChart() chart.addSeries(series) chart.setAnimationOptions(QChart.SeriesAnimations) chart.setTitle("Programming languages") chart_view = QChartView(chart) chart_view.setRenderHint(QPainter.Antialiasing) return chart_view app = QApplication(sys.argv) mainwindow = MainWindow() mainwindow.show() sys.exit(app.exec_()) -
I'm trying to create a pie chart using
QPieSeriesfromPyQtChartbut when i run the program i get this:

Where the colors are very similar, so my question is if there is a way to change this chart colors? to make them more different.
The code:
# Libraries import sys # PyQt5 from PyQt5.QtWidgets import * from PyQt5.QtGui import QCursor, QPainter, QPalette, QColor from PyQt5.QtChart import * class MainWindow(QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.setCentralWidget(self.create_pie_chart()) def create_pie_chart(self): series = QPieSeries() series.append("C++", 80) series.append("C#", 95) series.append("C", 61) series.append("Python", 150) series.append("Java", 82) series.append("JavaScript", 90) series.append("Shell", 70) chart = QChart() chart.addSeries(series) chart.setAnimationOptions(QChart.SeriesAnimations) chart.setTitle("Programming languages") chart_view = QChartView(chart) chart_view.setRenderHint(QPainter.Antialiasing) return chart_view app = QApplication(sys.argv) mainwindow = MainWindow() mainwindow.show() sys.exit(app.exec_())