[R] Color in stripchart

Rasmus Liland jr@| @end|ng |rom po@teo@no
Wed Mar 10 15:15:06 CET 2021

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)
	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')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: robin.png
Type: image/png
Size: 38927 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210310/5862f5ba/attachment.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210310/5862f5ba/attachment.sig>

More information about the R-help mailing list