Questions tagged [geom-segment]

44 questions
0
votes
1 answer

Add linetype to geom_segment legend

Aim: add the linetypes of the segments to the legend, as well as the colour. Problem: only the colour is showing. Data: m = as.data.frame(matrix(c(1:10), ncol = 2, nrow = 10)) Plot: ggplot(m, aes(v1,v2)) + geom_segment(aes(x = 0, xend = 9.75, y =…
Paul
  • 5
  • 3
0
votes
1 answer

Adjust yend in geom_segment when x is categorical

I would like to adjust the vertical position of the geom_segment when x is categorical. In the example below the geom_segment is centered around the variable on the x-axis. I would like draw the segment starting on the line of the x-axis variable…
captcoma
  • 1,768
  • 13
  • 29
0
votes
1 answer

geom_segment not recognising factored x-axis

Aim: produce a bar plot representing a time series of measurements (variables) taken at 14 Sites (factors), including drawing horizontal lines to demonstrate benchmark levels for each site. Problem: As the site labels are discrete and not quite a…
Paul
  • 5
  • 3
0
votes
1 answer

Slightly change geom_segment's position of x only, but keep position of xend constant

I want to draw a bar chart with three columns, where two arrows start from one column to the other two columns and these arrows do not overlap each other, as shown below. I managed to produce the chart and I used geom_segments to draw the arrows.…
Carlos Luis Rivera
  • 3,108
  • 18
  • 45
0
votes
1 answer

ggplot2 geom_point with aes fill only displays black

I'm having trouble displaying different fill colors with geom_point, only black shows up. I know I can use color to show different colors but it doesn't seem to work well with geom_segment. Here is an example what I'm getting, where the points are…
user2272972
  • 131
  • 1
  • 11
0
votes
1 answer

Adding a gap in geom_segment in ggplot2

I have some data with id, time_to_event, event, therapy start and therapy stop variables. Here is a reproducible example: data <- structure(list(id = structure(c(1L, 3L, 9L, 2L, 5L, 10L, 7L, 8L, 4L, 6L), .Label = c("1", "4", "2", "9", "5", "10",…
fbeese
  • 118
  • 8
0
votes
0 answers

geom_segment reaching over multiple facets

I am trying to draw a line with R's ggplot that starts on one facet and ends on another. I believe this question was not asked yet (at least I could not find it) but I have found some example code that achieves exactly this:…
okost
  • 181
  • 9
0
votes
1 answer

Can ggplot2 geom_segment size be specified as a proportion of the axis size?

I have a geom_segment in a plot and would like its size to scale relative to the y axis. For example: iris %>% group_by(Species) %>% summarise(avg_sepal_length = mean(Sepal.Length)) %>% ggplot(aes(x = Species, y = avg_sepal_length)) + …
dankshan
  • 55
  • 5
0
votes
1 answer

geom_segment - parallel dodging

I am having a 'classical' ggplot problem, very similar to the question discussed here. I tried to solve it like suggested there, but somehow it does not work. The dataset is: overall <- structure(list(organization = c("orga_arts", "orga_arts",…
Erdne Htábrob
  • 819
  • 11
  • 29
0
votes
1 answer

How can I connect multiple points by group with geom_segment() in ggplot2?

Im trying to connect my points with a line, like this, but for my plot: My plot looks like this: I've tried to use geom_segment but it hasn't worked. My base code is: ggplot(tidydf, aes(Genome_size, `Trio_number`, color = Group)) + …
Meems
  • 91
  • 1
  • 7
0
votes
0 answers

Combine geom_bar, geom_segment and facet_grid on time series visualization

I'm trying to do a nice graph with ggplot but I'm still faces a barrier. When I use facet_grid at the end of my code, somethings wrong happen. A helping hand would be great! This is my code : # Package library(ggplot2) # Function firstup <-…
0
votes
1 answer

Using Geom_Segment in R

I am trying to create a plot in R using Geom_Segment. I am stuck with an error that says I need to input yend but I am inputting it already... this is my code: library(ggplot2)…
Natalie
  • 1
  • 1
  • 2
0
votes
0 answers

geom_segment arrowhead off-centered

I am using geom_segment arrows and I have a few issues I am searching for advice to correct. First, the arrow head is off center on its line. Second, the "main" line of the segment pokes through the arrow head if lineend is set to "butt" or…
Andre
  • 101
  • 4
-1
votes
1 answer

Geom_segment not reading missing aesthetics: x, y, xend and yend Piper Plot

I am trying to reproduce the Piper plot here: https://github.com/markolipka/ggplot_Piper however I keep getting the error: Error: geom_segment requires the following missing aesthetics: x, y, xend and yend despite x, y, xend and yend being specified…
blueash
  • 1
  • 1
1 2
3