Skip to content

Disambiguate classnames #561

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
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ S3method(geom2trace,GeomText)
S3method(geom2trace,GeomTile)
S3method(geom2trace,default)
S3method(print,figure)
S3method(print,plotly)
S3method(print,plotly_hash)
S3method(to_basic,GeomAbline)
S3method(to_basic,GeomArea)
S3method(to_basic,GeomBoxplot)
Expand Down Expand Up @@ -49,7 +49,7 @@ export(get_figure)
export(gg2list)
export(ggplotly)
export(knit_print.figure)
export(knit_print.plotly)
export(knit_print.plotly_hash)
export(last_plot)
export(layout)
export(offline)
Expand Down
12 changes: 6 additions & 6 deletions R/print.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' @export
#' @importFrom htmlwidgets createWidget
#' @importFrom htmlwidgets sizingPolicy
print.plotly <- function(x, ...) {
if (!inherits(x, "htmlwidget")) x <- as.widget(x)
get("print.htmlwidget", envir = asNamespace("htmlwidgets"))(x, ...)
print.plotly_hash <- function(x, ...) {
x <- as.widget(x)
print(x, ...)
}

#' Print a plotly object in a knitr doc
Expand All @@ -16,9 +16,9 @@ print.plotly <- function(x, ...) {
#' @param options knitr options.
#' @param ... additional arguments
#' @export
knit_print.plotly <- function(x, options, ...) {
if (!inherits(x, "htmlwidget")) x <- as.widget(x)
get("knit_print.htmlwidget", envir = asNamespace("htmlwidgets"))(x, options = options, ...)
knit_print.plotly_hash <- function(x, options, ...) {
x <- as.widget(x)
knitr::knit_print(x, options, ...)
}

#' Convert a plotly object to an htmlwidget object
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ hash_plot <- function(df, p) {
assign(hash, p, envir = plotlyEnv)
attr(df, "plotly_hash") <- hash
# add plotly class mainly for printing method
class(df) <- unique(c("plotly", class(df)))
class(df) <- unique(c("plotly_hash", class(df)))
# return a data frame to be compatible with things like dplyr
df
}
Expand Down
6 changes: 3 additions & 3 deletions man/knit_print.plotly.Rd → man/knit_print.plotly_hash.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/print.plotly.Rd → man/print.plotly_hash.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.