[R] Color of CI bars in Hmisc::Dotplot()

Michael Kubovy kubovy at virginia.edu
Sun Feb 24 23:33:12 CET 2008


Dear R-helpers,

(1) I can't figure out how to tell Dotplot that I want the colors of  
the CI bars to be the same as the colors of the dots.

For example:
t2a.ci3 <- data.frame(est = c(7, 20, 75), lower = c(-9, 0.5, 42),  
upper = c(22, 39, 109))
mypal <- c('skyblue3', 'mistyrose3')
condNames <- c('noise', 'horn', 'marimba')
Dotplot(1:2 ~ Cbind(est, lower, upper), data = t2a.ci3,
	scales = list(y = list(at = 1:2, labels = condNames)),
	ylab = '',
	xlab = 'rated duration', aspect = 0.2,
	ylim = c(0.5, 2.5), panel = function(x, y){
		panel.Dotplot(
				x, y, col = mypal[c(1, 2)],
					col.segments = mypal[c(1, 2)])
		panel.abline(v = 50, col.line = 'red', lty = 2)}
)

My guess was "col.segments" but that doesn't do the trick.

(2) How do I insure that as I change the number of lines and  ylim I  
just change the the height of the y-axis, keep the distance between  
horizontal lines constant, and do not add white space above and below  
the figure? This shows how white space changes:

Dotplot(1:3 ~ Cbind(est, lower, upper), data = t2a.ci3,
	scales = list(y = list(at = 1:3, labels = condNames)),
	ylab = '',
	xlab = 'rated duration', aspect = 0.3,
	ylim = c(0.5, 3.5), panel = function(x, y){
		panel.Dotplot(
				x, y, col = mypal[c(1, 2, 1)],
					col.segments = mypal[c(1, 2, 1)])
		panel.abline(v = 50, col.line = 'red', lty = 2)}
)

_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/



More information about the R-help mailing list