Skip to content

plotly_POST not embedding plot as expected #581

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

Closed
solarchemist opened this issue May 11, 2016 · 1 comment · Fixed by #613
Closed

plotly_POST not embedding plot as expected #581

solarchemist opened this issue May 11, 2016 · 1 comment · Fixed by #613

Comments

@solarchemist
Copy link

solarchemist commented May 11, 2016

So this is a little weird, and I haven't been able to figure it out after reading the documentation (1, 2, 3, 4).

I generated a plot using ggplot2, which I then embed in a R Markdown document published as HTML on the web (Jekyll blog, but that's beside the point).

```{r lnb-160411-quality-fits, echo=FALSE, results="asis"}
p <- ggplot() + ...
plotly_POST(p, filename = "lnb-160411-poor-fits", fileopt = "overwrite", sharing = "public")

This produces the following HTML:

<iframe src="https://plot.ly/~chepec/151" width="800" height="600" id="igraph" scrolling="no" seamless="seamless" frameBorder="0">
</iframe>

Which does not produce the expected result, i.e., an embedded plot, but instead embeds the entire Plotly page (see below).
google chrome

I confirmed that the URL in the iframe above is in fact the output of plotly_POST,

> x <- plotly_POST(p, filename = "lnb-160411-poor-fits", fileopt = "overwrite", sharing = "public")
No encoding supplied: defaulting to UTF-8.
Success! Modified your plotly here -> https://plot.ly/~chepec/151
> str(x)
List of 5
 $ url     : chr "https://plot.ly/~chepec/151"
 $ message : chr ""
 $ warning : chr ""
 $ filename: chr "lnb-160411-poor-fits"
 $ error   : chr ""
 - attr(*, "class")= chr "figure"

and I think I can confirm that Plotly shows the embed only when appending .embed to the URL (the HTML below produces the expected embedded plot):

<iframe src="https://plot.ly/~chepec/151.embed" width="800" height="600" id="igraph" scrolling="no" seamless="seamless" frameBorder="0">
</iframe>

I think this must be an issue with plotly_POST? It should return the URL of an embed plot, not the whole page. By the way, this behaviour must have changed quite recently because the very same plotly_POST(...) call produced a properly embedded plot just a month ago.

@cpsievert
Copy link
Collaborator

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

Successfully merging a pull request may close this issue.

2 participants