我有如下数据:
2018-04-01 00:12:45.823
2018-04-01 00:12:49.897
2018-04-01 00:12:56.207
Run Code Online (Sandbox Code Playgroud)
如何减少它们仅存:
00:12:45.823
00:12:49.897
00:12:56.207
Run Code Online (Sandbox Code Playgroud) 我想在 3 列之间添加一条线:Species Sepal 和 Petal。我怎样才能做到这一点?
sketch = htmltools::withTags(table(
class = 'display',
thead(
tr(
th(rowspan = 2, 'Species'),
th(colspan = 2, 'Sepal'),
th(colspan = 2, 'Petal')
),
tr(
lapply(rep(c('Length', 'Width'), 2), th)
)
)
))
print(sketch)
datatable(iris[1:20, c(5, 1:4)], container = sketch, rownames = FALSE)
Run Code Online (Sandbox Code Playgroud)
信息“trace0”始终显示在蓝线的悬停文本框旁边,如何将其删除?为什么不在橙色线上?trace0 究竟是什么意思?
library(plotly)
fig <- plot_ly()
fig <- fig %>%
add_trace(
type = 'scatter',
mode = 'lines+markers',
x = c(1,2,3,4,5),
y = c(2.02825,1.63728,6.83839,4.8485,4.73463),
text = c("Text A", "Text B", "Text C", "Text D", "Text E"),
hovertemplate = paste('<i>Price</i>: $%{y:.2f}',
'<br><b>X</b>: %{x}<br>',
'<b>%{text}</b>'),
showlegend = FALSE
)
fig <- fig %>%
add_trace(
type = 'scatter',
mode = 'lines+markers',
x = c(1,2,3,4,5),
y = c(3.02825,2.63728,4.83839,3.8485,1.73463),
hovertemplate = 'Price: %{y:$.2f}<extra></extra>',
showlegend = FALSE
)
fig
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我想更改图例的颜色,因为我希望不同的颜色代表不同的情况。但是现在,图例仅使用我在条形图上设置的第一种颜色。
我还想问一问,它还能设置一个图例吗?像粉红色代表情况A,蓝色代表情况B?
Here is the link:
Run Code Online (Sandbox Code Playgroud)
代码在这里 任何人都可以帮忙吗?非常感谢。