# How to change the background color of plot view

**URL:** <https://discourse.slicer.org/t/how-to-change-the-background-color-of-plot-view/28874>\
**Category:** Development\
**Created:** [April 13, 2023, 2:05am UTC](https://discourse.slicer.org/t/how-to-change-the-background-color-of-plot-view/28874 "2023-04-13T02:05:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [April 13, 2023, 2:05am UTC](https://discourse.slicer.org/t/how-to-change-the-background-color-of-plot-view/28874/1 "2023-04-13T02:05:15Z")

</div>

my custom application has a dark color style , how to change the plot view background color to the dark color style  
the demo ui below  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/d/5d3b0a6d473a1a001f6dc19112a6716e90522c46.png)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [April 13, 2023, 9:19am UTC](https://discourse.slicer.org/t/how-to-change-the-background-color-of-plot-view/28874/2 "2023-04-13T09:19:07Z")

</div>

This worked for me:

```auto
lm = slicer.app.layoutManager()
pw0 = lm.plotWidget(0)
pv = pw0.plotView()
ch = pv.chart()
bb = ch.GetBackgroundBrush()
bb.SetColor(0,0,128)
ch.SetBackgroundBrush(bb)

```

---

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [April 13, 2023, 9:41am UTC](https://discourse.slicer.org/t/how-to-change-the-background-color-of-plot-view/28874/3 "2023-04-13T09:41:09Z")

</div>

thank you cpinter  
this is the only code i find useful  
do you know how to change the color of the Coordinate axis?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [April 13, 2023, 12:35pm UTC](https://discourse.slicer.org/t/how-to-change-the-background-color-of-plot-view/28874/4 "2023-04-13T12:35:34Z")

</div>

I’d look along the same lines. In the chart MRML node, the plot view (subclass of ctkVTKChartView), and the VTK chart class. If there is such a function in said classes use that, if there isn’t, then it is probably not supported.

---

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [April 13, 2023, 12:36pm UTC](https://discourse.slicer.org/t/how-to-change-the-background-color-of-plot-view/28874/5 "2023-04-13T12:36:25Z")

</div>

thank you very much@cpinter
