[R] Stripchart colors don't vary after I sort a data frame

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Dec 2 16:57:54 CET 2012



On 28.11.2012 18:27, Thomas Levine wrote:
> # Hi,
>
> # This plot has two colors.
>
> overflow <- read.csv('http://chainsaw.thomaslevine.com/overflow.csv',
> stringsAsFactors = F)
> png('original.png')
> stripchart(overflow$precipi ~ overflow$after.9.am, method='stack', pch =
> 22, bg = overflow$overflow + 1, vertical = T, col = 0)
> dev.off()
>
> # I wanted continuous bands of color, so I sorted the data frame.
> # But after sorting, it only had one color.
>
> overflow.sorted <- overflow[order(overflow$overflow),]
> png('sorted.png')
> stripchart(overflow.sorted$precipi ~ overflow.sorted$after.9.am,
> method='stack', pch = 22, bg = overflow.sorted$overflow + 1, vertical =
> T, col = 0)
> dev.off()
>
> # What's wrong?


All red are hidden by the black strips, perhaps you want to order it the 
other way round, i.e.:
  overflow.sorted <- overflow[order(rev(overflow$overflow)),]
do not understand the data and you aim well enough after 5 seconds, 
hence it may not be what you aim at...

Uwe Ligges

> # Here are all of the files.
> # http://chainsaw.thomaslevine.com/overflow.csv
> # http://chainsaw.thomaslevine.com/original.png
> # http://chainsaw.thomaslevine.com/sorted.png
>
> # Thanks
> # Tom
>
> ______________________________________________
> 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