barplot ggplot with bars filled by values of another df

Hi would to create a barplot like this but the bars should by filled by the values of this plot, leaving the rest in a color like gray or black: To produce the barplots I used: > table Var1 Freq 1 H3K27ac 72 2 H3K27me3 72 3 H3K36me3 72 4 H3K4me1 72 5 H3K4me2 66… Read More barplot ggplot with bars filled by values of another df

How to set default size for `geom_line` in ggplot?

I want to change the default thickness of geom_line using the size aesthetic. This question has already been answered here but the solution – to set the default value using update_geom_defaults does not work for me. Here’s a minimum reproducible example: library(tidyverse) update_geom_defaults("line", list(size = 2)) data(ChickWeight) ChickWeight %>% filter(Chick %in% c("1", "2", "3")) %>%… Read More How to set default size for `geom_line` in ggplot?

How do I connect geom_points for ID when col is not ID in ggplot?

I’m trying to make a ggplot (in Shiny): I have concentration-time data that I want to visualize. There’s an option for the user to colour different groups in the plot, for example, Species, Antibodies, etc. However, I also want them to see the different concentration-time graphs for every ID, so what I actually want to… Read More How do I connect geom_points for ID when col is not ID in ggplot?

Why does scale_x_discrete recycle data?

Given this data: library(tidyverse) library(ggplot2) library(ggtext) df <- structure( list( variable = c( "var1", "var1", "var1", "var2", "var2", "var2", "var3", "var3", "var3", "var4", "var4", "var4" ), gruppe = structure( c(1L, 7L, 16L, 1L, 7L, 16L, 1L, 7L, 16L, 1L, 7L, 16L), levels = c( "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK",… Read More Why does scale_x_discrete recycle data?

How to change bars colors with scale_fill_manual() in R?

I want my bars to correspond to a legend and to have them colored with my own color, not the default one. # library library(ggplot2) # create a dataset specie <- c(rep("IFNg_WNH", 2) , rep("IFNg_AA", 2), rep("IL1b_WNH", 2), rep("IL1b_AA", 2), rep("IL6_WNH", 2), rep("IL6_AA", 2) ) condition <- rep(c("down", "up"), 6) value <- c(452,216, 348,327, 207,61,… Read More How to change bars colors with scale_fill_manual() in R?

Creating a line graph with ggplot2 to show count change over time

I have a dataset that includes two columns: CaptureTime and Count. The CaptureTime column includes timestamps of when the count was recorded, and the Count column includes the actual count at that time. CaptureTime Count 2023/01/21 03:40:33 257692746 2023/01/21 03:41:03 258058244 2023/01/21 03:41:33 258410404 2023/01/21 03:42:03 258737938 2023/01/21 03:42:33 259092123 2023/01/21 03:43:03 259465642 2023/01/21 03:43:33… Read More Creating a line graph with ggplot2 to show count change over time

Change symbol and fill in scale_size_continuous()

I am trying to change the symbol type (to triangle), it’s fill (to NA), and border (to black) for scale_size_continuous() in ggplot2. I would like to keep the two legends. I can’t seem to figure it out. Here is some example data: data <- structure(list(date = structure(c(1431388800, 1444780800, 1456876800, 1469145600, 1469664000, 1425081600, 1445299200, 1488758400, 1524960000,… Read More Change symbol and fill in scale_size_continuous()

How to show lines when using ylim()?

I’m generating a plot with this code: BPL2.0.5op <- subset(ambiental2021, dependencia=="BPL2.sala" & tipo.control=="NV") BPL2.0.5op <- BPL2.0.5op[!is.na(BPL2.0.5op[,"part.0.5"]),] BPL2.0.5op$punto <- naturalsort::naturalfactor(paste("Punto", BPL2.0.5op$punto, sep=".")) ggplot(BPL2.0.5op, aes(x=fecha, y=part.0.5, group = punto, fill = punto)) + geom_point(aes(colour = punto), size = 1.5) + geom_line(aes(colour = punto), linetype = 1, size = 1) + theme(plot.title = element_text(size = 20, face =… Read More How to show lines when using ylim()?