This is a short demo of how to plot multiple series using hPlot
in rCharts
. The trick is to melt the data to long form and then use the group
argument to specify the series name.
Last active
August 29, 2015 14:01
-
-
Save ramnathv/08688a0e79cd01602afa to your computer and use it in GitHub Desktop.
HighCharts Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create dummy data frame | |
dat <- data.frame( | |
x = rnorm(100), | |
y1 = rnorm(100), | |
y2 = rnorm(100) | |
) | |
# melt the data to long form | |
library(reshape2) | |
datm = melt(dat, id = 'x', | |
variable.name = 'g', | |
value.name = 'y' | |
) | |
library(rCharts) | |
hPlot(y ~ x, | |
data = datm, | |
group = 'g', | |
type = 'scatter' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment