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

Axes labels/titles not appearing #539

Closed
gkiar opened this issue Jan 15, 2019 · 14 comments
Closed

Axes labels/titles not appearing #539

gkiar opened this issue Jan 15, 2019 · 14 comments

Comments

@gkiar
Copy link

gkiar commented Jan 15, 2019

Hi!

First of all: I'm not sure whether or not this is a Dash or Plotly specific issue, but I'm using them together so figured I'd put the comment here - please redirect me if I'm mistaken.

The behaviour I'm currently getting is that titles specified for both axis and plots are not appearing in the resulting plots. Using older versions of plotly and dash these have produced the expected output. I've attached two figures below, showing the previous and current result. I've also attached a pip freeze of all related packages on my machine.

I'm currently specifying the title as is described quite simply in the documentation, within my layout structure using the title field and a simple string value, i.e. layout = {'title':'my title', 'yaxis': {'title':'my y title', ...}, ...}

Please let me know if there's likely a simple oversight on my part here causing this behaviour. Thanks!

Expected (Previous) Unexpected (Current)
screenshot 2019-01-15 12 44 52 screenshot 2019-01-15 12 50 28
plotly==3.1.1, dash==0.24.1, dash-core-components==0.27.1, dash-html-components==0.11.0, dash-renderer==0.13.0, dash-table-experiments==0.6.0 plotly==3.5.0, dash==0.35.2, dash-core-components==0.42.1, dash-html-components==0.13.5, dash-renderer==0.16.2, dash-table-experiments==0.6.0
@alexcjohnson
Copy link
Collaborator

Thanks for bringing this up @gkiar!
Presumably related to plotly/plotly.js#3276 where we changed from:
layout={title: 'my title'}
to:
layout={title: {text: 'my title'}}
The older form is still expected to work, but until we figure out what's going on here you should be able to get the desired result by changing to the new form of title attributes.

@gkiar
Copy link
Author

gkiar commented Jan 15, 2019

Hi @alexcjohnson - thanks for the quick response!

I actually have been printing my Figure object out to debug, and it is being properly converted, i.e.
it shows up as the following: 'title': {'text': 'Usage Stats'}.

Any idea what would cause the property to not be rendered, despite it being in the figure object? I inspected the plot in the console and found the title elements to be blank:

<g class="infolayer">
  <g class="g-gtitle"></g>
  <g class="g-xtitle"></g>
  <g class="g-ytitle"></g>
  <g class="g-y2title"></g>
</g>

@alexcjohnson
Copy link
Collaborator

Could it be that you somehow have an old plotly.js version, despite having updated dash?
In the console, you can type Plotly.version. Also to see what's actually supplied to the plot, you can select the class="js-plotly-plot" element and type $0.layout.title. Here's what I see in a currently-working example at https://dash.plot.ly/dash-core-components:
screen shot 2019-01-15 at 2 34 11 pm

@gkiar
Copy link
Author

gkiar commented Jan 15, 2019

@alexcjohnson I think you found the issue - the layout object is correctly set, but my plotly version is 1.39.1. Is there a guide somewhere on how to ensure that the javascript library also get updated when I update the Python component? Thanks!

@gkiar
Copy link
Author

gkiar commented Jan 15, 2019

Ah, I was using a "custom" dash.Dash class in my code, as I believe at one point this was the recommended way to specify page title and some other information. It now appears I can do this a better way, so I've reverted back to using the default dash.Dash, and all is working as expected :) Thanks!

@s3630237
Copy link

s3630237 commented Feb 3, 2021

Hi Guys,

Not sure if this related to the issue here, but I'm finding that my plotly express plots work fine in Jupyter notebook, but I get minor issues when I generate the exact plot in Dash. For example, x and y titles do not generate, specific hover info that I set does not appear, continuous color bars do not appear from a scatter_mapbox. Furthermore sunburst and treemaps do not generate at all. All these features work within Jupyter notebook. Does anybody have any idea on where I can start to solve these problems?
Many thanks,
Bill

@alexcjohnson
Copy link
Collaborator

@s3630237 that sounds consistent with an old plotly.js version. dash-core-components has its own copy of plotly.js, and you'll get the latest dcc if you update dash itself.

@s3630237
Copy link

s3630237 commented Feb 4, 2021

Thanks Alex for getting back to me so quickly. Ive already upgraded dash, by typing the following at the command prompt "easy_install --upgrade Dash". Below is a listing of my dash packages when i type 'pip list'. I'm pretty sure these are the most up to date dash packages. Is there another way I should be doing this r is there another command I should by tping to upgrade plotly.js?

dash 1.19.0
dash-core-components 1.15.0
dash-html-components 1.1.2
dash-renderer 1.9.0
dash-table 4.11.2
dash-update-data-components 0.0.1

@alexcjohnson
Copy link
Collaborator

Yes, that's up to date. What do you get if you open the JS console when viewing your dash app and type Plotly.version? It should be "1.58.4"

@s3630237
Copy link

s3630237 commented Feb 4, 2021 via email

@alexcjohnson
Copy link
Collaborator

In the browser where you're viewing the dash app. If you're using Chrome this is "developer tools" from the dots menu:
Screen Shot 2021-02-03 at 10 16 48 PM

The other thing to look at is whether the version of Dash that PyCharm sees is the same one you just upgraded. If for some reason PyCharm is pointing at a different Python installation than pip/easy_install, you might be looking at some old Dash installation. In the PyCharm Python console you can import dash and check dash.__version__

@s3630237
Copy link

s3630237 commented Feb 4, 2021 via email

@s3630237
Copy link

s3630237 commented Feb 4, 2021 via email

@alexcjohnson
Copy link
Collaborator

Great! Yeah it’s easy for pip and conda to point to complete different Python installations, and it’s best to just pick one and stick with it

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

3 participants