time series - How do I do a scatter plot with dygraph in R, including mouseover date? -
i have 3 set of data, both in same time series, want plot data set 1 x axis , data set 2 , 3 y axis. data set 2 , 3 in separate plot. in addition, when mouse on data point, see date of data point well. use dygraph/tauchart in r this.
another point zooming of graph well.
this example of data points in xts format.
series 1 series 2 series 3 jan 2006 28397 7.55 11376 feb 2006 21255 7.63 8702 mar 2006 24730 7.62 10011 apr 2006 18981 7.50 7942 may 2006 25382 7.47 10490 jun 2006 23874 7.53 10156
example have seen plot scatter plot no code shown
edited: have done scatter plot, there still edit problem it. package used tauchart.
- i cannot combined series 2 , 3 2 plot(top , bottom) separately
- the plot not scalable on y axis. tried using auto_scale in tau_guide_x , y, however, x scale works not y. have tried using min , max, not working too.
code
scatterplot1<-tauchart(a) %>% tau_point("series.1", "series.2") %>% tau_tooltip() %>% tau_guide_x(label="amount", auto_scale=false) %>% tau_guide_y(label="amount", auto_scale=false)
this have plot , problem come in scaling of y axis cannot done.
not sure doing xts object , dygraph, if data in data frame it's easy new taucharts package .
create part of data data frame:
months <- c("jan 2006", "feb 2006", "mar 2006") series1 <- c(28397, 21225, 24730) series2 <- c(7.55, 7.63, 7.62) mydata <- data.frame(months, series1, series2)
install , load taucharts:
devtools::install_github("hrbrmstr/taucharts") library("taucharts")
create scatter plot tooltip using taucharts:
tauchart(mydata) %>% tau_point("series1", "series2") %>% tau_tooltip()
Comments
Post a Comment