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.

eg:, 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:

1 Like