Questions tagged [geom-histogram]
14 questions
1
vote
1 answer
R: how to layer two facet ggplot from two different df with dates as the x axis?
I would like to combine these two ggplots: origin from different data frames with the same X axis (floor_dates) and same facet_wrap.
The two plots:
ggplot(averaged_activity,aes(x=date(DATETIME),y=PERCENTAGE), group = POPULATION) +
geom_line(stat…

Maya Eldar
- 49
- 5
1
vote
1 answer
Adding stat = count on top of histogram in ggplot
I've seen some other examples (especially using geom_col() and stat_bin()) to add frequency or count numbers on top of bars. I'm trying to get this to work with geom_histogram() where I have a discrete (string), not continuous, x…

a_todd12
- 449
- 2
- 12
1
vote
1 answer
Plot negative histogram with ggplot
I plot two series from the same dataframe. One of them has negative values.
p_change <- ggplot(dx, aes(fill=Group)) +
geom_histogram(aes(x=posvalues), binwidth=1) +
geom_histogram(aes(x=negvalues), binwidth=1) +
xlim(0, 15) +
ylim(-25, 25)…

reggie
- 3,523
- 14
- 62
- 97
0
votes
2 answers
ggplot histogram grouped by years and density function
I want to create a histogram for my data table dt grouped by acquiYear, where the y-axis represents the nrOrders and the x-axis the month. My data table looks like this:
structure(list(acquiYear = c("2014", "2014", "2014", "2014", "2014", "2014",…

MikiK
- 398
- 6
- 19
0
votes
1 answer
label position in stat_bin for geom_histogram: how to adress ..count.. in the position_nudge method?
I've got input_values as a tibble:
input_values
For these alues I'd like to plot a histogram, where the columns are labeled (90° angle, almost directly on top of the colums).
as_tibble(input_values) %>% ggplot(aes(x = values) + geom_histogram(stat =…

nadja
- 1
0
votes
0 answers
ggplot2 - geom_boxplot - is it possible to externally compute the "box" locations as well as quantiles and outliers
I'm interested in pre-computing boxplot information and passing the results to ggplot/geom_boxplot. That is, in a database or external process, determine the locations/breaks, quantiles and outliers and then bring that into R, and plot with…

csta
- 2,423
- 5
- 26
- 34
0
votes
0 answers
How to create a geom_bar with different percentages
I want to create a geometria_bar with the percentages as followed but the bars always add up to 1, but in reality they show different percentages.
Here's a screenshot
0
votes
1 answer
geom_histogram with subset data, how to stop bars overlapping
I am exploring a dataset of goals (goals/minute here) across years (1986-2023) for both the men's and women's side of the game in this sport. I want to visually explore subsets of the data (here <=2009 and >2009) for both game disciplines.
What I've…

Eccles
- 1
0
votes
1 answer
r geom_histogram binning groups differently
I'm trying to plot an overlay of 2 histograms, where one represents all data, and the other represents a subset that meets a criteria. I have a .csv file that I'm importing as a dataframe, code that builds a new dataframe with the categories, and a…

Isaac Linn
- 1
- 2
0
votes
3 answers
How to remove outline between columns in geom_histogram
I have a histogram that uses color to distinguish categories of data. When I make the plot, there is a line across the whole thing using the last color in the sequence. It looks bad since there are a lot of gaps in the data.
Here's a MRE using…

Seth Goodnight
- 25
- 1
- 4
0
votes
2 answers
In ggplot2, how do I properly scale x-axis in histogram?
The Ask:
Please help me understand my conceptual error in the use of scale_x_binned() in ggplot2 as it relates to centering breaks beneath the appropriate bin in a geom_histogram().
Starting Example:
library(ggplot2)
df <- data.frame(hour =…

ScottyJ
- 945
- 11
- 16
0
votes
1 answer
Geom Histogram of two variables with different data types RStudio
I am trying to do a very simple geom plot but it is becoming complex due to following reasons. I have two variables Date and Condition. Their data type is Date and Char respectively. Following data exist in…

Usman YousafZai
- 1,088
- 4
- 18
- 44
0
votes
1 answer
Adding multiple variables to fill the geom_hist
I am trying to make a histogram in ggplot with values of Salinity on the x-axis, but I need to categorize it with both Deposit and CL_Phase. I don't want to just change the outline color because it is difficult to see. But this code does not…

jlima.geol
- 13
- 3
-1
votes
1 answer
ggplot facet with two variables
I have a data frame with the two columns bloodlevel and sex (F & M only), with 14 male and 11 female.
bloodlevel sex
1 14.9 M
2 12.9 M
3 14.7 M
4 14.7 M
5 14.8 M
6 14.7 M
7 13.9 M
8 …