我有这样的数据......
request.Parameters.Where(p => p.Type == ParameterType.RequestBody).FirstOrDefault();
...我尝试从# rok miesiac ile kwartal miesiac2 kwartal2 miesiac3 limit serwis typ ile2 ile_proc lp
# (dbl) (dbl) (dbl) (dbl) (chr) (fctr) (chr) (dbl) (chr) (chr) (dbl) (dbl) (dbl)
# 1 2017 1 31.5 1 1 Q1 2017 Styczeń 0 Sport wizyty 32.5 97 1
# 2 2017 2 1.0 1 2 Q1 2017 Luty 0 Sport wizyty 32.5 3 1
库中绘制这个图...
plotly
......一切都好,但是悬停。它不起作用,我不明白为什么。当我拥有相同格式的数据但有点“更长”时,一切都很好奇。
我不知道问题出在哪里。我希望你会!
简单数据:
plot_ly(tab,
x = ~lp,
y = ~ile,
color = ~miesiac2,
type = "bar",
text = ~miesiac3,
hoverinfo = "text")
'停止'数据:
structure(list(rok = c(2017, 2017), miesiac = c(1, 2), ile = c(31.5,
1), kwartal = c(1, 1), miesiac2 = c("1", "2"), kwartal2 = structure(c(1L,
1L), .Label = "Q1 2017", class = "factor"), miesiac3 = c("Styczeń",
"Luty"), limit = c(97, 97), serwis = c("Sport", "Sport"), typ = c("wizyty",
"wizyty"), ile2 = c(32.5, 32.5), ile_proc = c(97, 3), lp = c(1,
1)), class = "data.frame", .Names = c("rok", "miesiac", "ile",
"kwartal", "miesiac2", "kwartal2", "miesiac3", "limit", "serwis",
"typ", "ile2", "ile_proc", "lp"), row.names = c(NA, -2L))
答案 0 :(得分:0)
虽然我收到了警告,但该情节对我有用
Warning message:
In RColorBrewer::brewer.pal(N, "Set2") :
minimal value for n is 3, returning requested palette with 3 different levels
这只是一个警告,在这种情况下可以忽略。对于好奇,它起源于RColorBrewer
,可以通过手动指定颜色来避免。
library(RColorBrewer)
# display.brewer.all() # see all the palettes
# generate colors beforehand - same warning. extract only first two
cols <- brewer.pal(n = 2, name = "Set2")[1:2]
plot_ly(xyshort,
x = ~lp,
y = ~ile,
color = ~miesiac2,
colors = cols, # explicitly name colors
type = "bar",
text = ~miesiac3,
hoverinfo = "text")
Windows 7上的R 3.3.2和plotly_4.5.6
。