Black Lives Matter. Please consider donating to Black Girls Code today.

Apply the background colour for titlle

Hi All,

Please let me know how to apply the color background for the title “Server Metrics” using pyplot.

import pandas as pd
import as px

df = pd.read_excel(excel_path)
fig = px.line(df, x = “Date”, y = “Memory”, title=‘Metrics’)

Hi @Karthika,

layout.title has no attribute to set the title background color. If you are referring to the plot background color, then it can be updated as follows:

fig.update_layout(plot_bgcolor='rgb(235 235 235)') #color code at your choice

Thanks @empet . But actually i was looking to change the layout title background color .