-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Problems with embedding plotly generated div into django app. #1147
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
Comments
Hi @CiaranWelsh , I'll try to take a look at Problems 1 and 3 soon, but I think problem 2 is a pretty quick fix. The axes for 3D plots are located at |
I was able to reproduce Problem 3. This error should have been harmless, but it will be fixed in version 3.2 by #1152. |
Ok @CiaranWelsh , I worked out what was going on. The culprit was this rule in svg {
width: 100%;
height: 100%;
} The modebar buttons in Plotly.js are SVG images and so this rule was overriding their sizing. I fixed in by unsetting these values in svg {
width: unset;
height: unset;
} I also notice that the top of the legend was overlapping with the modebar a little, so I lowered it a bit by setting the Here's a PR with the changes CiaranWelsh/data_viz_with_django#1. Have fun! |
@jonmmease My inexperience with web development shining through here. Thank you for taking a look and sorry for opening an 'undeserved' issue. All the best, Ciaran. |
I am using plotly to generate a 3d scatter graph to embed in a django website. I am having a couple of issues - they look buggy but I am unfamiliar with this tool so its also possible I'm just not using correctly.
The code
Here's the relevant section of my code. The code simply iterates over a
pandas.groupby
object to plot experimental factors a different colour.Problem 1: The Mode Bar
Using the `pyo.plot` with `output_type='file'` works as expected but when set to `div` as I need for embedding into a django site, the mode buttons are massive and all over the place. My only solution so far has been to suppress the mode bar. The other solution that kind of worked was to use css to set the height/width of `modebar-group` css classes - however, here we get some overlapping buttons. Heres a screen shot without the mode bar suppressed.Problem 2: Axis labels
The (docs)[https://plot.ly/python/figure-labels/] suggest that axis labels should be given as in the above code snippet, however my axis labels remain unchanged. In addition, the zaxis argument into `go.Layout` raises an error, complaining that `zaxis` is not an argument for Layout, though docs seem to indicate this is the way its done.Problem 3: error in chrome
When I look in Chrome developer tools, it seems that the code that is auto-generated by plotly contains an error. I'm not sure to what extent this error may be causing the others.Here's the error
The full project can be obtained from (here)[https://github.com/CiaranWelsh/data_viz_with_django/tree/develop] on the develop branch. Run
python manage.py runserver
, navigate to thePCA
page and press submit to reproduce the problems.I am running the Python version 3.6.5 with the latest install of plotly and django.
The text was updated successfully, but these errors were encountered: