(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
Problem of gaps in color gradient with geom_raster or geom_tile after y-axis scale transformation
I have a contour plot with gradient colour using geom_raster, which is ok.
However, when I try to Yeo-Johnson transform the y-axis scale, the color gradient shows colored bands with interspaced white bands instead of a continuous gradient. The…

denis
- 199
- 1
- 8
0
votes
0 answers
Legend Title of Bar Chart with theme()
I want to modify the title of the legend, instead of 'attacktype1_txt' I want 'Attack Types'.
When using the theme() function, I can not find any parameter to modify the content of the text, just the characteristics.
ggplot(data=gtd_top, aes( x =…

Humberto Hernandez
- 21
- 5
0
votes
1 answer
Multiple graphs have problem when use annotate
I have a data set (generated as below) and made 3 graphs G1, G2, G3 (codes are below). When I print a graph after creating it there is no problem. However, If I print them after all of them created, only the last graphs is ok but the first 2 have…

Seyit Ali KAYIŞ
- 1
- 2
0
votes
0 answers
animate() - Warning: Cannot get dimensions of plot table. Plot region might not be fixed
I am new to R, so bear with me if I dont upload this question exactly by the standard way to do it.
I am trying to create an animated chart, where a cat's face is located on the head of the line in the chart, as the chart is playing/printing…

Seemann
- 1
0
votes
0 answers
ggmap geom_polygon containing discrete shapes coming out as an inverted mess
I am trying to plot some polygons based on a data frame containing longitude and latitude gps data onto a map. They should look like this:
However the yellow plot on the map is how they turn out:
I am wondering if there is an argument I could add…

eddie582
- 1
- 2
0
votes
1 answer
Mismatch when using ggplot2 with a geom_point conditional fill
I am trying to have a white fill, for models where the p.fdr variable is <0.05.
However, the code I have written, is not modifying the correct point (the blue estimate should have a white fill not the pink estimate, as pictured below).
Example…

Katherine Drummond
- 33
- 3
0
votes
0 answers
How to use correctly geom_rect on R
I want to display rectangles like in the image below with their real sizes (each rectangle has a length "dl" and a width "dw")
ggplot() +
ggtitle("top+bot") +
geom_rect( data = grid, aes(xmin = grid["x"], xmax = grid["x"]+…

Eliaschf
- 1
0
votes
0 answers
Error in `geom_polypath()` Problem while converting geom to grob, Caused by error in `as.vector()`
I am trying to use geom_spatial_polygon but regardless of the dataset I use, if my data is numeric, integer, factor or character, or if I start the plot with basemap() or ggplot() I receive the following error: Problem while converting geom…

GenieV
- 33
- 5
0
votes
0 answers
Images blurry using geom_image
I'm trying to make a plot in R using ggplot and geom_image, but the images are too blurry for my liking. Is there something I can do?
I have tried to search for many different images and they all seem to suffer from the same problem.
ggplot(data =…

Jarett Payne
- 11
- 2
0
votes
1 answer
Legend for a plot with sec.axis (geom bar + geom line)
I have a ggplot with two y-axes by the sec.axis command, and I've been struggling with handling legends in these situations.
The code:
library(ggplot2)
library(ggrepel)
df <- data.frame(day = as.character(seq(from = 1, to = 100, by = 1)),
…

Bileobio
- 121
- 8
0
votes
1 answer
Geom_label_repel not properly referencing to the sec.axis
I am working with a ggplot that has two axis: one for the geom_bar component, and the other for the geom_linecomponent. And for this, I am using the sec.axis() command.
I wanted to insert a box to provide the last value of the geom_line component,…

Bileobio
- 121
- 8
0
votes
1 answer
how to change `TRUE` and `FALSE` labels in ggplot2 generated by geo_col?
the data: dput(gsea)
structure(list(ID = c("ab1", "ab2", "ab3", "ab4", "ab5", "ab6",
"ab7", "ab8", "ab9", "ab10", "ab11", "ab12", "ab13", "ab14",
"ab15", "ab16", "ab17", "ab18", "ab19", "ab20"), Count = c(183L,
37L, 15L, 30L, 38L, 98L, 49L,…
user2110417
0
votes
0 answers
Error in `annotate()`: ! Can't find geom called "table" Traceback:
I am trying to include table in the survival plot. but I get an error as
Error in `annotate()`:
! Can't find geom called "table"
Traceback:
1. annotate(geom = "table", x = 140, y = 0.9, label = list(as.data.frame(table)))
2. layer(geom = geom,…
user2110417
0
votes
0 answers
I'm trying to plot a bar graph with error bars but error bars are weird
I'm trying to plot and add error bars, and somehow today it decided to plot like this. I'm clearly missing something, what is wrong with these error bars?!
hits <- ggplot(coverage_data, aes(Phenotype, Hits, fill=Phenotype)) +
…

vschultzx
- 1
- 2
0
votes
1 answer
struggling with scaling a secondary axis on a plot that is not a percentage
I'm getting crazy here, please help me!
I'm new to R and this is why. I have a graph here in which I'm trying to plot steps given against time needed to fall asleep (in minutes) and I decided to plot user ID on the x axis and the other two variables…

Cabeça de Vento
- 1
- 1