Questions tagged [geom-segment]
44 questions
1
vote
0 answers
ggplot2 can I stack horizontal goem_segments?
The code below produces a gantt chart, time on each project by person. It's done in two layers where the black bars are 100% of a persons time and the coloured bars represent time on projects.
What I'd like is the project bars stacked like the image…

JohnC
- 15
- 3
1
vote
1 answer
How can I make this ggplot render more quickly?
Below is a reprex of the data I'm working with. The geom_segment calls make the rendering very sluggish. Is there an alternate way to achieve the same result more quickly?
library(ggplot2)
library(ggridges)
n <- 5000; l <- c(2, 5, 7, 9); sd_27 <-…

saheed
- 340
- 2
- 12
1
vote
1 answer
How do I place insets at exact positions on a ggplot and set the colors of geom_segment?
I'm creating an illustration of how loess works. My two queries are at the end of this question. First, setup:
library(tidyverse)
data(melanoma, package = "lattice")
mela <- as_tibble(melanoma)
tric = function(x) if_else(abs(x) < 1, (1 -…

mk9y
- 320
- 2
- 11
0
votes
0 answers
Dose-response curve, geom_segment
When use the function of scale_x_continuous, geom_segment of y axis dose not working. (x=coefs["e"], y=y50, xend=0, yend=y50)
Wheon use the function of scale_x_log10, it dose work but x axis labels are very weird. So I want to use…

Hayoung Kwon
- 1
- 1
0
votes
1 answer
Phase diagram with vertical lines connecting discrete phases or states
I draw a state diagram using ggplot2 in R. The discrete vertical axis shows several states, and the horizontal axis shows time. Lines connect the start and end points of a phase, with different colours per state. Here is an…

Philip Leifeld
- 2,253
- 15
- 24
0
votes
0 answers
Removed 2 rows containing missing values (`geom_segment()`) while there are no missing values in data
I am plotting results from Redundancy analysis using ggplot and I got a warning:
Removed 2 rows containing missing values (`geom_segment()`).
This warning lead to the missing two arrows in the figure (for variable "Family labor" and "Hired…

Jie SU
- 1
- 1
0
votes
2 answers
Add leading lines / geom segment to pie graph with ggplot2
I have a pie graph that I've generated with ggplot2. However, some of the wedges are quite thin, so I wanted to place the annotations outside the pie graph and add leading lines. I've succeeded in placing the annotations outside of the graph, but I…

becbot
- 151
- 1
- 2
- 9
0
votes
2 answers
How to deal with time series data to create new x and y axis lines to ggplot graph?
I'm trying to present a ggplot graph similar to Base R graphs. The issue I have is dealing with time series data (date and time) to draw the x and y axis properly.
I used the same approach provided by Baptiste to create an x and y axis function:…

kpm
- 53
- 5
0
votes
2 answers
geom_segments of different size produce weird legend
I have a figure with geom_segments of different size. The legend superposes dashes and dots of different sizes. How to prevent that?
Reproductible example:
dataframe = data.frame(country = c("Burundi", "Kenya"),
rate1 = c(10,…

Antoine D
- 21
- 2
0
votes
1 answer
ggplot2 not printing the colours specified inthe dataframe and set as factor levels
I am trying to reproduce a map from W.E.B DuBois with the original colors and values with thin black arrows in each state starting at the bottom right corner of the state polygon and pointing to the centroid of the state. I have 2 issues 1) ggplot2…

Patrick Stephenson
- 88
- 5
0
votes
0 answers
How link two variable for one individual in ggplot2?
I have an issue on how to display segment with geom_segment in ggplot graph. I have individuals which are measurements on height and body mass related to Age, and after making a plot I would like to link those two variables (height and body mass) to…

hohugu
- 1
- 1
0
votes
1 answer
Adding Consecutive Arrows to geom_point() in ggplot2
I want to add a series of arrows connecting each observation in geom_point as in the graph:
I understand that geom_segment is meant to be used, but I am having issues, and have not found something quite like this after quite a bit of…

PTS390
- 33
- 1
- 2
- 12
0
votes
1 answer
ggplot segments with dash dash/ vertical line
I am doing a plot similar to this…

user3483060
- 337
- 2
- 13
0
votes
1 answer
R: Hide geom_segment() if a certain condition is true?
I use geom_segment() from ggplot2 package in R, where the data attribute is a vector with two elements. The segment is an arrow. I want to hide the segment if one of the elements of the data vector equals 0. Is there a way to only plot the segment…

winnewoerp
- 161
- 6
0
votes
0 answers
Dodge Effect with geom_segment
I have the following dataset where I am visualizing a range comparison for different features between two model types in ggplot2 with geom_segment.
test <- data.frame("var" = c("apple", "apple", "banana", "banana", "pear", "pear"),
…

bshelt141
- 1,183
- 15
- 31