[R] Color in stripchart

Dr. Robin Haunschild R@H@un@ch||d @end|ng |rom |k|@mpg@de
Wed Mar 10 15:49:05 CET 2021


Dear Rasmus,

there is no difference in the small exmaple, because there is only one
point per year.

If you use the example with multiple points per year, you will see the
difference.

Best, Robin


On 3/10/21 3:15 PM, Rasmus Liland wrote:
> Dear Robin and Gerrit,
> 
> I am unable to see the difference in the 
> plot in the two cases ... 
> 
> 	df <- data.frame(year = seq(2011, 2018), value = seq(10, 80, 10))
> 	df$color <- 'black'
> 	df[df$value<33,]$color <- 'blue'
> 	df[df$value>66,]$color <- 'red'
> 	
> 	file <- "/tmp/robin.png"
> 	width <- 1000
> 	height <- 1000
> 	res <- 150
> 	png(file=file, width=width, height=height, res=res)
> 	par(mfrow=c(2,1))
> 	
> 	stripchart(df$value ~ df$year, pch=18, col=df$color, method='stack', main="stripchart with color column as col")
> 	
> 	stripchart(df$value ~ df$year, pch=18, method='stack', main="stripchart with black basis")
> 	points(df[df$color=='blue',]$value, df[df$color=='blue',]$year-2010,
> 	type='p', pch=18, col='blue')
> 	points(df[df$color=='red',]$value, df[df$color=='red',]$year-2010,
> 	type='p', pch=18, col='red')
> 	
> 	dev.off()
> 
> Best,
> Rasmus
> 
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
> 


-- 
Dr. Robin Haunschild
Max Planck Institute for Solid State Research
Heisenbergstr. 1
D-70569 Stuttgart (Germany)
phone: +49 (0) 711-689-1285
fax:   +49 (0) 711-689-1292
email: R.Haunschild using fkf.mpg.de
http://www.fkf.mpg.de/ivs
Publons: https://publons.com/researcher/2845202/robin-haunschild/
GS: https://scholar.google.de/citations?user=kDfateQAAAAJ&hl=de&oi=ao



More information about the R-help mailing list