使用dygraph显示第二个Y轴

时间:2016-02-05 17:36:17

标签: r dygraphs

尝试使用两个不同比例的Y轴。第二个Y轴刻度没有显示,数据几乎完全在屏幕外绘制。这就是我所拥有的:

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))

What does the registerNatives() method do?

我也尝试了这个,但得到了错误:

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'))

dyAxis中的错误(。," Temp",轴(" y2"))

我还没弄明白如何使用dput()添加数据(文件太大)。这是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

这是75行的dput()(我认为)。

> 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")))

1 个答案:

答案 0 :(得分:2)

这会奏效。有" ="在你的最后一行中遗漏了。

cap staging_webartists deploy