# [R Graphics] Beautiful graphics thread

#### hlsmith

##### Less is more. Stay pure. Stay poor.
DV_man, what is on your y-axis: hand to junk ratio, or the opposite?

Side note, "riverplots" look cool. Sorry for not uploading a pic, but I always think of the French army/ Russia graph - if I am remembering the parties correctly.

#### DV Man

##### New Member
DV_man, what is on your y-axis: hand to junk ratio, or the opposite?

Side note, "riverplots" look cool. Sorry for not uploading a pic, but I always think of the French army/ Russia graph - if I am remembering the parties correctly.
Lol. On-Base Percentage. I don't know why it wasn't included

#### DV Man

##### New Member
Plotting the home run rates (HR/AB) of Hall of Famers for each era of MLB using a strip chart.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
DV Man, I know you are loving these graphs, but this last one means nothing to me. Can you incorporate years to the labels and why aren't there the same number of circles per epoch? If a different number of MVR, then should you standardize? Though, it could just be that I am not the desired audience (don't watch baseball). Also confidence intervals would be nice.

#### DV Man

##### New Member
DV Man, I know you are loving these graphs, but this last one means nothing to me. Can you incorporate years to the labels and why aren't there the same number of circles per epoch? If a different number of MVR, then should you standardize? Though, it could just be that I am not the desired audience (don't watch baseball). Also confidence intervals would be nice.
There's a different number of circles because there's a different number of Hall of Famers per each generation.

#### DV Man

##### New Member
Here's the velocity (in MPH) of Justin Verlander's pitches since 2006 (when PITCH F/X data became available). The velocity is on the bottom, and the density is on the y-axis. The five different bars are the different pitch types (slider, two-seam fastball, four-seam fastball, curveball, and change-up).

#### DV Man

##### New Member
Scatterplot of OPS against age for Mickey Mantle with a quadratic fit added. The location of the peak age and the maximum OPS fit are displayed.

#### Buckeye

##### Member
Thank you for sharing DV Man. I really like the Verlander plot. Although, I'm a Cleveland Indians fan...

#### DV Man

##### New Member
Thank you for sharing DV Man. I really like the Verlander plot. Although, I'm a Cleveland Indians fan...
Jose Ramirez == Michael Brantley (at least this season, in R terms)

#### DV Man

##### New Member
Nice jamesmartinn! I'll have to look into that. Here's a graphic I just made, just a simple bar chart using the coord_flip() function. It shows the average number of runs scored at a game at Coors Field in Colorado in 2010.

#### bugman

##### Super Moderator
So I recently updated this plot to include rainfall for 2015-2016 rain period. I originally posted this plot in a thread that trinker was following to help point me in the right direction.
I saw this plot: http://www.datapointed.net/2012/02/san-francisco-rain-year-before-after-valentines-day/
And thought that it had a very practical use for me on a project I am currently working on, more than that, I just think it looks great.
I emailed the author of the plot for the R-code and was told that he wrote it using java (If I recall correctly). Never used java, so my “project” was to work out how to do it in R.
Attached is the result.

#### trinker

##### ggplot2orBust
@bugman you're using geom_text for the labels. I realize you're repeating the labels (I think) way more times than necessary, hence the very bold, somewhat fuzzy nature of the text (though I may be wrong and this is just a product of viewing it in the browser). You can pass a reduced data set to geom_text via the data argument and eliminate multiple texts being plotted to the same space. Love the plot.

#### bugman

##### Super Moderator
Thanks trinker, yeah I am using geom_text and that made for some ugly code. I have just revisited this and plan to tidy it up some more.

#### bugman

##### Super Moderator
browser). You can pass a reduced data set to geom_text via the data argument and eliminate multiple texts being plotted to the same space.
Could perhaps give me an example? I'm not entirely clear on what you mean.

#### DV Man

##### New Member
Some of my recent illustrious, vaunted, and; as always, juicy graphics:
First, a cluster dendrogram of log(mammals) data by nearest neighbor method. Next, I used (cow, wolf), (wolf, human) and (cow, human). The three points form a triangle, so I drew the segments between them using polygon. Lastly, and the juiciest graphic of all, I displayed side-by-side box plots of the weights of chicks for the six different types of feeds in the chickwts data set.

Code:
#Cluster

big <- subset(mammals, subset=(body > median(body)))

d <- dist(log(big))
h <- hclust(d, method = "complete")

plot(h)

#Polygon

plot(log(mammals$body), log(mammals$brain),
xlab = "log(body)", ylab = "log(brain)")

y <- log(mammals[c("Grey wolf", "Cow", "Human"),])
polygon(y)

#chickwts # most juicy

boxplot(weight ~ feed, chickwts)

Last edited:

#### TheEcologist

##### Global Moderator
Some of my recent illustrious, vaunted, and; as always, juicy graphics:
First, a cluster dendrogram of log(mammals) data by nearest neighbor method. Next, I used (cow, wolf), (wolf, human) and (cow, human). The three points form a triangle, so I drew the segments between them using polygon. Lastly, and the juiciest graphic of all, I displayed side-by-side box plots of the weights of chicks for the six different types of feeds in the chickwts data set.
Hi DV man,

Always happy for people to share graphics in the thread, but it would be particularly useful if you could also share the code with the graphics - this way people with less experience can recreate the graphics posted. This was the original intention of this thread.

Best would be if you use the $$Code:  [/ code][/math] tags to insert blocks of code that run with a single copy&paste on any system. Edit your posts if you would like to add them. TE$$