[R] Angle of Bar Plot
Ben Bolker
bolker at zoo.ufl.edu
Wed Feb 28 00:24:29 CET 2007
Mohsen Jafarikia <jafarikia <at> gmail.com> writes:
>
> Hello everyone,
>
> I want to use 'angle' in Bar Plot with different angles for different bars.
>
> For example if the 3th column of the following data is '0.0', I want the
> angle to be '45' degrees, if it is '1.92', I want '65' and
[snip]
couldn't read the end of your e-mail but chose to set angle=80
for the third value ...
z <- matrix(c(3.74,0,6.12,1.92,9.71,0,1.32,1.92,8.24,4.48),byrow=TRUE,
+ ncol=2)
> z
[,1] [,2]
[1,] 3.74 0.00
[2,] 6.12 1.92
[3,] 9.71 0.00
[4,] 1.32 1.92
[5,] 8.24 4.48
> barplot(z[,1],angle=c(45,65,80)[as.numeric(factor(z[,2]))],density=5)
I will point out that this is pretty ugly though ...
Ben Bolker
More information about the R-help
mailing list