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

R shiny and ggplot2: How to make border of geom_col transparent?

I want to make the border of geom_col transparent. It works when only using ggplot2: library(ggplot2) dataToPlot <- data.frame(Freq = c(0.0000000, 0.7092199, 1.4184397, 2.1276596, 2.8368794), variable = rep('A',5), value…
Qin
  • 173
  • 8
1
vote
1 answer

Different colours for each labelled stacked bar?

How can a stacked bar plot be made such that it has different colours for each segment of each stacked bar (i.e. as many unique colours as total segments across all bars - in this case 7 different colours). I have tried the approaches here, but get…
stevec
  • 41,291
  • 27
  • 223
  • 311
1
vote
1 answer

Plot values with same fill-variable next to each other in a plot with 2x geom_col

I have a data set which I want to plot in a bar plot. It consists of a x-variable, two y-variables showing percentages, and a variable giving the variables different features (like A, B and C). The sum of all y-variables at the same x is 100%. I…
Franziska
  • 13
  • 2
1
vote
0 answers

How to add horizontal geom_col() with same axis Y and secondary axis X than a geom_line()?

I have two kind of data I want to merge with ggplot(): The main, are two geom_lines() of duration vs. iteration in tests. The secondary, is a kind of histogram with geom_col(): count vs. duration. I can plot it together but in the histogram the…
ESL
  • 986
  • 11
  • 18
1
vote
1 answer

Showing all variables in a facetted bar chart

I'd like to produce a bar chart that highlights different categories - I use geom_col with a facet for each of the countries. The issue is that the coloured version does not align with the 'greyed' version of the specific country; instead it's…
Tech Commodities
  • 1,884
  • 6
  • 13
1
vote
1 answer

Color/fill bars in geom_col based on another variable?

I have an uncolored geom_col and would like it to display information about another (continuous) variable by displaying different shades of color in the bars. Example Starting with a…
stevec
  • 41,291
  • 27
  • 223
  • 311
1
vote
0 answers

Reorder geom_col by grouping variable (Error: Column `` can't be modified because it's a grouping variable)

I have this df, df <- structure(list(Gender = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("", "Female", "Male", "Q6 - OBS: Sex of Respondent"), class = "factor"), Incident = c("Death", "Detention",…
johnjohn
  • 716
  • 2
  • 9
  • 17
1
vote
1 answer

fixing bar size with ggplot in facet_grid()

I'm trying to make the bars of the plot of the same size with this code: my_plot_replicas = (ggplot(df) + aes(x='algorithm',y='replicas',fill='algorithm') + geom_col(position=position_dodge2(preserve='single')) +…
BlueMountain
  • 197
  • 2
  • 17
1
vote
2 answers

Group bars in bar plot using ggplot and empty limits, but avoid inconsistent axis.ticks

I produced this wonderful bar plot (see below). To quickly group my countries by region, I added scale_x_discrete(limits = ORDER ) with some empty limits "" (specified by ORDER). It adds empty bars to the plot, which seem to work fine for me, but…
MsGISRocker
  • 588
  • 4
  • 21
1
vote
1 answer

Spacing between x-axis groups bigger than within group spacing geom_col

I am trying to get double the space between the groups Automatic and Manual on the x-axis compared to the spaces within these groups. I am using geom_col() and experimted with different arguments, suchs as position_dodge, width and preserve =…
SHW
  • 461
  • 7
  • 26
1
vote
1 answer

ggplot2 with clustered columns

I am trying to plot my data and exhibit like Excel's visualization. The testing data is below: # test yq colA_1 colA_2 colB_1 colB_2 2014 Q1 1.072513 1.026764 0.07251283 0.026764360 2014 Q2 1.097670 1.037183 …
Peter Chen
  • 1,464
  • 3
  • 21
  • 48
1
vote
0 answers

Set each column to it's own palette

I'm making a column chart of the amount of time I spend on various projects, each one for one of a range of "clients" (actually different "areas" of my job) using the excellent togglr package to download my tracked time data and ggplot2. The code…
JMDR
  • 121
  • 1
  • 8
1
vote
1 answer

How can I swap or specify the position of legend elements?

No matter what I have tried, I can't seem to switch the positions of the two legend elements in my plot. I need Chats started to appear first and Chats completed to appear next. Here is the data frame: grouped <- structure(list(date =…
Mus
  • 7,290
  • 24
  • 86
  • 130
0
votes
0 answers

ggplot geom_bar position='dodge' not working

In the below code I want to dodge the geom_bar where asv_numbers is a character variable, LDA is numeric variable, Group variable have four groups (eric, eric /gram, gram, control) on the basis of which I want to dodge the bar plots. I have tried…
0
votes
1 answer

Add horizontal line representing a different mean to each bar in a geom_col()

I am trying to add a simple horizontal line to each bar in a barplot using geom_col() in ggplot2. The horizontal line will represent the mean of the y-axis, and it will be different for each bar. For example, using the iris…