Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text attribute appears on bar traces with plotly.js 2.0 #374

Closed
cpsievert opened this issue Jun 8, 2021 · 4 comments
Closed

text attribute appears on bar traces with plotly.js 2.0 #374

cpsievert opened this issue Jun 8, 2021 · 4 comments

Comments

@cpsievert
Copy link
Contributor

cpsievert commented Jun 8, 2021

Bumping plotly.js from 1.58.4 to 2.0.0 with latest release of orca (1.3.1) introduces a regression where the text attribute now appears on bar traces:

cd ~/tmp
wget https://cdn.plot.ly/plotly-1.58.4.min.js ./
orca graph '{ "data": [ { "x": [1, 2], "y": [10, 11.5], "text": ["cond: control<br />result: 10.0", "cond: treatment<br />result: 11.5"], "type": "bar" } ] }' -o before.png --plotly plotly-1.58.4.min.js 
open before.png

before

wget https://cdn.plot.ly/plotly-2.0.0.min.js ./
orca graph '{ "data": [ { "x": [1, 2], "y": [10, 11.5], "text": ["cond: control<br />result: 10.0", "cond: treatment<br />result: 11.5"], "type": "bar" } ] }' -o after.png --plotly plotly-2.0.0.min.js 
open after.png

after

@antoinerg
Copy link
Collaborator

cc @archmoj @nicolaskruchten

@archmoj
Copy link

archmoj commented Jun 8, 2021

This is the expected behaviour in plotly.js v2.
Related PR: plotly/plotly.js#5638
In order to drop text on bars, the textposition could be set to "none" similar to other traces.

@nicolaskruchten
Copy link
Contributor

Correct. The rationale here was that setting text should be enough to actually have text appear, whereas previously it would only appear in the hoverlabel, controlled via hoverinfo. The recommended thing to do now if you want stuff in the hoverlabel is to use hovertemplate (possibly in conjunction with customdata but that's optional ofc). In general this leads to smaller figures due to less repetition of values in text.

@cpsievert
Copy link
Contributor Author

Ah ok, that's fair. For some reason I thought the static export had different behavior but I goofed up versions, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants