Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [geom]

(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.

geom
0 votes
1 answer
40 views

In below `geom_smooth` how to make line fluctuate match with original data

In below geom_smooth, the line year 2023 is smoother than year 2024, but the 2023 amount SD is 20 lager then 2024 15. How to fix it? library(tidyverse) df_2023 <- data.frame(mdate =seq.Date(from=...
anderwyang's user avatar
  • 2,281
0 votes
1 answer
30 views

Sorting calendar plot with geom_segment() + fix scale

I am trying to do this calendar ggplot2. So far, it works fine, but I want to make two adjustments, and I am not finding the way: I want to arrange every segment within each year and num_months, so ...
Paula's user avatar
  • 679
0 votes
1 answer
22 views

change symbol in ggplot2 legend, with geom_line?

the question is quite straightforward and yet i can't find a solution. how do i change the legend symbol, for a geom_line(), into something that is actually readable? i found this post which is ...
gabt's user avatar
  • 774
1 vote
1 answer
33 views

Calendar plot with geom_segment() [closed]

I have the following dataset in R. I aim to do a ggplot where the scale goes from 1 to 12 (January, February, ..., December) in the x-axis, and the y-axis goes from 1 to 6 ( num_months variable [in ...
Paula's user avatar
  • 679
1 vote
2 answers
57 views

function for geom_point to increase the scale_size

LATER EDIT: I finally figured out how to do it. It works with the following code: legend_size <- c(6,5,4,3,2,1,0,1,2,3,4,5,6) tt <- data.frame(x = c(27.9656, 27.1704, 26.2128 ,23.5634 ,25.3528 ...
Alex.V's user avatar
  • 55
1 vote
0 answers
94 views

ggplot2 error: "`unit()`: ! 'x' and 'units' must have length > 0" (::grid package in R)?

I'm trying to create a custom ggplot2 geom called geom_geoheat, but I'm running into an error when converting the geom to a grob. I am using ggprotos of GeomTile and GeomRect (where tile inherits most ...
nostrum's user avatar
  • 11
0 votes
1 answer
29 views

Creating geom_violin plot with pre-created density values

I have created some weighted Kernal density estimates across different factor levels which I don't think can be incorporated within geom_violin plot estimates. I was wondering if there's a way ...
James White's user avatar
0 votes
1 answer
33 views

Custom emojis / shapes in ggplot failing to render, show up as rectangles

I am trying to play around with custom icons for my ggplot, and found a useful post that included the following code. However, when I run this, I don't see hearts. library(ggplot2) df <- read....
Em Reit's user avatar
1 vote
1 answer
54 views

what's diffrent of geom_histogram about statistical transformations

i have no idea with the difference between statistical transformations about plot1 and plot2 ? plot1 <- ggplot(mpg, aes(x = hwy)) + geom_histogram(stat = "density") plot2 <-ggplot(...
kschen's user avatar
  • 13
0 votes
1 answer
47 views

How to show labels at front and last points after geom_smooth using geom_dl?

This question refers to generic problem but my code set is very much different and most of the solutions give are basically work-around. So, I also need a little help in tagging lables next to ...
ambrish dhaka's user avatar
0 votes
0 answers
26 views

How to Change ggplot_add() Message Behavior

Background I am writing a ggplot2 extension and wish to make use of ggplot_add() with a custom method so that I can influence behavior down the ggplot chain while referencing information from up the ...
rsh52's user avatar
  • 79
1 vote
1 answer
38 views

Maps & scale_*_manual for multiple geom types (geom_polygon & geom_pattern_polygon)

I am trying to create a map where only counties with missing data have a striped pattern. Ideally, the background of this pattern would be white and the stripes would be blue, but I have gotten ...
sstewart's user avatar
0 votes
1 answer
29 views

How do I label dots in scatter by selected names from the data [duplicate]

I want to label only custom selected dots, "which is randomly taken without any specific criteria", in scatter plot. I tried: ggplot(mtcars, aes(x=wt, y=mpg)) + geom_text(label=rownames(...
nicholaspooran's user avatar
0 votes
1 answer
56 views

geom_sf does not match layer for geom_point

I am trying to map a variable uisng GGplot, but the layers don't match is there a way I can fix this so they match? ggplot() + geom_sf(data = sf_data) + geom_point(data=point_data,aes(x, y)) I ...
cheezeduckies's user avatar
3 votes
1 answer
74 views

Trying to create continent map for South America but geom_polygon produces zigzag fill

I try to do this ggplot: library (sf) library(dplyr) library(ggplot2) continents.f.xy <- st_zm(continents.f) continents_map_SA <- continents.f.xy%>% dplyr::bind_rows() %>% #bind the ...
Leprechault's user avatar
  • 1,709

15 30 50 per page
1
2 3 4 5
18