Represent the x-axis of the histogram as the frequency distribution classes?

Asked

Viewed 243 times

2

I’m having problems when I’m doing a histogram of this frequency distribution.

Class Limits f Rf Rf(%) cf(%)

[22.691,25.57) 17 0.01 1.29 17 1.29

[25.57,28.45) 25 0.02 1.90 42 3.19

[28.45,31.33) 64 0.05 4.86 106 8.05

[31.33,34.209) 119 0.09 9.04 225 17.08

[34.209,37.089) 169 0.13 12.83 394 29.92

[37.089,39.969) 219 0.17 16.63 613 46.55

[39.969,42.848) 271 0.21 20.58 884 67.12

[42.848,45.728) 185 0.14 14.05 1069 81.17

[45.728,48.608) 139 0.11 10.55 1208 91.72

[48.608,51.487) 72 0.05 5.47 1280 97.19

[51.487,54.367) 29 0.02 2.20 1309 99.39

[54.367,57.247) 8 0.01 0.61 1317 100.00

Basically I wanted in the histogram the xlim to be represented by the distribution classes. As in the image:inserir a descrição da imagem aqui

1 answer

5


I could not use your data but here is an example:

set.seed(42)
x <- rnorm(200, 10)

hist(x)

inserir a descrição da imagem aqui

Set the desired limit:

lim <- seq(from = 6.7, to = 13.7, by = 1)
> lim
> [1]  6.8  7.8  8.8  9.8 10.8 11.8 12.8

Do the histogram using the command xaxt = 'n' to plot without Axis x, and then use axis() to add the corresponding values with the desired limit:

hist(x, breaks = lim, xaxt = 'n')
axis(1, at = lim)

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.