Reputation: 171
I have three data, that I have been able to plot using highchart:
hchart(data1)
hchart(data2)
hchart(data3)
Now what should I do if I want to have the three data in different plot but at the same page like this:
Upvotes: 1
Views: 467
Reputation: 46888
You can use hw_grid as a quick fix if all of them have the same height:
library(htmltools)
library(highcharter)
h1 = hchart(prcomp(mtcars))
h2 = hchart(iris$Sepal.Width)
h3 = hchart(data.frame(x=1:10+runif(10),y=1:10+runif(10)),type="line")
combined = list(h1,h2,h3) %>% hw_grid(ncol=1,rowheight=250)
browsable(combined)
Or actually go down to using packages for combining htmlwidgets, where you can specify layout + row heights:
library(manipulateWidget)
combineWidgets(h1,h2,h3,ncol=1,rowsize=c(2,1,1))
Upvotes: 2
Reputation: 171
I figure it out with htmltools package:
library(htmltools)
browsable(
tagList(
hchart(data1),
hchart(data2),
hchart(data3)
)
)
It works fine for every html output, and can be configured.
Upvotes: 1
Reputation: 152
par
function is what you need.
par(mfrow=c(3,1))
hchart(data1)
hchart(data2)
hchart(data3)
Upvotes: 0