r - Display second Y axis using dygraph -


trying have 2 y axis different scales. second y axis scale doesn't show , data plotted entirely off screen. have:

dygraph(bmsp1, main = "black mo sp")%>% dyaxis("y", label = "depth (m) ", valuerange = c(0, 1.0))%>% dyaxis("y2", label = "temp (c) ", valuerange = c(0, 25.0)) 

plot of depth , temp

i tried error:

dygraph(bmsp1, main = "black mo sp")%>% +     dyaxis("y", label = "depth (m) ", valuerange = c(0, 1.0))%>% +     dyaxis("y2", label = "temp (c) ", valuerange = c(0, 25.0))%>% +     dyaxis("temp", axis('y2')) 

error in dyaxis(., "temp", axis("y2"))

i haven't figured out how add data using dput() (file size large). here snapshot head()

> head(bmsp1)                 depth temp (c) 2015-09-30 09:00:00 0.003   21.378 2015-09-30 09:15:00 0.228   17.475 2015-09-30 09:30:00 0.228   17.475 2015-09-30 09:45:00 0.224   17.475 2015-09-30 10:00:00 0.225   17.475 2015-09-30 10:15:00 0.224   17.475 

here dput() 75 rows (i think).

> dput(head(bmsp1, 75)) structure(c(0.003, 0.228, 0.228, 0.224, 0.225, 0.224, 0.227,  0.226, 0.23, 0.218, 0.223, 0.224, 0.229, 0.226, 0.226, 0.222,  0.228, 0.233, 0.233, 0.233, 0.232, 0.225, 0.217, 0.209, 0.204,  0.212, 0.222, 0.212, 0.23, 0.224, 0.216, 0.228, 0.231, 0.23,  0.223, 0.223, 0.232, 0.224, 0.223, 0.225, 0.224, 0.219, 0.215,  0.211, 0.211, 0.215, 0.221, 0.213, 0.216, 0.222, 0.222, 0.224,  0.217, 0.212, 0.214, 0.212, 0.209, 0.21, 0.207, 0.207, 0.206,  0.205, 0.204, 0.204, 0.203, 0.198, 0.197, 0.199, 0.194, 0.184,  0.179, 0.189, 0.195, 0.192, 0.19, 21.378, 17.475, 17.475, 17.475,  17.475, 17.475, 17.475, 17.475, 17.475, 17.475, 17.475, 17.475,  17.475, 17.475, 17.475, 17.475, 17.475, 17.475, 17.475, 17.475,  17.475, 17.57, 17.57, 17.57, 17.57, 17.57, 17.475, 17.57, 17.475,  17.475, 17.475, 17.475, 17.475, 17.475, 17.475, 17.475, 17.475,  17.475, 17.379, 17.379, 17.379, 17.379, 17.379, 17.379, 17.379,  17.379, 17.284, 17.284, 17.284, 17.284, 17.284, 17.284, 17.189,  17.189, 17.189, 17.189, 17.094, 17.094, 17.094, 17.094, 16.999,  16.999, 16.999, 16.999, 16.903, 16.903, 16.903, 16.903, 16.903,  16.808, 16.808, 16.808, 16.808, 16.713, 16.713), .indextz = "utc",     .indexclass = c("posixct",  "posixt"), tclass = c("posixct", "posixt"), tzone = "utc", class = c("xts",  "zoo"), index = structure(c(1443603600, 1443604500, 1443605400,  1443606300, 1443607200, 1443608100, 1443609000, 1443609900, 1443610800,  1443611700, 1443612600, 1443613500, 1443614400, 1443615300, 1443616200,  1443617100, 1443618000, 1443618900, 1443619800, 1443620700, 1443621600,  1443622500, 1443623400, 1443624300, 1443625200, 1443626100, 1443627000,  1443627900, 1443628800, 1443629700, 1443630600, 1443631500, 1443632400,  1443633300, 1443634200, 1443635100, 1443636000, 1443636900, 1443637800,  1443638700, 1443639600, 1443640500, 1443641400, 1443642300, 1443643200,  1443644100, 1443645000, 1443645900, 1443646800, 1443647700, 1443648600,  1443649500, 1443650400, 1443651300, 1443652200, 1443653100, 1443654000,  1443654900, 1443655800, 1443656700, 1443657600, 1443658500, 1443659400,  1443660300, 1443661200, 1443662100, 1443663000, 1443663900, 1443664800,  1443665700, 1443666600, 1443667500, 1443668400, 1443669300, 1443670200 ), tzone = "utc", tclass = c("posixct", "posixt")), .dim = c(75l,  2l), .dimnames = list(null, c("depth", "temp"))) 

this work. there "=" missing in last line.

dygraph(bmsp1, main = "black mo sp")%>%          dyaxis("y", label = "depth", valuerange = c(0, 1.0), independentticks = true)%>%          dyaxis("y2", label = "temp ", valuerange = c(0, 25.0), independentticks = true) %>%          dyseries("temp", axis=('y2')) 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -