(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
1 answer
Trying to only display two decades on axis of box-plot in R
Hi!
This is how my plot looks at the moment...
Want to try and only display decades 1980 and 2010 in my box plots.
This is how my code looks now:
gender_race_income <- ggplot(data = gender_pay_gap, aes(x = factor(decade), y = income, colour
…

Hrogz
- 11
- 2
0
votes
1 answer
after adding geom_text_repel, "Error: Invalid input: time_trans works with objects of class POSIXct only"
I have tried adding a label to one set of points (lnrmssd) on my ggplot chart, but when I used the geom_text_repel function the graph will not appear. If I remove it the graph appears as it should. I have tried a few different variations from…

hogballs96
- 37
- 3
0
votes
1 answer
Obtaining geom_line values at mid-month for unequally spread geom_points
I need to obtain value at 15th of every month from the geom line created using the reproducible example below. The original geom points are at varied monthly dates depending on data collection days. Appreciate any help possible
Value <- c(19.14104,…

SamV
- 118
- 1
- 7
0
votes
0 answers
Interrupted or no ribbon ggplot geomribbon or stat_summary
I have a df that looks like this:
ID Genotype Time10min N mean sd se ci
43 1 k_DMSO 43 10 0.029318750 0.009793853 0.0030970883 0.007006100
44 1 k_DMSO 44 10 0.008825716 0.005164837…

Tahnee
- 77
- 5
0
votes
2 answers
How to plot worldmap in R
I'm working on a project and a small part of it consists of drawing a world map with 43 countries on my list. My dataset is as follows:
How do I put this on the world map with different colors for development status as follows?
Data is here…

Murat Efe.
- 13
- 3
0
votes
1 answer
Geom_line between all points
I want a line between all my detections points, how can I get this?
When I run:
AT.data_posisjon %>%
filter(ID %in% Tag_84) %>%
ggplot(aes(x=DateTime,y=Array,color=Section))+
geom_point()+
geom_line()
I got only line between points in the…
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…

Bear Bile Farming is Torture
- 4,317
- 4
- 27
- 61
0
votes
1 answer
Cohesively combine and alter the dimensions of two figures on the same y axis in ggplot()
I am attempting to accomplish two tasks:
Cohesively combine two figures that share the same y axis, but one which has a categorical x axis variable and the other that has a continuous x axis variable. I would like to display them as contiguous,…

Cameron
- 164
- 14
0
votes
0 answers
Looking to create a map for a county similar to the Indicators of Broadband Need map by the NTIA in R
https://broadbandusa.maps.arcgis.com/apps/webappviewer/index.html?id=e2b4907376b548f892672ef6afbc0da5
Looking to create a map similar to this one in R for a county. I have the shapefiles for each (FCC, ACS, and Ookla), but when I try to create a new…

C. White
- 1
0
votes
0 answers
ordering multiple legends - changes legend style
I have a plot with a coloured background (geom_rect) and a coloured line (geom_line). I am trying to maintain consistent legend order: o2 above temperature, or temperature above o2. The key is consistency.
I have tried using guides(col =…

R student
- 109
- 6
0
votes
0 answers
Is there an r function to add p-value, R-squared and r to a geom_smooth?
I wonder how to get statistical data of a ggplot with geom_smooth. I tried with stat_cor but I am not sure if its the right values for the line from geom_smooth and I don't know how to add r-squared. In the best case I would like to have summary…

Paul
- 1
- 1
0
votes
1 answer
Problem with stat_summary using group interaction and geom boxplot
I'd like to ggplot 3 pairs (factor x0) of 2 conditions (factor cond0), using boxplots with specific quantile limits.
The 2 problems are:
There are 3 groups in condition A (red), but only 2 groups in condition B (blue). Since group 1B is missing,…

denis
- 199
- 1
- 8
0
votes
2 answers
How do I remove legend/grid without using theme_void()?
Here I have theme_light() but in the plot I still have the x/y axis & legend + grid. I want to remove those and only have my light background + plot 'pic'. When I use theme_void -> it removes the legend but then the background is void. Any idea how…

Amouda love
- 3
- 3
0
votes
0 answers
How to prevent combining 2 boxplots into 1 on ggplot
I am trying to create a plot with 6 panels showing two boxplots (representing the effect of injury (1 = presence of injury, 0 = absence of injury). The closest I have gotten is this:
ggplot(cell_measurement, aes(Injury, Acceleration_mean)) +
…

user345995
- 1
- 2
0
votes
1 answer
How show some points on a map in R
I used this code in R in order to show a map.
library(maps)
library(raster)
library(rgeos)
library(ggplot2)
library(dplyr)
# Iran map
iran <- getData("GADM", country = "Iran", level = 1)
mymap <- fortify(iran)
mymap$id <- as.integer(mymap$id)
dat…

Alexander
- 39
- 6