Reputation: 71
I have a vector of data I would like to plot on a histogram, with a scale of 0-1. All its values are 0 and when I plot this (in ggplot or default), I get a big square taking up my figure. Here's what I mean:
zero <- rep(0, 20)
hist(zero, xlab = "p", breaks = 40)
I just want to display the 0's and show that the only values I'm getting are 0's. I know it's any issue for any vector of single values being plotted with a histogram, and that it's a very simple problem but I don't know how else to describe it to find a solution.
Upvotes: 0
Views: 318
Reputation: 785
Histogram not the best way to get your point across. However, you could probably do what you want just by changing your argument for breaks:
hist(..., breaks = seq(0,1, length.out = 40))
Upvotes: 2