user15489383
user15489383

Reputation:

How can I add title to this radar chart?

import plotly.graph_objects as go
import plotly.express as px


df = px.data.iris()


categories = ['PSxG-GA','Goals Against','Save %',
              'Clean Sheet %', 'Save %(penalty)']

fig = go.Figure()

fig.add_trace(go.Scatterpolar(
      r=[79, 79, 85, 86, 19],
      theta=categories,
      fill='toself',
      name='MATS'
))
fig.add_trace(go.Scatterpolar(
      r=[89, 96, 92, 95, 81],
      theta=categories,
      fill='toself',
      name='Oblak'
))


fig.update_layout(
  polar=dict(
    radialaxis=dict(
      visible=True,
      range=[0, 100]
    )),
  showlegend=False
)

fig.show()

and this is the result. enter image description here

I am trying to make a radar chart comparing two soccer players Ter Stegen and Oblak. I have made the chart but am struggling to add a title and assign which color is for whom on the side.

Upvotes: 2

Views: 1138

Answers (1)

vestland
vestland

Reputation: 61134

You can use:

fig.update_layout(title_text = 'Title')

Or:

fig.update_layout(title = dict(text = 'Title'))

Plot

enter image description here

Upvotes: 1

Related Questions