6

Below is my code, could someone tell me how do I set background color, title, x-axis y-axis labels :

scatterplot = plot([Scatter(x=x.index,
                            y=x['rating'],
                            mode='markers', 
                            marker=dict(size=10,
                                        color=x['value'],
                                        colorscale='Viridis', 
                                        showscale=True),
                            text=(x['value'] + ' ' + x['Episode'] + '<br>' + x['label']))],
                            output_type='div'
                  )

P.S : this is being shown in webpage directly.

Mert Karakas
  • 178
  • 1
  • 4
  • 22
sid8491
  • 6,622
  • 6
  • 38
  • 64

1 Answers1

11

You can set background color by creating a Layout object

layout = Layout(
    plot_bgcolor='rgba(0,0,0,0)'
)

data = Data([
    Scatter( ... )  
])

fig = Figure(data=data, layout=layout)
plot(fig, output_type='div')

If you want a transparent background see this post.

To set the title and axis labels, add properties to the Layout object (see the docs):

title='Plot Title',
xaxis=dict(
    title='x Axis',
    titlefont=dict(
        family='Courier New, monospace',
        size=18,
        color='#7f7f7f'
    )
),
yaxis=dict(
    title='y Axis',
    titlefont=dict(
        family='Courier New, monospace',
        size=18,
        color='#7f7f7f'
    )
)
Community
  • 1
  • 1
roob
  • 2,419
  • 3
  • 29
  • 45