616 questions
3
votes
2
answers
170
views
Struggling to make histogram density curve [duplicate]
I am very new to coding and R but I am trying to make a series of superimposed histograms with density curves in ggplot2. I have trawled through the forum for similar threads but because I am so new, ...
1
vote
1
answer
59
views
How to add density plots for x and z axes in a tensor smooth plot?
I created this plot using tensor smooths..
I would like to add a visualization of the data density along the x-axis and z-axis. Ideally, this could be done with either:
A rug plot on the respective ...
0
votes
1
answer
84
views
Geopandas density raster creation
I have a geopandas dataframe that contains points at arbitrary lat/lon points. I would like to create a raster dataset so that each point in the regular grid contains the number of elements of the ...
0
votes
1
answer
450
views
Why can't I get counts on my y-axis on geom_density?
I am trying to do 4 different plots with geom_density and put the count on my y-axis, then put them together with ggarrange. I am following this to be able to put count on my y-axis: Density plots ...
0
votes
1
answer
128
views
Changing the Legend Title in a `ggpointdensity` Density Scatterplot [duplicate]
I have the following data and the following graph.
df <- data.frame(col1 = rnorm(1000, 0, 0.05), col2 = rnorm(1000, 0, 0.05))
ggplot(data = df, mapping = aes(x = col1, y = col2)) +
...
0
votes
1
answer
98
views
How to use python imshow, for example, with the irregular data points?
Suppose I have a list of data points of the form (xi, yi, zi) and I want to plot a 2D density plot with it. In mathematica, you just call the function ListDensityPlot function. In python, it seems ...
1
vote
1
answer
247
views
2d scatter plot - mcolors.Normalize vs mcolors.LogNorm
I have a scatter plot that I'm making but when I switch between mcolors.Normalize and mcolors.LogNorm the color bar is not consistent between the two figures - I would think that the normalized color ...
0
votes
1
answer
106
views
How to facet-wrap comparative density plots in R with ggplot
I have a dataset of different conditions with values of length.
I can make histograms/density plots out of it and can facet wrap it for comparison to the control condition.
I can also make individual ...
0
votes
2
answers
170
views
1D kernel estimation to compare PDF ratios: how to set tails?
Trying to create 1D kernels from data observations (weekly time points). I have been using the density() function from the stats R package. I am doing this so I can take the ratio of a treatment's pdf ...
0
votes
1
answer
119
views
Is there a way to separate a density plot by color at a value that does not split the data into two separate groups?
I am trying to create a density plot that changes color at the average value of variable. However, when I create the split instead of maintaining its from as one distinct density chart it splits into ...
-2
votes
1
answer
2k
views
Interpreting y axis in density plot [closed]
200 people were tested, 20 of those were infected. I want to get a posterior distribution for the uncertainty associated with the probability that a person is infected.
I do this like this:
n<-200
...
3
votes
1
answer
427
views
What is stat_density calculating in stacked density charts?
As an example, here a stacked density chart based on diamonds. A simple table suggests that "Fair" cut should be quite uncommon, and "Ideal" the most common, etc..., but the five ...
3
votes
0
answers
53
views
Base R cdplot and ggplot geom_density draw different curves for the same data
Reproducible example:
require(ggplot2)
set.seed(7)
# generate data
a <- runif(100, min=0, max = 50000)
c <- sample(c("A", "B"), 100, replace =T)
c <- factor(c)
df <- ...
0
votes
0
answers
55
views
Customized density distribution in python
I am trying to replicate a plot in Figure 8 of this "https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2012JD017979" article using precipitation data.
Basically, it shows the distribution ...
0
votes
2
answers
802
views
Changing the line type on a density plot in R
I am trying to change the line type of a density curve, just so that it stands out relative to the rest of the density curves that I have on the same plot. However, the issue is that when I use the &...
0
votes
2
answers
431
views
1D scatter plot colored by density
I was wondering whether it was possible to use mpl-scatter-density or datashader to create a 1D scatter plot colored by density as it is shown here for the 2D case.
It can be done with gaussian_kde, ...
3
votes
1
answer
802
views
ggplot2 geom_density: correct way to display density as percentage, changing the legend key shape
I am trying to do what I thought would be an easy task, but I am stuck.
I just want to display a density plot as percentages, but ggplot2::scale_y_continuous() does not seem to work the way I expect ...
1
vote
1
answer
362
views
Averaging multiple density curves in plot
I would like to get only one curve that is the "average" of all curves in order to get the "average trend". In my specific case, it is to average simulations I made.
Using this ...
0
votes
2
answers
203
views
Compound 2d density + bubble plot in R w/ ggplot 2
TLDR; Can I force the bubble coordinates onto a uniform grid?
I've made this figure to visualize the relationship between physical oceanographic variables (SST and HCI) and the total number of fish ...
0
votes
1
answer
20
views
Error with changing legends in histogram and density plot ggplot2
I have the next dataset:
structure(list(working_hours = c("Whours_after", "Whours_after",
"Whours_before", "Whours_before", "Whours_before", "...
0
votes
0
answers
21
views
Graph density curve from output from boot library package [duplicate]
i want to be able show density curve of the results of the bootstrap sample done in the package boot.
The package allows plot() to be used to graph histogram
But i cannot work out how to add density ...
0
votes
1
answer
687
views
How to extend a density ggplot so that it trails off to zero
I feel like this should be easy but It's been hours of searching and I can't find anything.
I have a density curve below made with the following code
ggplot()+
geom_density(data = onlyOne, aes(...
2
votes
2
answers
145
views
Density Plot of Year and Value
I simply cannot get a density plot for the following data set:
A single y Varibale and corresponding year
I have tried copying code and simply modifying and i simply can't get it to work.
I need to ...
0
votes
1
answer
102
views
Rescale ylimits density plot ggplot r
I made a Boxplot with connected data and I am trying to add a density plot. The problem is that the density plot seems to be on a different scale.
This is what the plot looks like
It's clear that the ...
0
votes
1
answer
178
views
is ggplot confused? It exchanges the color labels [duplicate]
I'm drawing density plot with ggplot, but in the output it inverts the name of the colors!
This is my script:
ggplot(dataset) +
geom_density( aes( x = `Real Wage 1`, fill = "red"), alpha =...