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.
Plotly Express Set Transparent Color To create a transparent background, we can use the update_layout() function and bass the plot_bgcolor and paper_bgcolor transparent values.
@alexpetit12 You can set the font color for the entire title not only for substrings of it. layout=go. layout(title = dict(text ='Your title', font =dict(family='Sherif', size=14, color = 'red')), ... ) for more title attributes see https://plot.ly/python/reference/#layout-title.
Right-click the upper-left corner of the Python console window and select Properties. In the dialog box that appears, pick the tab labeled Colors. On it you can set the screen background and text color.
A background image can be added to the layout of a figure by setting the images parameter of plot_ly$layout . The source attribute of a layout$images can be the URL of an image, or an image object.
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'
)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With