Part of the `ggplot2` library for R, `geom_col` is a chart type using columns to represent data.
Questions tagged [geom-col]
169 questions
2
votes
2 answers
columns are not aligned with the data in ggplot geom_col
plotting some data to a figure with numerical data, one would expect the column border to line up with the grid. However, when plotting this data, you can see that there are some that line up correctly (10, 5), but others don't (2, 1).
Is this a bug…

sergiouribe
- 221
- 1
- 3
- 11
2
votes
0 answers
Making barplot with offset baselines using ggplot2
If I'm using the default R graphics package, then I can make plots with staggered baselines.
Here is an example using the CPTtools package (which is available on github)
library(devtools)
install_github("ralmond/CPTtools")
library(CPTtools)
margins…

ralmond
- 116
- 5
2
votes
2 answers
How to use geom_bar() to create two grouped columns in R
There has got to be an easy way to create one set of grouped bars for aware column and a another set of grouped bars for serious column with the individual bars within each group being the value for the respective regions. Final image should look…

Ethan Lobdell
- 31
- 5
2
votes
1 answer
In ggplot I would like to not label geom_col bars whose value is zero, just the one's that have a value (they are all positive)
When labeling columns on a geom_col plot I can label them with this code:
geom_text(aes(x = Date, y = Cases, label = Cases), vjust = -0.5)+
some values are zero for Cases, and I would like not to show those.

John
- 45
- 6
2
votes
2 answers
geom_col is assigning the wrong independent variable
I have a simple two variable data frame with a third variable acting as a factor
DF <- data.frame(Depth = c(8.6, 19.6, 42.6, 60.6, 79.4, 101.4, 121.4, 137.6, 163, 180),
Rb = c(103, 59, 99, 53, 107, 87, 52, 33, 105, 49),
Litho =…

JJGabe
- 383
- 1
- 2
- 10
2
votes
1 answer
how to change the type of ggplot graphic
I have the data frame (for example)
df <-data.frame(apport=c("Org 2016","Min 1","Min 2","Min 3"),
Aou_14=c(7.69,0,0,0), Sep_16=c(7.69,0,0,0),Sep_17=c(15.38,0,0,0),
…

Abdel_El
- 77
- 6
2
votes
1 answer
ggplot: Using geom_col with facet_wrap
I have been using R for 6 months now (fairly new).
I have created a nice graph using the facet_wrap funciton, with geom_point.
However, i don't seem to have success with geom_col, when plotting another parameter i am interested in.
The code is…

Ahmad
- 23
- 4
2
votes
0 answers
Changing legend title and labels in geom_col ggplot2
I wish to change the title and labels of a legend in geom_col plot in ggplot2.
I have tried to use the functions below to change the legend title, however nothing happens:
labs(color = "Treatment")
labs(fill = "Treatment")
I have also tried to use…

Tiptop
- 533
- 5
- 19
2
votes
1 answer
how to plot geom_col() to get y axis to center around 1 and not 0
I am plotting a some data using ggplot2's geom_bar. The data represents a ratio that should center around 1 and not 0. This would allow me to highlight which categories go below or above this central ratio number. I've tried playing with…

Bryant Chambers
- 37
- 4
2
votes
1 answer
Aligning error bars with different numbers of bars per group in ggplot2
I was trying to plot error bars on a bar plot in ggplot2 with different number of bars per group. I would like:
Fixed width of bars, regardless of number of bars per group
Error bars with the same width of whiskers, aligned with the corresponding…

elarry
- 521
- 2
- 7
- 20
2
votes
1 answer
In ggplot2, when there is a facet_wrap, how to make all geom_col bars the same color when they have the same value?
I have a dataframe df with three columns: TASK, CONDITION, and SCORE.
I want to represent the data:
as barplots (I'm using geom_col)
with a separate plot for each TASK (I'm using
facet_wrap(~TASK))
with a separate bar for each CONDITION (I'm
using…

gilcail
- 23
- 3
2
votes
1 answer
How to align geom_text labels above dodged geom_col
I can't seem to find a way to get the text labels on this (dodged) geom_col to line up according to their respective columns.
I have tried numerous suggestions solutions on SO and other sites, and this is the closest I could get:
How do I fix…

Mus
- 7,290
- 24
- 86
- 130
1
vote
1 answer
How to use ggplot with labels, fills, colors, and symbols to visualize different dimensions in a stacked bar chart plot?
I have been able to create the following visualization in python but would like to re-create it in r.
The data can be found further down in the r code.
The python code I wrote to generate the below graph from the data is:
import matplotlib.pyplot as…

Per Liljenberg
- 13
- 2
1
vote
0 answers
Switching columns within a geom_col() plot in R
I am attempting to switch the plotted bars so the first column is for Budgeted and the second column in for Actual. Any help is much appreciated.
This is my code.
library(tidyverse)
library(ggplot2)
library(dplyr)
library(scales)
Mississppi…

tatertot2
- 11
- 2
1
vote
0 answers
facet_wrap same bar width
I want to have the same bar width using facet_wrap. I looked at answers like: How to automatically adjust the width of each facet for facet_wrap? and facet_wrap with equal bar widths but do not achieve the desired result.
Furthermore, I adapted my…

mr.raccoon
- 47
- 7