-1

Problem 1: The 5th and 6th having no spacing, I'd prefer each bar to stand alone. I have tried to use breaks, but it just leads to the 5th & 6th bar combing into one.

Problem 2: Gap between bars is too wide. How do I control this?

Bonus help: Make X-axis labels to be centred directly under each bar.

Code to reproduce problem:

hist(1:6, breaks = 8, right = FALSE)
user438383
  • 5,716
  • 8
  • 28
  • 43
Ned
  • 11
  • 3
  • 2
    Where is the image? Where is the code? Where is the dataframe? – TarJae Aug 12 '21 at 10:49
  • 1
    https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – pbraeutigm Aug 12 '21 at 10:53
  • @TarJae Sorry to both, I have updated the post to reproduce the problem, an image is no longer needed. Thank you. – Ned Aug 12 '21 at 11:15
  • @pbraeutigm Post is now update with code to reproduce the problem. Thank you – Ned Aug 12 '21 at 11:16
  • 1) With 6 data points and 8 break points, how do you expected the bars to be evenly placed? 2) Same as 1, do you want a bar plot? Bonus) Histograms generally don't have labels centered directly under each bar, to have them you need a bar plot. – Rui Barradas Aug 12 '21 at 11:46
  • 1
    My guess: what you really need is called a bar plot. – TarJae Aug 12 '21 at 11:50

1 Answers1

0
hist(1:6, breaks = seq(0.75, 6.25, 0.5))

Histogram

I guess this achieves what you're trying to do? Whether this histogram makes sense from a statistical point of view is a separate issue.

fujiu
  • 501
  • 4
  • 9