✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Plotly Express axis labels

How do I change the axis labels in a plot?

px.line(… labels={})

What do I put in the labels dictionary? I can’t seem to find any examples online or in the documentation.

Thanks in advance.

To change the x label or y label you can use the labels.


px.bar(data, x=months, y=‘Sales’, labels = {‘x’:‘Month’})

  • data is the data dataframe
  • months is a separate list of the months [‘Jan’,‘Feb’,…‘Dec’]

Hope this helps you :slight_smile: