Questions tagged [stat-density2d]
35 questions
0
votes
1 answer
How to resolve error message "Discrete value supplied to continuous scale" for data density plot; Diff function?
I am having some trouble trying to plot a density map for crime in my city. I'm using the two-dimensional kernel density estimation through the stat_density2d() function. No matter what I change and/or rearrange, I am continually receiving the error…

scarceabundance
- 3
- 2
0
votes
0 answers
Create A Stat_Density_2D Plot By Binning Fill Variable
I have been trying to create a density plot in R that looks similar to the picture below.
In my code below, I have created a stat_density_2D plot that successfully plots my data, however, it fails to recognize my fill variable (in this case…

Nate Walker
- 217
- 2
- 12
0
votes
0 answers
stat_density_2d plot ignores fill aesthetic
Below is R code (dataset included) that aims to replicate the style of this heatmap using a stat_desnity_2d plot.
The code runs, but the code is ignoring my fill variable (titled "exitspeed" in the code) therefore the plot is showing only one…

Nate Walker
- 217
- 2
- 12
0
votes
0 answers
Density heatmap computation
I am trying to plot a positional heatmap using ggplot2, faceted by day of the week. My dataset is quite large and computation is extremely slow.
I started by trying
ggplot(aes(x=x, y=y), data=df) + facet_wrap(~day) +…

MC101
- 87
- 5
0
votes
1 answer
ggplot2 stat_densty_2 -- how to fill different parts of the chart wth different colors?
If I am making a stat_density_2d plot, with raster geometry, how can I color one part of the chart one color, another part of the chart another?
So for this chart:
d <- ggplot(data, aes(xVal, yVal))
d + stat_density_2d(geom = "raster", aes(fill =…

Union find
- 7,759
- 13
- 60
- 111