ggplot2

How can I rotate labels in ggplot2? [duplicate]

做~自己de王妃 提交于 2021-02-10 05:33:09
问题 This question already has an answer here : How to use angle in geom_label? (1 answer) Closed 7 hours ago . I have a scatter graph with lables. I want to rotate lables - instead of horizontal position I want to see them vertically. I only saw q-s about rotating axis lables on Stackoverflow. Sample: mtdata <- mtcars %>% rownames_to_column(var = "name") ggplot(mtdata, aes(x = mpg, y = wt)) + geom_point() + geom_label(data = mtdata %>% filter(mpg > 20 & wt >3), aes(label = name)) 回答1: You can use

Convert English numbers to Persian numbers for ggplot

守給你的承諾、 提交于 2021-02-10 04:16:14
问题 The bounty expires in 3 days . Answers to this question are eligible for a +50 reputation bounty. markus wants to draw more attention to this question. I am working on a data visualization project using ggplot2 . All numbers obtained in the plot (Includes axis-x and axis-y and numbers inside the plot) are in English format like the below plot: but I want the numbers in all plots to be Persian (e.g., ۲۰۱۵ instead of 2015). I have many plots with different numbers. Can anyone help me to convert

Convert English numbers to Persian numbers for ggplot

删除回忆录丶 提交于 2021-02-10 04:14:48
问题 The bounty expires in 3 days . Answers to this question are eligible for a +50 reputation bounty. markus wants to draw more attention to this question. I am working on a data visualization project using ggplot2 . All numbers obtained in the plot (Includes axis-x and axis-y and numbers inside the plot) are in English format like the below plot: but I want the numbers in all plots to be Persian (e.g., ۲۰۱۵ instead of 2015). I have many plots with different numbers. Can anyone help me to convert

Combine and merge legends in ggplot2 with patchwork

和自甴很熟 提交于 2021-02-09 19:34:25
问题 I would like to combine two or more plots merging their legends. For example, I can create some data and two scenarios as follows. # packages library(ggplot2) library(patchwork) # first plot set.seed(07042020) x <- runif(50) y <- runif(50) data1 <- data.frame(x = x, y = y, z = runif(50, 0, 2)) p1 <- ggplot(data1) + geom_point(aes(x, y, col = z)) p1 data2 <- data.frame(x = x, y = y, z = runif(50, -1, 1)) p2 <- ggplot(data2) + geom_point(aes(x, y, col = z)) p2 The following code is what I tried

Combine and merge legends in ggplot2 with patchwork

牧云@^-^@ 提交于 2021-02-09 19:31:39
问题 I would like to combine two or more plots merging their legends. For example, I can create some data and two scenarios as follows. # packages library(ggplot2) library(patchwork) # first plot set.seed(07042020) x <- runif(50) y <- runif(50) data1 <- data.frame(x = x, y = y, z = runif(50, 0, 2)) p1 <- ggplot(data1) + geom_point(aes(x, y, col = z)) p1 data2 <- data.frame(x = x, y = y, z = runif(50, -1, 1)) p2 <- ggplot(data2) + geom_point(aes(x, y, col = z)) p2 The following code is what I tried

Combine and merge legends in ggplot2 with patchwork

谁说胖子不能爱 提交于 2021-02-09 19:30:00
问题 I would like to combine two or more plots merging their legends. For example, I can create some data and two scenarios as follows. # packages library(ggplot2) library(patchwork) # first plot set.seed(07042020) x <- runif(50) y <- runif(50) data1 <- data.frame(x = x, y = y, z = runif(50, 0, 2)) p1 <- ggplot(data1) + geom_point(aes(x, y, col = z)) p1 data2 <- data.frame(x = x, y = y, z = runif(50, -1, 1)) p2 <- ggplot(data2) + geom_point(aes(x, y, col = z)) p2 The following code is what I tried

Combine and merge legends in ggplot2 with patchwork

瘦欲@ 提交于 2021-02-09 19:28:48
问题 I would like to combine two or more plots merging their legends. For example, I can create some data and two scenarios as follows. # packages library(ggplot2) library(patchwork) # first plot set.seed(07042020) x <- runif(50) y <- runif(50) data1 <- data.frame(x = x, y = y, z = runif(50, 0, 2)) p1 <- ggplot(data1) + geom_point(aes(x, y, col = z)) p1 data2 <- data.frame(x = x, y = y, z = runif(50, -1, 1)) p2 <- ggplot(data2) + geom_point(aes(x, y, col = z)) p2 The following code is what I tried

Combine and merge legends in ggplot2 with patchwork

醉酒当歌 提交于 2021-02-09 19:25:18
问题 I would like to combine two or more plots merging their legends. For example, I can create some data and two scenarios as follows. # packages library(ggplot2) library(patchwork) # first plot set.seed(07042020) x <- runif(50) y <- runif(50) data1 <- data.frame(x = x, y = y, z = runif(50, 0, 2)) p1 <- ggplot(data1) + geom_point(aes(x, y, col = z)) p1 data2 <- data.frame(x = x, y = y, z = runif(50, -1, 1)) p2 <- ggplot(data2) + geom_point(aes(x, y, col = z)) p2 The following code is what I tried

ggsignif package error stat_signif requires the following missing aesthetics: y

半腔热情 提交于 2021-02-09 14:28:24
问题 This is an invented example of my data: x <- c("Control", "Case", "Case", "Case", "Control", "Control", "Control", "Case", "Case", "Case") y <- c("Dead", "Dead", "Dead", "Alive", "Alive", "Dead", "Dead", "Dead", "Alive", "Dead") I'm trying to represent this data in the form of a bar plot and then indicate a statistically significant difference in the proportion of alive and dead patients between the two experimental groups (cases and controls). I performed a Pearson's chi square test and the

ggsignif package error stat_signif requires the following missing aesthetics: y

笑着哭i 提交于 2021-02-09 14:27:52
问题 This is an invented example of my data: x <- c("Control", "Case", "Case", "Case", "Control", "Control", "Control", "Case", "Case", "Case") y <- c("Dead", "Dead", "Dead", "Alive", "Alive", "Dead", "Dead", "Dead", "Alive", "Dead") I'm trying to represent this data in the form of a bar plot and then indicate a statistically significant difference in the proportion of alive and dead patients between the two experimental groups (cases and controls). I performed a Pearson's chi square test and the