ggplot2

R: How to Draw heat map divided by a digonal line?

时光总嘲笑我的痴心妄想 提交于 2021-02-10 23:51:02
问题 I came across this article on Nature Methods which provided a very nice heatmap: http://www.nature.com/nmeth/journal/v12/n4/full/nmeth.3311.html Different from other heat map is each rectangle is divided by a diagonal line, with 1 part represent the literature data and the other in-house data. I think this is a very nice way to compare the data. However, I do not know how to draw this pic in R. Does anyone have any clue on how to do this? A small screenshot is provided below: Below is a demo

R: How to Draw heat map divided by a digonal line?

元气小坏坏 提交于 2021-02-10 23:43:37
问题 I came across this article on Nature Methods which provided a very nice heatmap: http://www.nature.com/nmeth/journal/v12/n4/full/nmeth.3311.html Different from other heat map is each rectangle is divided by a diagonal line, with 1 part represent the literature data and the other in-house data. I think this is a very nice way to compare the data. However, I do not know how to draw this pic in R. Does anyone have any clue on how to do this? A small screenshot is provided below: Below is a demo

Error: Too few points to calculate an ellipse with 3 points? - R

梦想与她 提交于 2021-02-10 18:36:12
问题 G'day. I am plotting a pca with the factoextra package. I have 3 points for each factor and would like to draw ellipses around each. But I am getting the error Too few points to calculate an ellipse . It is possible to draw ellipses around 3 points in ggplot2 with the stat_ellipse function. I can confirm this by looking at the calculate_ellipse code from ggplot2 that says else if (dfd < 3) {message("Too few points to calculate an ellipse") . So what ellipse function is factoextra using in

ggforest function returns error message when used with coxph

强颜欢笑 提交于 2021-02-10 18:31:17
问题 when applying ggforest() to a coxph object I get the follwoing error message error in ggforest(res.cox3, data = Selection_cox) : class(model) == "coxph" are not all TRUE res.cox3 is the output of coxph() which includes a tt term, strata and is of class: > class(res.cox3) [1] "coxph.penal" "coxph" I get the same message for the following dummy data: set.seed(132456) 'dummy survival data' df<-data.frame(id=seq(1,1000,1), event=rep(0,1000),time=floor(runif(1000,7,10)),group=floor(runif(1000,0,2)

ggforest function returns error message when used with coxph

前提是你 提交于 2021-02-10 18:29:25
问题 when applying ggforest() to a coxph object I get the follwoing error message error in ggforest(res.cox3, data = Selection_cox) : class(model) == "coxph" are not all TRUE res.cox3 is the output of coxph() which includes a tt term, strata and is of class: > class(res.cox3) [1] "coxph.penal" "coxph" I get the same message for the following dummy data: set.seed(132456) 'dummy survival data' df<-data.frame(id=seq(1,1000,1), event=rep(0,1000),time=floor(runif(1000,7,10)),group=floor(runif(1000,0,2)

Graph bars only appear when lower limit of y axis set to 0 in ggplot

China☆狼群 提交于 2021-02-10 18:10:42
问题 I am trying to create a bar graph. When I set the limits as (0,7), the bars appear. However, I would like the lower limit to be 1, not 0. When I set the lower limit to 1, the bars do not appear. I get the following error message: Removed 8 rows containing missing values (geom_bar). It doesn't matter how I set the limits. I have used both of the following options: ylim(1, 7) scale_y_continuous(limits = c(1, 7)) Does anyone know how I can fix this? I'd like a graph that looks like this, but

Graph bars only appear when lower limit of y axis set to 0 in ggplot

半腔热情 提交于 2021-02-10 17:55:55
问题 I am trying to create a bar graph. When I set the limits as (0,7), the bars appear. However, I would like the lower limit to be 1, not 0. When I set the lower limit to 1, the bars do not appear. I get the following error message: Removed 8 rows containing missing values (geom_bar). It doesn't matter how I set the limits. I have used both of the following options: ylim(1, 7) scale_y_continuous(limits = c(1, 7)) Does anyone know how I can fix this? I'd like a graph that looks like this, but

Best way to format 500+ plots using facet wrap in R? [images & code included]

人盡茶涼 提交于 2021-02-10 17:48:00
问题 I am trying to display sales (y-axis) week over week (x-axis) for 890 vendors. I want to display this data using a facet wrap to quickly see where vendors are having a spike in sales. The plot in my RStudio console looks as such. This Makes sense, as rendering the plot here isnt the best view, however how can I properly format my plots onto a PDF even if it requires multiple pages of PDFs. Code for plot ggplot(Holiday_Spike_Table, aes(x = FSCL_WK, y = SLS))+ geom_col()+ facet_wrap(~MVNDR_NM)

Best way to format 500+ plots using facet wrap in R? [images & code included]

大城市里の小女人 提交于 2021-02-10 17:45:47
问题 I am trying to display sales (y-axis) week over week (x-axis) for 890 vendors. I want to display this data using a facet wrap to quickly see where vendors are having a spike in sales. The plot in my RStudio console looks as such. This Makes sense, as rendering the plot here isnt the best view, however how can I properly format my plots onto a PDF even if it requires multiple pages of PDFs. Code for plot ggplot(Holiday_Spike_Table, aes(x = FSCL_WK, y = SLS))+ geom_col()+ facet_wrap(~MVNDR_NM)

Geom_point putting dots at wrong values

大城市里の小女人 提交于 2021-02-10 16:17:44
问题 I have the following data, with which I'm trying to make a pretty simple line plot with dots. For some reason, the first three points of 2015 get placed with a value above 1600 when their value is around 1300. dput(data) structure(list(y_value = c(1143L, 1133L, 1148L, 1155L, 1149L, 1144L, 1181L, 1164L, 1178L, 1173L, 1176L, 1209L, 1284L, 1286L, 1283L, 1288L, 1362L, 1396L, 1599L, 1583L, 1606L, 1645L, 1653L, 1662L), Date = c("2014-1", "2014-2", "2014-3", "2014-4", "2014-5", "2014-6", "2014-7",