@@ -103,7 +103,7 @@ knit_print.figure <- function(x, options, ...) {
103
103
knitr :: asis_output(iframe )
104
104
}
105
105
106
- # ' Embed a plotly figure as an iframe into a IPython Notebook
106
+ # ' Embed a plotly figure as an iframe into a Jupyter Notebook
107
107
# ' @param x a plotly object
108
108
# ' @param width attribute of the iframe. If \code{NULL}, the width in
109
109
# ' \code{plot_ly} is used. If that is also \code{NULL}, '100\%' is the default.
@@ -128,15 +128,16 @@ embed_notebook <- function(x, width = NULL, height = NULL,
128
128
htmlwidgets :: saveWidget(as.widget(l ), file = basename(file ))
129
129
file
130
130
} else {
131
- paste0( l $ url , " .embed " )
131
+ l $ url
132
132
}
133
- iframe <- plotly_iframe(src , width %|| % l $ width , height %|| % l $ height )
133
+ iframe <- plotly_iframe(src , width %|| % l $ width , height %|| % l $ height , url_ext = " " )
134
134
get(" display_html" , envir = asNamespace(" IRdisplay" ))(iframe )
135
135
}
136
136
137
- plotly_iframe <- function (url = " " , width = NULL , height = NULL ) {
137
+ plotly_iframe <- function (url = " " , width = NULL , height = NULL , url_ext = " .embed" ) {
138
+ url <- paste0(url , url_ext )
138
139
sprintf(
139
- ' <iframe src="%s.embed " width="%s" height="%s" id="igraph" scrolling="no" seamless="seamless" frameBorder="0"> </iframe>' ,
140
+ ' <iframe src="%s" width="%s" height="%s" id="igraph" scrolling="no" seamless="seamless" frameBorder="0"> </iframe>' ,
140
141
url , width %|| % " 100%" , height %|| % " 400"
141
142
)
142
143
}
0 commit comments