You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to manipulateWidget::combineWidgets to create the following plot
I tried to implement this using the following R code
library(plotly)
#> Loading required package: ggplot2#> #> Attaching package: 'plotly'#> The following object is masked from 'package:ggplot2':#> #> last_plot#> The following object is masked from 'package:stats':#> #> filter#> The following object is masked from 'package:graphics':#> #> layout
library(ggplot2)
library(magrittr)
data<- head(ggplot2::diamonds)
fig1<-plotly::plot_ly(
type='table',
columnwidth= c(100, 100),
columnorder= c(0, 1),
header=list(
values= c("Cut","Price"),
align= c("center", "center"),
line=list(width=1, color='black'),
fill=list(color= c("grey", "grey")),
font=list(family="Arial", size=14, color="white")
),
cells=list(
values= rbind(data$cut, data$price),
align= c("center", "center"),
line=list(color="black", width=1),
font=list(family="Arial", size=12, color= c("black"))
))
cut_name<-data %>%
dplyr::pull(.data[["cut"]]) %>%
unique() %>%
as.character()
cut_pal<- c("#377eb8","#b72e92","#322eb7","#b7772e") %>%
stats::setNames(cut_name)
fig2<-plotly::plot_ly() %>%
plotly::add_trace(data=data,
x=data[["cut"]],
y=data[["price"]],
color=data[["cut"]],
colors=cut_pal,
type="scatter",
mode='markers')
fig<-manipulateWidget::combineWidgets(list=list(fig2, fig1))
fig#> Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See ?toJSON.Createdon2021-08-17bythereprex package (v2.0.1)
Unfortunately, it gives this warning message "Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See ?toJSON."
Strangely, if I did not put in any custom colors to the plot,
library(plotly)
#> Loading required package: ggplot2#> #> Attaching package: 'plotly'#> The following object is masked from 'package:ggplot2':#> #> last_plot#> The following object is masked from 'package:stats':#> #> filter#> The following object is masked from 'package:graphics':#> #> layout
library(ggplot2)
library(magrittr)
data<- head(ggplot2::diamonds)
fig1<-plotly::plot_ly(
type='table',
columnwidth= c(100, 100),
columnorder= c(0, 1),
header=list(
values= c("Cut","Price"),
align= c("center", "center"),
line=list(width=1, color='black'),
fill=list(color= c("grey", "grey")),
font=list(family="Arial", size=14, color="white")
),
cells=list(
values= rbind(data$cut, data$price),
align= c("center", "center"),
line=list(color="black", width=1),
font=list(family="Arial", size=12, color= c("black"))
))
fig2<-plotly::plot_ly() %>%
plotly::add_trace(data=data,
x=data[["cut"]],
y=data[["price"]],
type="scatter",
mode='markers')
fig<-manipulateWidget::combineWidgets(list=list(fig2, fig1))
figCreatedon2021-08-17bythereprex package (v2.0.1)
The message is not present and the plot is as follows:
Any idea what is the cause of this error message ? The message seems to indicate that my implementation will not work in the future. Is there any way to avoid this ?
Thank you.
The text was updated successfully, but these errors were encountered:
Hi,
I wanted to
manipulateWidget::combineWidgets
to create the following plotI tried to implement this using the following R code
Unfortunately, it gives this warning message "Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See ?toJSON."
Strangely, if I did not put in any custom colors to the plot,
The message is not present and the plot is as follows:
Any idea what is the cause of this error message ? The message seems to indicate that my implementation will not work in the future. Is there any way to avoid this ?
Thank you.
The text was updated successfully, but these errors were encountered: