|
Hi,
I am working on stacked bar plot and want to add marker(arrow) in stacked bar plot. DF=data.frame(names=c("tomato", "potato", "cabbage", "sukuma-wiki", "terere"), freq=c(7,4,5,8,20)) barplot(as.matrix(DF[,2]), col=heat.colors(length(DF[,2])), legend=DF[,1], xlim=c(0,9), width=2) .
Image with marker: ![]() How can i add marker or arrow for particular stack in graph. Regards |
|
Hi Manish,
See ?arrows, e.g., DF <- structure(list(names = structure(c(5L, 2L, 1L, 3L, 4L), .Label = c("cabbage", "potato", "sukuma-wiki", "terere", "tomato"), class = "factor"), freq = c(7, 4, 5, 8, 20)), .Names = c("names", "freq"), row.names = c(NA, -5L), class = "data.frame") barplot(as.matrix(DF[,2]), col=heat.colors(length(DF[,2])), legend=DF[,1],xlim=c(0,9), width=2) arrows(3.5, 15, 2.8, 20) HTH, Jorge.- On Mon, Jul 9, 2012 at 11:37 PM, Manish Gupta <> wrote: > Hi, > I am working on stacked bar plot and want to add marker(arrow) in stacked > bar plot. > > DF=data.frame(names=c("tomato", "potato", "cabbage", "sukuma-wiki", > "terere"), freq=c(7,4,5,8,20)) > barplot(as.matrix(DF[,2]), col=heat.colors(length(DF[,2])), legend=DF[,1], > xlim=c(0,9), width=2) > > http://r.789695.n4.nabble.com/file/n4635946/Screenshot.png . > > Image with marker: > > http://r.789695.n4.nabble.com/file/n4635946/marker.png > > How can i add marker or arrow for particular stack in graph. > > Regards > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-add-marker-in-Stacked-bar-plot-tp4635946.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. > [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
Thanks it works fine. But can i control its width?
Regards |
|
I found arrow is too thin. I have one arrow image. I want to put it there. How can i import external image and merge with stacked bar plot.
Regards |
|
In reply to this post by Manish Gupta
Yes, you can. See the lwd argument under ?arrows. --JIV
On Tue, Jul 10, 2012 at 2:16 AM, Manish Gupta <[hidden email]>wrote: > Thanks it works fine. But can i control its width? > > Regards > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-add-marker-in-Stacked-bar-plot-tp4635946p4635954.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. > [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
In reply to this post by Manish Gupta
On 10.07.2012 05:37, Manish Gupta wrote: > Hi, > I am working on stacked bar plot and want to add marker(arrow) in stacked > bar plot. > > DF=data.frame(names=c("tomato", "potato", "cabbage", "sukuma-wiki", > "terere"), freq=c(7,4,5,8,20)) > barplot(as.matrix(DF[,2]), col=heat.colors(length(DF[,2])), legend=DF[,1], > xlim=c(0,9), width=2) > > http://r.789695.n4.nabble.com/file/n4635946/Screenshot.png . > > Image with marker: > > http://r.789695.n4.nabble.com/file/n4635946/marker.png > > How can i add marker or arrow for particular stack in graph. See ?arrow Uwe Ligges > > Regards > > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-add-marker-in-Stacked-bar-plot-tp4635946.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
|
In reply to this post by Manish Gupta
If you want something other than an arrow (or an arrow that looks
different from those produced by the arrows function) then look at the my.symbols function in the TeachingDemos package. On Mon, Jul 9, 2012 at 9:37 PM, Manish Gupta <[hidden email]> wrote: > Hi, > I am working on stacked bar plot and want to add marker(arrow) in stacked > bar plot. > > DF=data.frame(names=c("tomato", "potato", "cabbage", "sukuma-wiki", > "terere"), freq=c(7,4,5,8,20)) > barplot(as.matrix(DF[,2]), col=heat.colors(length(DF[,2])), legend=DF[,1], > xlim=c(0,9), width=2) > > http://r.789695.n4.nabble.com/file/n4635946/Screenshot.png . > > Image with marker: > > http://r.789695.n4.nabble.com/file/n4635946/marker.png > > How can i add marker or arrow for particular stack in graph. > > Regards > > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-add-marker-in-Stacked-bar-plot-tp4635946.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. -- Gregory (Greg) L. Snow Ph.D. [hidden email] ______________________________________________ [hidden email] 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. |
| Powered by Nabble | Edit this page |
