✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Changing background plotly.js

Hi
I’m currently using a “gauge” graph on my personal website but, I can’t get to change the background color from white to another color that I want. How am I able to do this?
This is the example code:

var data = [
	{
		domain: { x: [0, 1], y: [0, 1] },
		value: 270,
		title: { text: "Speed" },
		type: "indicator",
		mode: "gauge+number"
	}
];

var layout = { width: 600, height: 500, margin: { t: 0, b: 0 },  };
Plotly.newPlot('myDiv', data, layout);

Thank you for your help!

Try setting a value for layout.paper_bgcolor

1 Like