(aka Geometric objects in r ) A geom is the geometrical object that a plot uses to represent data in r. A ggplot2 geom tells the plot how you want to display your data in R. A geom defines the layout of a ggplot2 layer. People often describe plots by the type of geom that the plot uses. For example, bar charts use bar geoms, line charts use line geoms, boxplots use boxplot geoms, and so on.
Questions tagged [geom]
224 questions
0
votes
0 answers
Shortest distance between line and line segment (3D)
I found this code for calculate distance between line and line segment.
We are check if segment and line are not parallel and find parameters for parametric equation where distance between segment and line will be minimal. But i dont understand how…

hitebi
- 3
- 2
0
votes
1 answer
Using geom_signif to add a significant layer for a barplot for two treatments
I want to use geom_signif to create a significant layer in my barplot like the bar graph I have attached, I just want to compare the difference from pre to post-test within a workspace (i.e, MID, NMC, and CML). For example, just comparing pre and…

Reuben Newton Addison
- 349
- 1
- 10
0
votes
1 answer
Omitting NA values from ggplot when using multiple dataframes to plot multiple lines
My dataframes sometimes contain NA values. These were previously blanks, characters like 'BAD' or actual 'NA' characters from the imported .csv file. I have changed everything in my dataframes to numeric - this changes all non-numeric characters to…

WilldoesR
- 33
- 4
0
votes
2 answers
ggplot2: scatterplot with two variables (measured on the same scale) on the y-axis: how do I change the aesthetics & add seperate regression lines?
For my thesis, I am making scatterplots in APA format in R.
So far, my code is as follows, and it works great for plotting just one variable with confidence interval and regression line:
scatterplot=ggplot(dat, aes(x=STAIT, y=valence))+
…

Eva Beunk
- 3
- 3
0
votes
0 answers
Overlapping lines in plot (ggplot2)
I'd like some help to create a similar plot like image 2. I don't know if the problem it's my data or code. But as you can see in the first graphic there is an overlap and I'd want a graphic more soft as a second image.
On the other hand. Could…

Rafa Mesa
- 55
- 7
0
votes
1 answer
R - ggplot2 - Unable to see the standard error range doing a double geom_smooth() on a graph with two y axis
I am struggling a lot to fix an issue with R. I like to make a graph, with two y variables, referring to two different y axis. Everything is working but I am not able to obtain the dark gray area of the error bands. I am not able to understand the…

GiacomoDB
- 369
- 1
- 10
0
votes
1 answer
Dropping data outside valid range when using geom_ma in scatterplot
I have four categories that I am plotting her using ggplot. I would like add a moving average using geom_ma but I have too few of the green dots to get a good moving average (I would prefer a period of at least 20). How can I keep the scatterplot as…

Natty
- 1
0
votes
1 answer
Adding images to R plots using ggplot2 and ggpattern - image is missing?
I am using the ggpattern package in R for the first time and I can't get the image to work in my plot. A simplified version of my code is here:
x = seq(-1.5, 3.5, 0.1)
y = c( rep(1.0, 22), rep(0.2, 12), rep(0.7, 7), rep(1,10))
ref = data.frame(x =…

Chelsey Beese
- 3
- 1
0
votes
1 answer
How can I change linetype in geom_quantile based on different quantiles?
I would like to change the line type in geom_quantile to have different types of line based on the quantile. Adding linetype = "" applies the same line type to different quantiles. Instead, I would like to have a solid line for .5, dashed line for…

user14514023
- 7
- 3
0
votes
1 answer
Hexagon and heat style Density Plots in R
I'm attempting to create an image that shows error of machines vs temperature and humidity. After reading a paper (see image below), it seems like the best route to go is a hexagon or density plot to show these errors. My issue is that every time I…

Adam_Eire_2020
- 22
- 2
0
votes
0 answers
How to replicate vioplot in geom_violin?
I want to make a violin plot using geom_violin that mimics the structure of violin plots. i.e. it shows 95% confidence interval, interquartile range and median within the desnity plots.
I am trying to do this but only getting median points and…

Lily Sharpton
- 149
- 1
- 6
0
votes
1 answer
How to swap lat long values of geom type cloumn in postgresql
update place_tab_25062020 SET ST_Y(location) = ST_X(location), ST_X(location) = ST_Y(location) WHERE ST_Y(location)<35 and ST_Y(location)>0;
I have location as geom i need to swap its lat long values
0
votes
1 answer
saving multiple ggplot in a single pdf documents in R?
Is there a way to save all the plots as a single pdf document
library(tidyverse)
library(lubridate)
set.seed(123)
DF1 <- data.frame(Date = seq(as.Date("2001-01-01"), to= as.Date("2003-12-31"), by="day"),
A = runif(1095, 0,10),
…

Hydro
- 1,057
- 12
- 25
0
votes
1 answer
Dots disconnected from lines when using geom_path and geom_point .Fixed but I get No summary function supplied, defaulting to `mean_se()
I have the following data:
structure(list(Expo = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L), .Label = c("DC", "DI"),…

genferreri
- 123
- 7
0
votes
1 answer
How do I using scale_y_datetime breaks time 1 hours
How do I using scale_y_datetime breaks time 1 hours.
Data Power Bi
Date Start Stop Threshold
01-Jun-20 23:10 3:53 07:00
02-Jun-20 23:09 3:46 07:00
03-Jun-20 23:09 3:34 07:00
04-Jun-20 23:07 3:55 07:00
05-Jun-20 …

EiEi
- 3
- 2