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.

224 questions
0
votes
0 answers

Show lines from another dataset over boxplots

I am trying to superimpose a line from a different dataset that has the same structure as the data from which boxplots are generated. I have the following code ggplot() + geom_boxplot(allcoefs, mapping = aes(x = variable, y = value, col= kind),…
mankojag
  • 61
  • 5
0
votes
0 answers

width parameter of geom_violin creates white space below geom_area in ggplot

Hellohello, I've been constructing a graph in ggplot. Its a jitter and a violin plot on top of an area plot. However, once I added the parameter width = ..., the area only starts a bit on top of the x- axis for no reason. This is my ggplot…
Karoline
  • 19
  • 4
0
votes
0 answers

geom_col: width = NULL, na.rm = FALSE stat_identity: na.rm = FALSE position_fill

Why does this error appear to me? Thanks for your help!! I want to visualize with a bar chart the sum of the GDP of the countries of the region by decade, i run this code: gap_decade%>% group_by(decade, region)%>% summarise(gdp=sum(gdp))%>% …
0
votes
0 answers

Removed 20 rows containing missing values (geom_segment)?

I don't know why it is giving the waring message of Removed 20 rows containing missing values (geom_segment). I have checked for NA's using sum(is.na(BS_cell_228)) and answer is 0 and maxium data point is 72 on y-axis. I tried coord_cartesian(ylim =…
0
votes
2 answers

change line colour ggplot (geom_line)

I still very new using GGPLOT, but ive created the following graphic in which i would like to switch the colors blue and red. Should be simple enough but i cannot figure it out. df <- structure(list(Sex = c("M", "M", "M", "M", "M", "M", "M", "W",…
RvS
  • 149
  • 8
0
votes
1 answer

How to plot standard deviation in a two way y axis plot in r?

My data looks like this: dput(NDVI) structure(list(date = structure(c(19091, 19091, 19092, 19092, 19093, 19093, 19094, 19094, 19095, 19095, 19096, 19096, 19097, 19097, 19098, 19098, 19099, 19099, 19100, 19100, 19101, 19101, 19102, 19102, 19103,…
Cláudio Siva
  • 502
  • 2
  • 10
0
votes
1 answer

How to add a legend to ggplot in R?

I'm trying to add a legend to my graph which consists of two lines. Unfortunately, I don't understand how. Could you help me out, please? My dataframe can be found below. Thank you. # dput(df) structure(list(t = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),…
TFT
  • 129
  • 10
0
votes
2 answers

Plotting latitude and longitude points in r

I am really struggling plotting these spatial data points in r. I have tried using ggmap, sf, and sp but I can't get it to cooperate with me. I have a table, tbl, that has the following makeup: tbl | lat | long | alive| species| where lat and long…
Cole
  • 15
  • 3
0
votes
2 answers

Geom_line() in ggplot2 is not working as expected for a simple dataset. What is going on?

I'm trying to create a simple line plot in ggplot2 with a dataframe, but the results aren't appearing as expected. Here is the code to reproduce the data: tograph<-data.frame(PANEL=13:22,total=c(10,20,30,40,50,60,70,80,90,100)) And when I graph the…
grajase
  • 3
  • 2
0
votes
1 answer

How to remove whitespace between bars in geom bar ggplot2

I would like to remove unnecessary white space in the following plot: Data: structure(list(hypoxic2 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,…
FishyFishies
  • 301
  • 3
  • 14
0
votes
1 answer

Lines connecting group means by order of factor level (ggplot)

I am trying to create a line between the means of a numeric variable thats plotted against a factor. I want the lines to join up in the order of the factor, as demonstrated by the figure in grp_1. However, the lines join up in the order of the…
Mohamed Yusuf
  • 390
  • 1
  • 11
0
votes
0 answers

Different colours in geomline and geomplot from same vector

I am currently trying to plot some data with dots and lines. My dataframe has an own column (FarbDots) in which I specify my wanted colours. When I try to plot the data, geom_point takes the colours in the wanted order, while geom_lines() creates a…
Becci
  • 3
  • 2
0
votes
0 answers

How do I create a data frame using bias() results, then scatter plotting those results via ggplot?

I'm new here and am learning R. I am trying to create sample sales forecast bias analysis (with a scatter plot of the bias results/SKU) using actual sales vs forecast sales from four SKUs. I tried, but the search function but was not able to find an…
0
votes
1 answer

Adding space between geom_pointrange()

I just can't figure out how to add space between two geom_pointrange(s)(). Can anyone give me a hint? Thanks.
0
votes
1 answer

how to add multiples lines in a single bar using geom_bar and geom_errorbar in R

I want to add multiples lines using geom_errorbar in a single bar with geom_bar with ggplot2 in R I used an example similar to: https://ggplot2.tidyverse.org/reference/geom_linerange.html df <- data.frame( resp = c(50, 50, 50, 50), group =…
abraham
  • 661
  • 8
  • 14