Questions tagged [geom-col]

Part of the `ggplot2` library for R, `geom_col` is a chart type using columns to represent data.

169 questions
1
vote
1 answer

Separating Stacked Bar Graph Based on Values in a Column

I am having trouble writing the code for a graphical hypothesis. Below I attached the code where I create the data frame then run it in ggplot. I currently get a stacked bar graph which I like but the 0% and 3% salt treatments aggregate when I would…
Michael
  • 11
  • 4
1
vote
1 answer

Change the opacity on a fraction of each stacked geom_bar

Using the following data frame I aim to stack all x values by group using geom_bar or geom_col and fill them by subgroup. dat <- data.frame(group = c(rep("H", 4), rep("T",4)), subgroup = rep(c("A", "B", "C", "D"), 2), x = c(100, 10,…
danonino
  • 13
  • 3
1
vote
1 answer

Hierarchical scale_fill_* colors

I'm wondering if anyone has an easy way to have each category be a separate color scale. ie: "Forb" would be all shades of blue and green, "Conifer" would be reds, "Shrub" orange and yellow, "Graminoids" purple and pink (or whatever, exact colors…
salix7
  • 61
  • 5
1
vote
2 answers

Creating a stacked bar chart (using data from 2 columns)

I am trying to create a stacked bar chart but unable to create the 'stack part'. I wish to have my bar height as the gdp_per_capita column and I then wish to show the gdp_per_capita_agg_percen column as part of each column (this is as a percentage…
Joe
  • 795
  • 1
  • 11
1
vote
2 answers

How do I create a clustered chart using position dodge in R

I am trying to create a clustered bar graph using ggplot to plot "accum_sum_per" and "mean_per". The table looks as follows: DECL_PERIO accum_sum_per mean_per Years 1 2011-2015 0.385 0.366 2015 2…
Shae11
  • 49
  • 5
1
vote
1 answer

geom_bar for total counts of binned continuous variable

I'm really struggling to achieve what feels like an incredibly basic geom_bar plot. I would like the sum of y to be represented by one solid bar (with colour = black outline) in bins of 10 for x. I know that stat = "identity" is what is creating the…
1
vote
2 answers

Displaying percentages within category for continuous/ordered variable (with ggplot)

I have two questions, the first a (hopefully) straightforward mechanical one and the second more theoretical (though still with a technical element). I am trying to do something nearly identical to this question, but I have a variable that is…
a_todd12
  • 449
  • 2
  • 12
1
vote
2 answers

R geom_col and geom_text label using dollar signs and commas

I am working with the following table: structure(list(Entity = structure(c(2L, 2L, 2L, 2L, 2L, 2L), .Label = c(" ", "FL", "MA", "WV"), class = "factor"), Area = c("Broward", "Broward", "Broward", "Broward", "Broward", "Broward"), `Store #` =…
hachiko
  • 671
  • 7
  • 20
1
vote
1 answer

Trying to make a stacked bar plot but geom_col giving error

I have these data: > dput(events.bypod) structure(list(event.id = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L,…
burphound
  • 161
  • 7
1
vote
1 answer

Labels on wrong dodged columns in geom_col

I want to create a simple barplot of my data frame: > dput(corr) structure(list(`sample length` = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("3s", "10s"), class =…
1
vote
1 answer

How to include geom_label for a column ggplot?

Hi so I have some data which looks like this: `Marketing Variables` LICENCE_STATUS count pct val 1 RESIDENT_MARKETING_ALLOWED ACTIVE FALSE 7612 46.61% 2…
John Thomas
  • 1,075
  • 9
  • 32
1
vote
2 answers

How can I sort my y result when using geom_col()?

I have two plots: 1. ggplot() + geom_col(data = descritivasseries, aes(x = streaming, y = media_IMDB), fill = "seagreen1") + coord_cartesian(ylim = c(6.85, 7.20)) + labs(title = "Avaliação das Séries", …
1
vote
1 answer

Changing the fill order in a clustered geom_col?

I'm trying to manually re-order the bar clusters within my plot. This is the entire relevant dataset: Season Set Density Summer Full set 0.020065 Summer Set 2 0.017713 Summer Set 3 0.015170 Summer Set 4 0.018816 Autumn Full set …
Tormey R
  • 11
  • 3
1
vote
1 answer

How to Use ggplot2 geom_col with facet_grid and coord_flip

I would like to design a horizontal ggplot barchart with 3 groups on the left axis (country, retailer and category). Following inspiration from R ggplot // Multiple Grouping in X-axis I can design it on the x axis, however, when I then apply…
CallumH
  • 751
  • 1
  • 7
  • 22
1
vote
1 answer

How to color many columns the same color in geom_bar ggplot2

I have the following data: > Dummydata Sample r.K 1 E1 0.084150 2 E2 0.015170 3 E3 0.010662 4 E4 0.016123 5 EK1 0.010289 6 EK2 0.017484 7 EK3 0.014685 8 EK4 0.014272 9 EK5 0.012551 10 K1…
Yggdrasil
  • 13
  • 3
1 2
3
11 12