0

I'm starting to learn Python and I'm currently using the Plotly Library. For some reason the formatting of my title is causing an error

title_font = dict(
                title="<b>Plot</b>",
                size=14,
                color='black',
                family='Arial')

layout = go.Layout(title_font,
                        xaxis= {'title':'Temperature level'},
                        yaxis=dict(title='Sea Level'),
                        hovermode='closest')

The error started when I pulled the Title name out of layout and created a variable for it.

2
  • Is this the code that produces the error? What's the traceback? Commented Dec 30, 2020 at 23:08
  • @Reti43, ValueError: Invalid property specified for object of type plotly.graph_objs.Layout: 'size' Commented Dec 30, 2020 at 23:15

1 Answer 1

1

You are setting the size property for layout, but it's not a valid property for layout as the error message says. You had also added the title in the title.font section which is incorrect. The correct code is:

title_font = dict(
                size=14,
                color='black',
                family='Arial')

layout = go.Layout(title="<b>Plot</b>",
                   title_font=title_font,
                        xaxis= {'title':'Temperature level'},
                        yaxis=dict(title='Sea Level'),
                        hovermode='closest')

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.