How to change the color of a graph in PySide2How do I merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory?How to print colored text in terminal in Python?How do I sort a dictionary by value?How to make a chain of function decorators?How to make a flat list out of list of lists?How do I list all files of a directory?Use of *args and **kwargs
Can a microwave oven cook chicken?
Can you use a clue that contains a word on the board within it in an unrelated way in Codenames?
Are results that are derived simply by using more computational power publishable?
Are there any (natural) scientists in Middle-earth?
Single word for being half in this world, half in some other spooky plane of existence
Is the sentence "pay some in cash" understandable?
A feasible and efficient method of fast global travel?
Mostly pluses and minuses: says Grandpa
How to translate old German (before 1920)
Does the horse hair in a bow all go in the same direction?
When and why did the Daily Prophet become the Ministry's mouthpiece?
Selecting elements of a list based on range
How do HK restaurants keep wok-fried scallops white, with no visible sear marks?
Why do the Rebels probe the section of the shield within the gate?
Why is hydro-electric power still scarce in some places?
What is this yellow sticky substance Mulder puts in his vodka?
Why does Greedo say "Maclunkey" in the Mos Eisley Cantina?
Doubt about Taylor series: do successive derivatives on a point determine the whole function?
Does the coriolis force have an effect on the direction in which an aircraft travels?
Does the sun cross other spiral arms in its movement around the galaxy's center?
Why don't we shield existing CPUs from radiation instead of designing new ones?
What is this machine's purpose?
What is smallest addressable value in an octal number called?
How to respond to requests to retest, in hope that the bug is gone?
How to change the color of a graph in PySide2
How do I merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory?How to print colored text in terminal in Python?How do I sort a dictionary by value?How to make a chain of function decorators?How to make a flat list out of list of lists?How do I list all files of a directory?Use of *args and **kwargs
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I'm making a simple graph in PySide2 and was just wondering if you can change the color to something else. This is currently my code.
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView(self)
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.chartView.resize(600, 480)
Any help would be great
python pyside2 qtcharts
add a comment
|
I'm making a simple graph in PySide2 and was just wondering if you can change the color to something else. This is currently my code.
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView(self)
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.chartView.resize(600, 480)
Any help would be great
python pyside2 qtcharts
Do you want to change the color of the line or the background?
– eyllanesc
Mar 28 at 22:11
Forgot to mention that, the color of the line
– Jan Novak
Mar 28 at 22:33
add a comment
|
I'm making a simple graph in PySide2 and was just wondering if you can change the color to something else. This is currently my code.
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView(self)
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.chartView.resize(600, 480)
Any help would be great
python pyside2 qtcharts
I'm making a simple graph in PySide2 and was just wondering if you can change the color to something else. This is currently my code.
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView(self)
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.chartView.resize(600, 480)
Any help would be great
python pyside2 qtcharts
python pyside2 qtcharts
edited Mar 28 at 22:11
eyllanesc
116k12 gold badges41 silver badges76 bronze badges
116k12 gold badges41 silver badges76 bronze badges
asked Mar 28 at 22:07
Jan NovakJan Novak
233 bronze badges
233 bronze badges
Do you want to change the color of the line or the background?
– eyllanesc
Mar 28 at 22:11
Forgot to mention that, the color of the line
– Jan Novak
Mar 28 at 22:33
add a comment
|
Do you want to change the color of the line or the background?
– eyllanesc
Mar 28 at 22:11
Forgot to mention that, the color of the line
– Jan Novak
Mar 28 at 22:33
Do you want to change the color of the line or the background?
– eyllanesc
Mar 28 at 22:11
Do you want to change the color of the line or the background?
– eyllanesc
Mar 28 at 22:11
Forgot to mention that, the color of the line
– Jan Novak
Mar 28 at 22:33
Forgot to mention that, the color of the line
– Jan Novak
Mar 28 at 22:33
add a comment
|
1 Answer
1
active
oldest
votes
If you want to change the color of the line you must set it with setColor():
from PySide2 import QtGui, QtWidgets
from PySide2.QtCharts import QtCharts
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView()
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.setCentralWidget(self.chartView)
series.setColor(QtGui.QColor("salmon"))
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = MainWindow()
w.resize(640, 480)
w.show()
sys.exit(app.exec_())
If you want to change the background color you must use the setCackgroundBrush() method of QChart()
:
self.chartView.chart().setBackgroundBrush(QtGui.QColor("gray"))
Thank you so much again :)
– Jan Novak
Mar 28 at 22:33
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55407585%2fhow-to-change-the-color-of-a-graph-in-pyside2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want to change the color of the line you must set it with setColor():
from PySide2 import QtGui, QtWidgets
from PySide2.QtCharts import QtCharts
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView()
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.setCentralWidget(self.chartView)
series.setColor(QtGui.QColor("salmon"))
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = MainWindow()
w.resize(640, 480)
w.show()
sys.exit(app.exec_())
If you want to change the background color you must use the setCackgroundBrush() method of QChart()
:
self.chartView.chart().setBackgroundBrush(QtGui.QColor("gray"))
Thank you so much again :)
– Jan Novak
Mar 28 at 22:33
add a comment
|
If you want to change the color of the line you must set it with setColor():
from PySide2 import QtGui, QtWidgets
from PySide2.QtCharts import QtCharts
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView()
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.setCentralWidget(self.chartView)
series.setColor(QtGui.QColor("salmon"))
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = MainWindow()
w.resize(640, 480)
w.show()
sys.exit(app.exec_())
If you want to change the background color you must use the setCackgroundBrush() method of QChart()
:
self.chartView.chart().setBackgroundBrush(QtGui.QColor("gray"))
Thank you so much again :)
– Jan Novak
Mar 28 at 22:33
add a comment
|
If you want to change the color of the line you must set it with setColor():
from PySide2 import QtGui, QtWidgets
from PySide2.QtCharts import QtCharts
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView()
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.setCentralWidget(self.chartView)
series.setColor(QtGui.QColor("salmon"))
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = MainWindow()
w.resize(640, 480)
w.show()
sys.exit(app.exec_())
If you want to change the background color you must use the setCackgroundBrush() method of QChart()
:
self.chartView.chart().setBackgroundBrush(QtGui.QColor("gray"))
If you want to change the color of the line you must set it with setColor():
from PySide2 import QtGui, QtWidgets
from PySide2.QtCharts import QtCharts
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
series = QtCharts.QLineSeries()
series.append(0,0)
series.append(1,7)
series.append(1.2,14)
series.append(1.3,21)
series.append(1.4,28)
series.append(1.5,35)
self.chartView = QtCharts.QChartView()
self.chartView.chart().addSeries(series)
self.chartView.chart().createDefaultAxes()
self.setCentralWidget(self.chartView)
series.setColor(QtGui.QColor("salmon"))
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = MainWindow()
w.resize(640, 480)
w.show()
sys.exit(app.exec_())
If you want to change the background color you must use the setCackgroundBrush() method of QChart()
:
self.chartView.chart().setBackgroundBrush(QtGui.QColor("gray"))
answered Mar 28 at 22:23
eyllanesceyllanesc
116k12 gold badges41 silver badges76 bronze badges
116k12 gold badges41 silver badges76 bronze badges
Thank you so much again :)
– Jan Novak
Mar 28 at 22:33
add a comment
|
Thank you so much again :)
– Jan Novak
Mar 28 at 22:33
Thank you so much again :)
– Jan Novak
Mar 28 at 22:33
Thank you so much again :)
– Jan Novak
Mar 28 at 22:33
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55407585%2fhow-to-change-the-color-of-a-graph-in-pyside2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you want to change the color of the line or the background?
– eyllanesc
Mar 28 at 22:11
Forgot to mention that, the color of the line
– Jan Novak
Mar 28 at 22:33