Home > Back-end >  Modify ggdist interval thickness?
Modify ggdist interval thickness?

Time:01-15

I’m visualizing some distributions with the Plot with thicker interval

To eliminate the giant point, you want to change the default value of fatten_point which expands that point. For some reason, fatten_point also affects the size of the interval, so you'll need to increase the interval_size_range to compensate with a matching line size:

ggplot(dist, aes(x = p_grid))  
    stat_histinterval(.width = c(0.67, 0.89),
                      interval_size_range = c(2, 5),
                      fatten_point = 1)

Plot with thicker interval without giant point

CodePudding user response:

Could you just use two interval statements?

ggplot(dist, aes(x = p_grid))  
  stat_histinterval(.width = .89, interval_size=10)   
  stat_interval(.width = .67, interval_size=10, col="black", show.legend=FALSE) 

enter image description here

The problem is that there is a bit of overplotting. You could just add all of the individual elements:

ggplot(dist, aes(x = p_grid))  
  geom_histogram(fill="gray55")   
  stat_interval(.width = .67, interval_size=10, col="black", show.legend = FALSE)   
  stat_interval(.width = .89, interval_size=5,col="black", show.legend = FALSE)   
  geom_point(data=dist, aes(x=mean(p_grid), y=0), col="white", inherit.aes = FALSE, size=5) 

enter image description here

  •  Tags:  
  • Related