question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing the y label for histogram in plotly express does not work

See original GitHub issue

Hi I am using plotly express to plot a histogram.

import plotly.express as px

px.histogram(
    cdf,
    x='diag',
    histnorm='probability',
    labels={'diag': 'cosine similarity'},
    title='Cosine Similarity of Diagonal Samples',
    color_discrete_sequence=['green'],
)

The y label is shown as count, I want the y label to be called probability. I tried passing labels={'diag': 'cosine similarity', 'count': 'probability'} but that doesn’t work? How do I change the y label ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

18reactions
set92commented, Feb 15, 2021

Keeps happening in 4.14.3

I fixed it a little bit with yaxis_title but in the popup that appear when you put the mouse over the bars still shows “count”.

fig = px.histogram(
    n_orders, labels={"value": "# Pedidos", "count": "# Clientes"}
).update_layout(
    title={"text": "Numero de pedidos por cliente", "x": 0.5}, yaxis_title="# Clientes"
)
fig.show()
1reaction
nicolaskruchtencommented, Apr 26, 2022

This works fine for me for both the y axis title and the hoverlabel… I’m not sure what the problem is.

image
Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotly: How to manually specify the label of an aggregated ...
The x and (unaggregated) y axis labels can be manually specified via the labels dict, but what about the label of the aggregated...
Read more >
Histograms in Python - Plotly
In statistics, a histogram is representation of the distribution of numerical data, where the data are binned and the count for each bin...
Read more >
plotly.express.histogram — 5.11.0 documentation
In a histogram, rows of data_frame are grouped together into a rectangular mark to visualize the 1D distribution of an aggregate function histfunc...
Read more >
Histograms with Plotly Express: Complete Guide
Explaining all the parameters of the Plotly.Express histogram ideal to display the distribution of variables in any Data Frame.
Read more >
How to Make a Plotly Histogram - Sharp Sight
This is a great technique to use if your data has different categories, and you want to visualize those categories in the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found