Questions tagged [geom-hline]

59 questions
0
votes
1 answer

Error in split for mapply plotting of multiple plots

I am trying to split two dataframes to allow for production of multiple plots with mapply but cant get the outcome i need. I think it's got to do with the length of each split list being different but I cant work out how to fix it. The first df is…
CatN
  • 71
  • 7
0
votes
1 answer

Is there a way to add multiple horizontal lines to a plot with different symbology and a legent?

I need to add horizontal lines (similar to geom_hline) to a plot but retain the ability to add symbology (e.g. different dashed or dotted line) to each and have them appear in a legend. The y-intercept of each comes from the "Concentration" variable…
CatN
  • 71
  • 7
0
votes
1 answer

Adding geom_hline with mean data using for loop

I have the following dataset and I managed to write a for loop code to plot the 13 different cytokines (analyte). structure(list(studienr = c(1, 1, 1, 1, 1, 1), treat = structure(c(2L, 2L, 2L, 2L, 2L, 2L), levels = c("pre", "treat", "post", ">…
0
votes
1 answer

How to draw lines at each panel divided by facet_wrap() in R?

Here is one data variety<- c("CV1","CV1") trt<- c("N0","N1") yield<- c(100,150) dataA<- data.frame(variety,yield,trt) and I made a graph using facet_wrap() and drew lines. ggplot(data=dataA, aes(x=variety, y=yield))+ geom_bar(stat="identity",…
Jin.w.Kim
  • 599
  • 1
  • 4
  • 15
0
votes
1 answer

Creating geom_hlines for two variables with two groups

I'm struggling to get 4 total geom_hlines on the following plot: I want LDL cholesterol to have its own mean hline. Here's my code - any suggestions? I think it has to do with my errorbar but I can't figure out how to add LDL cholesterol in. …
0
votes
1 answer

When geom_vline is used, meridional lines cannot extend to the border of the figure under a non-WGS 84 projection

I want the grid lines to be displayed on top of the picture, so I tried to use geom_hline/geom_vline to do this, but it turned out that the vertical lines do not extend to the northern border of the picture. Is there anything I can do to…
Li Yupeng
  • 721
  • 4
  • 9
0
votes
1 answer

Why won't the geom_hline color be the color I selected?

I wrote the following code (changed the the data to mtcars). The problem is I want the line I put in which makes sense for the data I'm using to be green for the bottom line and red for the top line. No matter what I change the color to it doesn't…
trog12
  • 1
  • 1
0
votes
0 answers

Add horizontal lines from a vector to a ggplot uisng facet_grid

I would like to add several horizontal lines from a vector to all the plots using facet_grid on the same position The toy example is this one test <- c(1,2,3,4) test_L <- rep(NA, 146) lines <- c(test , test_L ) ggplot(iris, aes(x =…
Eric González
  • 465
  • 2
  • 10
0
votes
1 answer

Both geom_vline and geom_hline fails when faceting spatial map on ggplot2

I am really careful before posting this this question, in order to avoid any duplication. So I intended to create a faceting map based on quarter, equipped with both major and minor grid, whereas the latitude and longitude labels only on major grid.…
0
votes
1 answer

geom_hline ignoring colour aes for some reason

line_data <- data.frame(value = c(1,2), color = as.factor(c("blue", "green")) plot1 <- plot1 + geom_hline(aes(yintercept = value, colour = color), line_data, linetype = "dashed", size = 0.5) The above is a snippet of my code. No…
0
votes
1 answer

About adding/changing colors in ggplot2 (geom_hline)

data %>% ggplot() + geom_hline(aes(yintercept=Trial, col=Participant2)) + scale_color_discrete(name="NI-1", labels=c("False Alarm", "Hit", "Miss")) + theme_minimal() Is there a way to assign the following colors to the labels in the line…
0
votes
1 answer

Draw hline with facet_grid

I'd like to draw hline with facet_wrap. How can I add the 'reference value' of ref to each plot? I want to add reference lines for 'RdRp', 'E', 'N', 'S'. Both '4℃' and '22℃' use the same lines. For example, I want to draw a hline with…
Cell
  • 25
  • 4
0
votes
1 answer

How to remove sub-plot titles and tick values with ggplot

I am using ggplot2 to generate the plot below. For some reason, it introduces titles to subplots that I want to be removed. When I remove geom_hline() lines, it somehow removes them. However, I need those horizontal lines to denote boundaries. And…
0
votes
0 answers

Get coordinates of geom_hline interception

Is it possible to get the coordinates of the intersection of geom_hline in ggplot from the plot? The image below has a geom_hlline meeting with my line plot but I am hoping to get an exact x-value of the intercept. Please help. ggplot with…
0
votes
2 answers

How to add horizontal lines in different facets for 2x2 arrangements using ggplot2?

I have a database that was plotted and separated by facets. The facets of the first row (row a) need a horizontal line at 0.5, while the facets of the second row (row b) need a line at 1. I have already partially achieved my goal following this…
Daniel Valencia C.
  • 2,159
  • 2
  • 19
  • 38