File:Dogplot.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this preview: 800 × 600 pixels. Other resolutions: 320 × 240 pixels | 640 × 480 pixels | 1,024 × 768 pixels | 1,280 × 960 pixels | 2,560 × 1,920 pixels | 3,600 × 2,700 pixels.
Original file (3,600 × 2,700 pixels, file size: 428 KB, MIME type: image/png)
File information
Structured data
Captions
Summary
[edit]DescriptionDogplot.png |
English: Graph of dog age versus equivalent human age, grouped by dog size |
Date | |
Source | Own work |
Author | GeneParmesan66 |
Code used to generate plot:
# Dog years chart for wiki
library(tidyverse)
library(RColorBrewer)
# Create data
# Data from: https://pets.webmd.com/dogs/how-to-calculate-your-dogs-age
dog_years = c(1:16)
human_small = c(15, seq(24,80, by=4))
human_med = c(15, 24,28,32,36,42,47,51,56,60,65,69,74,78,83,87)
human_large = c(15,24,28,32,36,45,50,55,61,66,72,77,82,88,93,120)
# Get colours for plot
dcols <- brewer.pal(3, "Set1")
# Create data frame
data_frame(dog_years, human_small, human_med, human_large) %>%
# Gather the different columns to make group variable
gather(key = size, value = human_years, human_small:human_large, factor_key = T) %>% arrange(dog_years) %>%
# START PLOTTING
ggplot(., aes(x=dog_years,y=human_years, group=size,colour=size))+geom_smooth(se=F)+
# Label the legend
scale_colour_manual(name = "Size of Dog",values=dcols,labels = c("Small (<20lb)","Medium (21-50lb)","Large (>50lb)"))+
# Scale breaks and labels
scale_x_continuous(breaks=c(seq(2,16,2)))+
scale_y_continuous(breaks = c(seq(0,120,10)))+
xlab("Dog's age")+ggtitle("Equivalent human age")+
# Theme attributes
theme(plot.background=element_blank(),
panel.grid.major = element_line(colour = "lightgray"),
axis.title = element_text(face="bold",size=15),
axis.title.y=element_blank(),
plot.title = element_text(size = 15, face="bold", hjust=-0.05),
plot.margin = unit(c(1,1,1,1),"cm"),
legend.text = element_text(size = 11),
legend.title = element_text(face="bold",size=12),
legend.position="right")
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 01:48, 25 April 2018 | 3,600 × 2,700 (428 KB) | GeneParmesan66 (talk | contribs) | Flipped legend for more intuitive understanding and increased axis label size | |
01:19, 25 April 2018 | 3,600 × 2,700 (411 KB) | GeneParmesan66 (talk | contribs) | Clearer axis labels and text (hopefully) | ||
01:03, 25 April 2018 | 1,200 × 900 (94 KB) | GeneParmesan66 (talk | contribs) | User created page with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Hidden categories: