Scatter plot with ggplot2

I decided to go use ggplot2 more frequently and go through everything. For future reference I will start a series of blog posts on ggplot2.

Scatter plot:

# producing some data
data <- data.frame(x=1:10, y=rnorm(10))
# initiating a plot
p <- ggplot(data, aes(x,y))
# plotting as it is
p + geom_point()
# adjusting size of the points
p + geom_point(aes(size=2))
# making the size dynamic
p + geom_point(aes(size=y))

In my next post, I will change the axis labels.

This entry was posted in ggplot2. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s