我的数据格式如下:
my_data = structure(list(name = c("john", "john", "john", "john", "john",
"alex", "alex", "alex", "alex", "alex", "tim", "tim", "tim",
"tim", "tim", "jason", "jason", "jason", "jason", "jason", "peter",
"peter", "peter", "peter", "peter", "nancy", "nancy", "nancy",
"nancy", "sarah", "sarah", "sarah", "sarah", "luke", "luke",
"luke", "luke", "steve", "steve", "steve", "steve", "matt", "matt",
"matt", "mark", "mark", "mark", "jim", "jim", "jim", "derek",
"derek", "lucy", "lucy", "anne", "kevin", "dave"), year = c(2010,
2011, 2013, 2014, 2019, 2010, 2011, 2012, 2013, 2014, 2008, 2010,
2014, 2018, 2019, 2005, …Run Code Online (Sandbox Code Playgroud) 以下代码用于使用滑块更改 Plotly 热图色标的 \xe2\x80\x9cmin\xe2\x80\x9d 。
\n但它非常慢:拖动滑块时我们的移动速度为 1 fps。
\n像用“heatmapgl”替换“heatmap”这样的解决方案并不能真正解决问题(它可能会提高到 2 fps)。
\n如何使用滑块更灵敏/更快地更改色阶?
\n对于许多应用程序来说,能够“实时”(超过 10 fps)看到色标变化的结果至关重要,并且可以使用 Matplotlib 等来做到这一点。
\n如何在 Plotly JS 中获得相同的行为?
\nvar z = Array.from({length: 500}, () => Array.from({length: 1000}, () => Math.floor(Math.random() * 500))); \nvar steps = [], i;\nfor (i = 0; i < 500; i++)\n steps.push({label: i, method: \'restyle\', args: [\'zmin\', i]});\nPlotly.newPlot(\'myDiv\', [{z: z, colorscale: \'Jet\', type: \'heatmap\'}], {sliders: [{steps: steps}]});Run Code Online (Sandbox Code Playgroud)\r\n<script src="https://cdn.plot.ly/plotly-2.16.2.min.js"></script>\n<div id="myDiv"></div>Run Code Online (Sandbox Code Playgroud)\r\n考虑以下数据集:
ig_5 <- data.frame(
category = c("A", "B", "C", "D", "E", "F"),
prop = c(0.1, 0.2, 0.15, 0.25, 0.05, 0.25)
) %>%
mutate(lab.ypos = cumsum(prop) - 0.5*prop)
Run Code Online (Sandbox Code Playgroud)
我使用以下代码创建了一个圆环图:
ggplot(ig_5, aes(x = 2, y = prop, fill = prop)) +
geom_bar(stat = "identity", color = "white") +
coord_polar(theta = "y", start = 0) +
geom_text(aes(y = lab.ypos, label = prop), color = "black", size = 5) +
xlim(.5, 2.5)
Run Code Online (Sandbox Code Playgroud)
可以看到,值标签放置在每个类别的中间。现在,我需要将数字放置在每个值标签的正下方。我不能只是将新对象粘贴到值中,因为文本和图形的颜色不同。因此,我想应该有一种方法可以使用值标签的坐标(x = 2,y = lab.ypos = cumsum(prop) - 0.5 * prop)来根据我的需要定位数字。
我使用 …
library(ggplot2)
mydat <- data.frame(mean = c(23, 24, 15, 27, 18, 19, 23, 20, 32),
lower = c(20, 19, 13, 15, 14, 18, 20, 17, 20),
upper = c(25, 29, 17, 39, 22, 20, 26, 23, 40),
class = c("A", "B", "C", "A", "B", "C", "A", "B", "C"),
domain = c("North", "North", "North", "West", "West", "West", "South", "South", "South"))
mydat$class <- as.factor(mydat$class)
mydat$domain <- as.factor(mydat$domain)
mydat %>% ggplot(aes(x = mean, y = class, color = domain, Group = domain, xmin = …Run Code Online (Sandbox Code Playgroud) 我有简单的私人模块:
public class SomePrivateModule extends PrivateModule {
@Override
protected void configure() {
bind(SomeInterface.class).
annotatedWith(SomeAnotation.class).
to(SomeClass.class);
expose(SomeInterface.class).annotatedWith(SomeAnotation.class);
bind(String.class).annotatedWith(Names.named("some_name")).toInstance("foofoo");
}
}
Run Code Online (Sandbox Code Playgroud)
我在另一个模块中使用此模块install(new SomePrivateModule).不幸的是,在依赖关系图上我得到"k_26662236"了圆形而不是@SomeAnotation SomeInterface矩形和依赖关系SomeClass.
当我改变SomePrivateModule扩展AbstractModule而不是PrivateModule一切正常.
它是Guice中的错误还是我做错了什么?
我以电子方式维护我的期刊,并且我试图了解过去几个月我对期刊写作的一致性.我有以下数据文件,其中显示了我在前30天内记录的日记条目(Entry Count)和单词(Word Count)的数量.
Date Entry Count Word Count
2010-08-25 22 4205
2010-08-26 21 4012
2010-08-27 20 3865
2010-08-28 20 4062
2010-08-29 19 3938
2010-08-30 18 3759
2010-08-31 17 3564
2010-09-01 17 3564
2010-09-02 16 3444
2010-09-03 17 3647
2010-09-04 17 3617
2010-09-05 16 3390
2010-09-06 15 3251
2010-09-07 15 3186
2010-09-08 15 3186
2010-09-09 16 3414
2010-09-10 15 3228
2010-09-11 14 3006
2010-09-12 13 2769
2010-09-13 13 2781
2010-09-14 12 2637
2010-09-15 13 2774
2010-09-16 13 …Run Code Online (Sandbox Code Playgroud) 我正在为项目使用硬件模拟器.它最后以非常结构化但丑陋的方式输出统计数据.阅读起来很烦人,所以我想编写一个GUI来帮助我更好地展示它.是否有人知道我可以使用什么框架和小部件来快速,轻松地构建干净的东西?我希望能够导航树的子节点并隐藏(折叠)我不感兴趣的节点.
统计信息输出采用这样的形式
root {
foo = "bar";
foo_num = 1;
machine {
core0 {
fetch {
renamed {
none = 13559;
flags = 3013;
reg_and_flags = 10735;
reg = 8430;
}
width[5] = {
Minimum: 381
Maximum: 17450
Average: 1.248
Total Sum: 28627
Weighted Sum: 35737
Threshold: 3
[ 61.0% ] [ 61.0% ] 0 0 17450 ******************************
[ 1.3% ] [ 62.3% ] 1 1 381
[ 12.1% ] [ 74.4% ] 2 2 3476 ******
[ 3.1% ] …Run Code Online (Sandbox Code Playgroud) 我一直在玩Mathematica的可视化和网络浏览功能.基于一些演示代码,我能够可视化网络.以下是大学网页上的示例:
webcrawler[rooturl_, depth_] :=
Flatten[Rest[NestList[
Union[Flatten[Thread[# -> Import[#,"Hyperlinks"]] & /@ Last /@ #]] &,
{"" -> rooturl}, depth]]];
Graph[webcrawler[
"http://www.yorku.ca/", 2], {ImageSize -> Full}]
Run Code Online (Sandbox Code Playgroud)
但是,我一直在努力寻找将EdgeLabels []应用于此Graph[]命令的方法.我想在每一行上写下每个链接,只是为了弄清楚链接簇代表什么.
我已经尝试将生成的Hyperlink连接列表应用到它,这不起作用,也没有任何来自文档/堆栈/ cookbook上其他地方的明显命令.
我想象一个非常杂乱的输出.
我正在研究一些室内和室外活动的相当精细的情节,我有点卡住了.我想添加着色用了室内/室外用(纪要Xmin,Ymin以及Zmin中)geom_segment我的阴谋的步骤(见下文).它目前仅 Zmin被着色(使用连续变量,有点关闭).
我粘贴了所有代码以防其他人想要构建这样的东西,我最初的灵感来自这篇博文.
任何帮助将不胜感激,谢谢!
df <- data.frame(
date = seq(Sys.Date(), len= 156, by="4 day")[sample(156, 26)],
action = paste('Then', LETTERS[1:13], 'happed, which was not related to', LETTERS[14:26]),
IndoorOutdoor = rep(c(-1,1), 13),
Xmin = sample(90, 26, replace = T),
Ymin = sample(90, 26, replace = T),
Zmin = sample(90, 26, replace = T)
)
df$XYZmin <- rowSums(df[,c("Xmin", "Ymin", "Zmin")])*df$IndoorOutdoor
# install.packages("ggplot2", dependencies = TRUE)
require(ggplot2)
# step 1
plot <- …Run Code Online (Sandbox Code Playgroud) 我想通过使用以下代码单击该行来获取某一点上的点的坐标:
var lineData = [ { "x": 1, "y": 5}, { "x": 20, "y": 20},
{ "x": 40, "y": 10}, { "x": 60, "y": 40},
{ "x": 80, "y": 5}, { "x": 100, "y": 60}];
var lineFunction = d3.svg.line()
.x(function(d) { return d.x; })
.y(function(d) { return d.y; })
.interpolate("linear");
var svgContainer = d3.select("body").append("svg")
.attr("width", 200)
.attr("height", 200);
var lineGraph = svgContainer.append("path")
.data([lineData]).attr("d", lineFunction)
//.attr("d", lineFunction(lineData))
.attr("stroke", "blue")
.attr("stroke-width", 2)
.attr("fill", "none")
.on('mousedown', function(d) {
console.log({"x":d.x, "y":d.y})
});
Run Code Online (Sandbox Code Playgroud)
(我更新了代码以解决注释,但我仍然得到"Object {x:undefined,y:undefined}") …
visualization ×10
r ×5
ggplot2 ×3
plot ×2
c++ ×1
d3.js ×1
guice ×1
java ×1
javascript ×1
math ×1
numbers ×1
plotly ×1
plotly-dash ×1
plotly.js ×1
statistics ×1
time ×1