Honorata Kaja Gajda wrote:
Thanks in advance for any help

I would like to plot a barplot with probability density instead of count
frequencies, as is possible in histograms (freq=FALSE). Is this possible?
I have tried the following code:

with(center,table(light))->light.table
barplot(light.table ,col=brewer, freq=FALSE, beside=T)

But  freq=FALSE doesn’t seem to work in the command of barplot.
The reason why I want to use a barplot is that I have two variables. I
have tried to use multhist instead, but when I plot the histogram the
x-axis labels are unevenly spaced. I would like to create a bar with 7
ticks on the x-axis (1,2,3..7), however the following tics are yielded in
the x-axis (1, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5). How can I regulate this?
I have used the following code:

l<-list(m1=(center$light[center$site=="1"]),
m2=(center$light[center$site=="2"]))
multhist(l,breaks=c(1:7, by=1), freq=FALSE, main="Illumination in Plot
Center", ylab="Density", col =brewer)

I have tried names.arg= but this doesn’t work in multihist either.
Is there any way around this problem? Either by using barplot or multihist?

Hi Honorata,
Have a look at the "barp" function in plotrix. The bars or groups of bars are centered on integer values. You can also save the return value of "barplot" as this gives you the positions of the bars.

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to