Skip to content

Add 'viewbox' attribute to ggplotly svg output to allow scaling in R Markdown #1065

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

Open
aoles opened this issue Jul 5, 2017 · 4 comments
Open

Comments

@aoles
Copy link

aoles commented Jul 5, 2017

Hi,
I would like to autoscale SVG graphics produced by a call to ggplotly in order to fit them into the parent CSS container in a R Markdown document, as described here. For this, it is necessary for the SVG element to have a viewBox attribute that describes the bounding box of the visible contents. Do you think it would be possible to extend your package to include this attribute?

Cheers,
Andrzej

@cpsievert
Copy link
Collaborator

Does the new orca() function give you a way to achieve this?

@jcubic
Copy link

jcubic commented Jun 7, 2018

@cpsievert I also have problem with scalling svg in R, and viewbox would help, what is orca function? Is it documented somewhere? Is it thee same as plotly/orca repo?

@jcubic
Copy link

jcubic commented Jun 7, 2018

If this is export using orca app to generated png https://github.com/ropensci/plotly/blob/31d027de3e15e0fb37060155bc03cf4e5e6f68e0/R/orca.R then it would probably be very slow the same as webshot that taken 24 seconds on my local machine to generate png 3000x1000 and both Plotly.toImage and webshot create image with small fonts if picture is bigger. viewbox would make svg scale so the font should be the same even if you change resolution.

@cpsievert
Copy link
Collaborator

Just FYI, the orca app can export to svg -- orca(ggplotly(qplot(1:10)), "test.svg")

BTW, I'd be happy to chat about your experiences with trying to make the svg output of ggplotly() to scale sensibly...

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

No branches or pull requests

3 participants