Skip to content

Instantly share code, notes, and snippets.

@audhiaprilliant
Last active March 7, 2022 08:27
Show Gist options
  • Select an option

  • Save audhiaprilliant/e4329675867cb01a8584b19454363690 to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/e4329675867cb01a8584b19454363690 to your computer and use it in GitHub Desktop.
Introduction to Plotly
# 5 Flip the horizontal axis and set range of vertical axis
# Create object of figure
fig = go.Figure()
# Create a bar plot
fig.add_trace(
go.Bar(
x = df['Fruit'],
y = df['Sales'],
width = widths
)
)
# Config for title, background, legend etc
fig.update_layout(
plot_bgcolor = 'white',
font = {
'color': '#797979'
}
)
# Flip the horizontal axis
fig.update_xaxes(
tickangle = 270
)
# Set range of vertical axis
fig.update_yaxes(
range = [0, 30000]
)
# Show graph
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment