Thanks Rui and Greg for providing me the solution , it Works.
--
View this message in context:
http://r.789695.n4.nabble.com/Barplot-with-Secondary-axis-tp4640980p4641081.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-pr
Using par(new=TRUE) will often cause more problems than it helps.
A better approach would be to use the twoord.plot function from the
plotrix package or to use the updateusr function from the
TeachingDemos package along with the lines function to add the lines
afterwards.
On Wed, Aug 22, 2012 at
Hello,
You were almost there.
x = c("a","b","c","d")
y= cbind(c(50,40,30,20),c(40,30,20,10))
y2 = c(0.80,0.65,0.75,0.50)
#
bp <- barplot(t(y), beside = TRUE)
xlim <- c(floor(min(bp)), ceiling(max(bp)))
#
par(new=T)
plot(colMeans(bp), y2, type="o", col="black", lwd=3,
lty=1, xaxt="n", yaxt="n
Hi all,
I am trying to plot a bar chart and trying to plot a line as a secondary
axis as my scale is different for two y axis.
I am plotting a clustered bar chart by using besides = True option in
barplot function and my y coordinates are not plotted exactly at the center
on each two bars. Pleas
4 matches
Mail list logo