Part of the `ggplot2` library for R, `geom_col` is a chart type using columns to represent data.
Questions tagged [geom-col]
169 questions
0
votes
2 answers
Change order in y-direction of stacked bar chart in ggplot2 as indicated by sequence
using this reproducible example tibble
# install and attach packages
if (!require("pacman")) install.packages("pacman")
pacman::p_load(tidyverse, dplyr, ggplot2)
# Create example dataset (tib1)
tib1 = tibble(location = c("loc1", rep(c("loc1",…

T. BruceLee
- 501
- 4
- 16
0
votes
2 answers
ggplot2 and log scale don't show values = 1
I want to plot a diagram with a log scales y axis:
data <- data.frame(x = seq_len(5), y = c(2,1,100,500,30))
ggplot(data) + aes(x,y) + geom_col() + scale_y_log10()
But because the horizontal axis always crosses the vertical axis at y = 1, the bar…

Stefan L.
- 65
- 10
0
votes
1 answer
How to draw a column graph after adding all positive and negative values for a specific 'year' in geom_col?
I have a data frame contain some information for a period of (1948-2013). Every year also contains data in terms of 4 season. Now sometimes, the year contains positive and negative data. Sample of my data
YEAR Region temp_avg_max…

0Knowledge
- 747
- 3
- 14
0
votes
1 answer
Aligning geom_text in grouped dodged barplot
My df looks like this:
Sede
Mes
n
Las Heras 2019-01-01 54
Las Heras 2019-02-01 53
Las Heras 2019-03-01 60
Las Heras 2019-04-01 56
Las Heras 2019-05-01 77
Las Heras 2019-06-01 …

Ale Rey
- 75
- 8
0
votes
2 answers
Why does geom_col add instead of show the means?
When I use the geom_col to graph the percent of people who are white in the state (from the midwest dataset in the ggplot2 package), ggplot2 adds the values instead of averages them. This seems like a very strange default to me - that's not what a…

Hannah Harder
- 67
- 10
0
votes
1 answer
Rstudio: Adjusting bar width of grouped bar plot in facets
I have a Data set which I am trying to plot as grouped columns in facets, with the columns in equal size.
Data set:
Day=rep(1:6, times=15)
Colour=c("Yellow", "Yellow","Yellow","Yellow","Yellow","Yellow",
"Red",…

BeccaLi
- 174
- 7
0
votes
1 answer
How to barplot a column with 2 different variables in only one bar in ggplot
I have this df: estudios_intubacion
estudio_completo numero
1 COMPLETO 2838
2 INCOMPLETO 147
And i'm trying to ggplot only one bar/col with the two variables of estudio_completo (COMPLETO and…

Ale Rey
- 75
- 8
0
votes
1 answer
How do I sum and label the total of "Confirmed" Cases per x-axis "Date"
I want to label the sum of the column of "Confirmed" Cases for each "Date"
ggplot(filter(COVID1, COUNTY %in% c("Kent")))+
geom_col(aes(x = Date, y = Cases, fill = CASE_STATUS), position = position_stack(reverse = TRUE), width = .88)+
dp(COUNTY …

John
- 45
- 6
0
votes
2 answers
R: Pairing sets of bars in geom_col for a chi-squared visualisation?
I'm trying to pair "Observed" and "Expected" bars for plastic counts at each site but can't figure out how to include my "Expected" columns in my geom_col plot. My report is due on the 30th (yikes!)
I'd like something akin to this (see below) but…
0
votes
1 answer
how to change the format of graphique in ggplot to combine geom_col and geom_surface
I'm trying to plot with ggplot my data frame by using the code bellow
p1 <- ggplot(dates2, aes(x=periode_ap, y=pourcentage_parc, fill=apport))+
geom_col(position = position_stack(reverse = TRUE))+
ylim(0,100)+
…

Abdel_El
- 77
- 6
0
votes
1 answer
Stack barplot as a function of percentage observations per class without change the value in ggplot2
Morning, everybody,
I have a question about the formatting of my graph.
Orignal graph
Here I'm representing the average group size as a function of distance from the coast. Would it be possible to divide each column by the percentage of the number…

Gaspard
- 1
0
votes
1 answer
Change bar color according to the size of the bar R
With ggplot I´ve made a histogram with some values. I want to change the color of the highest bar, so that it makes the plot more legible.
library(ggplot2)
ggplot(df,
aes(as.Date(created_at), as.numeric(count))) +
geom_col(fill =…

AdrianGI
- 37
- 5
0
votes
1 answer
how to add legends from stat_summary and remove legends from the main plot?
I want to plot the values of df1 by two groups i.e. product and start_date and also plot a crossbar with the mean of df1(blue) and mean of df2(red) as in the attached diagram.
df1 <- data.frame(product =…

Bodhi Bose
- 33
- 6
0
votes
1 answer
ggplot2 geom_points won't colour or dodge
So I'm using ggplot2 to plot both a bar graph and points. I'm currently getting this:
As you can see the bars are nicely separated and colored in the desired colors. However my points are all uncolored and stacked ontop of eachother. I would like…

Thije Zuidewind
- 87
- 1
- 1
- 7
0
votes
1 answer
Make ggplot chart with more than one y value
I have a dataframe that has 2 rows and 3 columns. I want to be able to chart all three columns, and it would probably make the most sense in a geom_col or geom_bar chart. The x axis would stay the same for both graphs.
Dataframe has columns a1, b1,…

mrm081
- 13
- 2