determine mean value on 0Y histogram axis
I am drawing histograms using hist command as below:
hist(plikTVDI, ylab开发者_运维问答='częstość występowania',
xlab=xetyk, col='red', main=etykieta, cex.lab=1.5)
Then I am adding tekst:
text(x=mean(plikTVDI,na.rm=TRUE),y=40,labels=tekst_srednia_l, cex=3, col='blue')
Is there any possibility to determine where is mean of y axis (it will be better then constant 40).
I may not be understanding your question correctly, but I think you'd like to identify the midpoint of the y axis when you create a histogram?
If that's the case, if you store the results of hist
in a variable, like so:
tmp <- hist(...)
you can access the count values that determine the heights of the bars via tmp$counts
. So the midpoint of the y axis would be tmp$counts / 2
.
Alternatively, if you wanted the mean of the heights of the bars, you could simply do:
mean(tmp$counts)
精彩评论