-
Notifications
You must be signed in to change notification settings - Fork 633
xlab & ylab getting cut off using ggplotly() #510
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
I'm experiencing the same issue with making an unstacked bar chart and the y-axis label is getting cut-off similarly to @Kidman007. I have tried some Has there been any solutions yet? |
Looking at it now, but I am still not as familiar with the code as I would like to be. It appears these lines are most likely to hold the answer. I'll dig deeper. |
When I reproduce the plot with the example from @bhive01, I get an annotation for I'll ping @cpsievert to see if there is an ideal solution, or if we should resort to a hack. |
Yea, I'm not sure the best way to approach this problem. What I really need is a way to place annotations on a (0-1) scale of the entire plot, or on the absolute pixel scale. Any idea if that would be easy to add to plotly.js? |
@cpsievert, do you remember why in lines this comment was made?
I am guessing facets, but could be way off here. Let's hack on the example given above by defining
|
I've tried hacking with gpw$sizingPolicy$padding = 10 but it's still cut-off. For reference my plotly viz is on shiny where the yaxis is being cut-off by the navbarPage. However I just downloaded the plot to .png from the button and the yaxis is completely normal and not cut-off 😖 |
@timelyportfolio that's right, I'm drawing titles as annotations because x/y titles are always relative the plot in ggplot2, not each axis. (in that comment, I think I meant to say "annotations aren't smart enough to dodge ticks & text" |
Probably obvious, but an easy/crude workaround is to append "\n " to your x label and prepend "\n " to your y label. That should push your labels into the visible region. |
Yes, but will worsen the situation when the plot is small. @cpsievert, do you have an example where the real plotly axis labels don't work? |
qplot(data = mtcars, x = mpg, y = wt, facets = ~vs) |
I'm having the same issues: http://stackoverflow.com/questions/36988379/adjust-axis-positions-ggplot2-facets. Also note that my titles are affected. |
@cpsievert, if no facets, should we change the behavior to use |
@timelyportfolio yea, that's a good point, a pull request would be most welcome :) |
@cpsievert I took a first stab at a pull request to make this change. I'm not sure that I got the axis title formatting correct. I tried to still use your margin calculations for both facetted and non-facetted plots. I know you will be much more familiar with the edge cases. I would love your help thinking through the best way to test. |
This should now be fixed for non-faceted plots, but we'll need a more general solution for facets. |
We seem to be seeing some of the plot being cut off (in our case the top of a bar chart) - possibly as a result of this - when used in Shiny. I can try to make a reproducible example if needed, but I don't have the source code. Interestingly the plot is not cut off when just used in the RStudio Viewer. |
try setting |
Fixed via 9afbb5d |
I was having these margin issues, so I tried installing via github to get this fix. Now, I get an error:
So, no problem, I'll just in-install this dev version of plotly and re-install via CRAN....but after tha, I was still getting that error. I had a dev version of ggplot2 installed as well apparently (I was testing my code for the new updates that are coming out soon in ggplot2). Once I installed ggplot2 from CRAN, then that error finally went away. I don't know if it's related to: So, I still have the margin issues...but admittedly didn't install the fix...but there might be some other issue with the fix....just FYI |
Hello,
I'm new to Plotly and am very excited to use it's flash visualizations and the tooltip. I'm running into an issue with my x & y labels getting cut off when I run the viz with ggplotly -- whereas it works fine when I just run the ggplot().
Below is the code and viz. I appreciate the help in advance!
Andrew
Here's my code:
The text was updated successfully, but these errors were encountered: