[R] Adding a line to barchart

arun smartpink111 at yahoo.com
Wed Jan 23 00:33:01 CET 2013


Hi,

May be this helps:
 barchart(npp,origin=0,box.width=1,
 panel=function(x,y,...){
 panel.barchart(x,y,...)
 panel.abline(v=2,col.line="red",lty=3)})
A.K.




----- Original Message -----
From: Jonathan Greenberg <jgrn at illinois.edu>
To: r-help <r-help at r-project.org>
Cc: 
Sent: Tuesday, January 22, 2013 5:41 PM
Subject: [R] Adding a line to barchart

R-helpers:

I need a quick help with the following graph (I'm a lattice newbie):

require("lattice")
npp=1:5
names(npp)=c("A","B","C","D","E")
barchart(npp,origin=0,box.width=1)

# What I want to do, is add a single vertical line positioned at x = 2 that
lays over the bars (say, using a dotted line).  How do I go about doing
this?

--j

-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007

    [[alternative HTML version deleted]]

______________________________________________
R-help at 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.




More information about the R-help mailing list