Over-jittering?

33 views
Skip to first unread message

Joseph Voelkel

unread,
Nov 26, 2013, 12:17:06 PM11/26/13
to ggp...@googlegroups.com

It seems that there is over-jittering in the following example. Ideas?

 

# Read in abalone data

abalone<-read.csv(url("http://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.data"),

                header=FALSE)

names(abalone)<-c("Sex", "Length", "Diameter", "Height",

                "WholeWgt", "ShuckedWgt", "VisceraWgt", "ShellWgt", "Rings")

str(abalone)

 

# find ranges

range(abalone$Diameter) # note this range in particular

range(abalone$Rings)

 

# make 3 graphs

windows(4,4)

qplot(Diameter, Rings, data=abalone)

                # all seems fine

 

windows(4,4)

qplot(Diameter, Rings, data=abalone, position="jitter")

                # Rings: seems fine

                # But Diameter is over-jittered

 

# swap x,y

windows(4,4)

qplot(Rings,Diameter, data=abalone, position="jitter")

                # Both Rings and Diameter seem fine

 

Joe

 

 

Joseph G. Voelkel, Ph.D.

Professor, Center for Quality and Applied Statistics

Hugh Carey Bldg, 14-2530

Kate Gleason College of Engineering

Rochester Institute of Technology

V 585-475-2231

F 585-475-5959

joseph....@rit.edu

 

Roman Luštrik

unread,
Nov 26, 2013, 12:46:39 PM11/26/13
to Joseph Voelkel, ggp...@googlegroups.com
Have you tried controlling for the "width" and "height" of jitter? I would also recommend you add some transparency to your plot to show the more dense group in the middle. Something along the lines of 

ggplot(abalone, aes(x = Diameter, y = Rings)) +
  theme_bw() +
  geom_jitter(position = position_jitter(width = 0.1, height = 0.25), alpha = 0.25)

Cheers,
Roman




--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
 
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
In God we trust, all others bring data.

Jeremy Miles

unread,
Nov 26, 2013, 12:45:05 PM11/26/13
to Joseph Voelkel, ggp...@googlegroups.com

You can have finer control of jittering with the geom_jitter() function. http://docs.ggplot2.org/0.9.3.1/geom_jitter.html

That might be a solution.

Jeremy


--
Reply all
Reply to author
Forward
0 new messages