Questions tagged [geom-bar]

`geom_bar` is the geometric object description for creating a barplot in `ggplot2`

geom_bar is the geometric object description for creating a barplot in ggplot2, which is an actively maintained open-source chart-drawing library for R. is written by Hadley Wickham and based upon the principles of "Grammar of Graphics".

Resources for using geom_bar:

1029 questions
-2
votes
1 answer

Adding values to geom_col messes up the whole plot

When I add the geom_text to the geom_bar, the whole plot gets messed up. > x # A tibble: 3 x 6 # Groups: Jahr, Monat, Bez [3] Jahr Bez TWh Total Monat MonatsEAnteil 1…
Beat
  • 1
  • 1
-2
votes
1 answer

How to make Stacked and Grouped Barplot with ggplot2?

I want to create a barplot both stacked and grouped. How it can be done? I've been searching on the internet and I've not found any solution yet, that do not use faceting. I set an example below. library(ggplot2) library(reshape) a <-data.frame( …
-2
votes
2 answers

ggplot::geom_bar() - how to flip default red-blue ordering of color?

How do I flip the default ordering of colors which ggplot picks for factor variable passed onto 'fill' aesthetic. (Here, I have a factor variable with two levels Won and Lost). Ref image below, I'd like this 'red-family' shade to go with Lost; As it…
cosmos
  • 85
  • 1
  • 7
-3
votes
1 answer

don't loss N/A values in ggplot2 and delete outliers

I would like to draw histogram/bar of my data with N/A value. At the moment when I am trying to use ggplot2 all non-finite values removed automaticly. Is any posibility to count how many of them we have and put on plot? I would like to solve this…
tomsu
  • 371
  • 2
  • 16
-3
votes
1 answer

how to add legend in R to a ggplot

I have a problem about R, something should be wrong here, I want to add a legend for the two different variables, one is "Insgesamt_ALL" with red colour,and the other one is "weiblich_ALL" with black colour. >…
ZAWD
  • 651
  • 7
  • 31
-4
votes
1 answer

reorder ggplot with geom_bar(stat="identity")

I have prepare a dataframe and use a ggplot on him. But the initial order is not respected. How i can respect this order ? Patient Nb_peptides Type_affinite 1 22 563 a 2 22 1040 b 3 22 …
-4
votes
2 answers

R - Name of each bar in ggplot2

I would like to have the name of each bar under each bar (in my case the names are "Round" and they happen to be 1, 2, ... 12) Here is my current code: ggplot(data=draft1, aes(x = Round, y = mean.age)) + geom_bar(stat = "identity", fill =…
TDo
  • 686
  • 4
  • 9
  • 22
-4
votes
1 answer

ggplot: multiple variables on x axis bar chart

I've been trying for the last couple of weeks to set up a graph that i need. I want to try to have multiple variables (V2, V5, V6) on the "x" axis and how they differ by another condition (V4). My data looks like this: v1 v2 …
hugstari
  • 1
  • 3
-6
votes
1 answer

Creating a bar graph with 95% credible intervals

I am trying to create a bar graph displaying the percentage of PLE and their corresponding 95% credible intervals. I would like to have age groups in the horizontal line and the percentages in the vertical line and Non_C, CG(<14h/w), CG (>=14h/w) as…
Nader Mehri
  • 514
  • 1
  • 5
  • 21
1 2 3
68
69