graph

R: plotting graphs (ggplot vs autoplot)

随声附和 提交于 2021-01-05 08:57:34
问题 I am following a R tutorial over here https://rviews.rstudio.com/2017/09/25/survival-analysis-with-r/ The computer I use for work does not have internet access nor a USB port - it only has R with some preinstalled libraries. The tutorial requires "survival", "ggplot2", "ranger", "dplyr" and "ggfortify". The computer I use for work has all of these libraries EXCEPT ggfortfiy. Apparently, a function called "autoplot" is required from the ggfortify library to make some of the plots in this

R: plotting graphs (ggplot vs autoplot)

谁说胖子不能爱 提交于 2021-01-05 08:56:05
问题 I am following a R tutorial over here https://rviews.rstudio.com/2017/09/25/survival-analysis-with-r/ The computer I use for work does not have internet access nor a USB port - it only has R with some preinstalled libraries. The tutorial requires "survival", "ggplot2", "ranger", "dplyr" and "ggfortify". The computer I use for work has all of these libraries EXCEPT ggfortfiy. Apparently, a function called "autoplot" is required from the ggfortify library to make some of the plots in this

Regular Graph Plot Works, Interactive Shows up Blank

谁说我不能喝 提交于 2021-01-05 08:53:14
问题 I am able to produce a regular plot just fine, but for some reason when I pass it through an interactive plotting function - there is a blank output. Does anyone know what I am doing wrong? library(igraph) library(visNetwork) #create relationships data_a <-data.frame( "source" = c("123","124","123","125","123"), "target" = c("126", "123", "125", "122", "111")) #create edges Nodes <-data.frame( "source" = c("123","124","125","122","111", "126"), "Country" = c("usa", "uk", "uk", "usa", "uk",

Minimum number of circles to cover n points

一世执手 提交于 2021-01-05 07:29:45
问题 What is the minimum number of circles with radius r needed to cover all n points, while the n points are on a straight line? I know that there is a similar question that was asked before here. Minimum number of circles with radius r to cover n points My attempt : I'm trying to solve it in a linear time , I thought about this algorithm : place the first circle in place that solve for the first point. solve for the second point in the minimum number of circles by checking if the distance

Minimum number of circles to cover n points

ⅰ亾dé卋堺 提交于 2021-01-05 07:29:10
问题 What is the minimum number of circles with radius r needed to cover all n points, while the n points are on a straight line? I know that there is a similar question that was asked before here. Minimum number of circles with radius r to cover n points My attempt : I'm trying to solve it in a linear time , I thought about this algorithm : place the first circle in place that solve for the first point. solve for the second point in the minimum number of circles by checking if the distance

R: plot larger components (clarifying another stackoverflow post)

点点圈 提交于 2021-01-05 07:16:05
问题 I am looking at this stackoverflow plot over here: How to plot only large communities/clusters in R library(igraph) set.seed(1) g1 <- erdos.renyi.game(100, 1 / 70) cls <- clusters(g1) g2 <- delete_vertices(g1, V(g1)[cls$membership %in% which(cls$csize <= 10)]) plot(g2) It seems that first a random graph is created (called "g1"). Then the "cluster()" function is used to find out "isolated subgraphs" of "g1". All the "isolated subgraphs of g1" are stored in another object called "cls". The user

Hungarian Algorithm for non square matrix

橙三吉。 提交于 2021-01-02 06:45:46
问题 I'm trying to implement the Hungarian algorithm. Everything is fine except for when the matrix isn't square. All the methods I've searched are saying that I should make it square by adding dummy rows/columns, and filling the dummy row/column with the maximum number in the matrix. My question is that won't this affect the final result? Shouldn't the dummy row/column be filled with at least max+1? 回答1: The dummy values should all be zero. The point is that it doesn't matter which one you choose

R: connect points on a graph (ggplot2)

孤街浪徒 提交于 2021-01-01 09:26:53
问题 Suppose I have data in the following form: library(ggplot2) Data <- data.frame( "ID" = c("ABC111", "ABC111", "ABC111", "ABC111", "ABC112", "ABC112", "ABC112", "ABC113", "ABC113", "ABC114", "ABC115"), "color" = c("red", "red", "red", "red", "blue", "blue", "blue", "green", "green", "black", "yellow"), "start_date" = c("2005/01/01", "2006/01/01", "2007/01/01", "2008/01/01", "2009/01/01", "2010/01/01", "2011/01/01", "2012/01/01", "2013/01/01", "2014/01/01", "2015/01/01"), "end_date" = c("2005/09

ggplot2: Why is color order of geom_line() graphs reversed?

╄→гoц情女王★ 提交于 2021-01-01 07:23:55
问题 The code below plots a graph in which the names of the colors appear in the legend in the correct order, but the colors themselves appear in the reverse order. Why? year <- 2000:2009 a1 <- 4 + rnorm(10) a2 <- 3 + rnorm(10) a3 <- 2 + rnorm(10) a4 <- 0.25 * rnorm(10) vv <- tibble(year, a1, a2, a3, a4) test <- ggplot(data=vv) + aes(x=year) + geom_line(aes(y = a1, colour= "blue")) + geom_line(aes(y = a2, colour= "green")) + geom_line(aes(y = a3, colour= "yellow")) + geom_line(aes(y = a4, colour=

ggplot2: Why is color order of geom_line() graphs reversed?

雨燕双飞 提交于 2021-01-01 07:22:26
问题 The code below plots a graph in which the names of the colors appear in the legend in the correct order, but the colors themselves appear in the reverse order. Why? year <- 2000:2009 a1 <- 4 + rnorm(10) a2 <- 3 + rnorm(10) a3 <- 2 + rnorm(10) a4 <- 0.25 * rnorm(10) vv <- tibble(year, a1, a2, a3, a4) test <- ggplot(data=vv) + aes(x=year) + geom_line(aes(y = a1, colour= "blue")) + geom_line(aes(y = a2, colour= "green")) + geom_line(aes(y = a3, colour= "yellow")) + geom_line(aes(y = a4, colour=