# ggdogs on ggplot2

**Data Science Tutorials**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The post ggdogs on ggplot2 appeared first on Data Science Tutorials

What do you have to lose?. Check out Data Science tutorials here Data Science Tutorials.

ggdogs on ggplot2, With the help of the function instead of, you may use the package to add dog-related photos in place of dots in ggplot2.

ggdogsgeom_doggeom_point

You can send any of the sentences listed above to the feature to use the associated dog images. There are currently 15 different breeds of dogs accessible, called (by default),.

How to Add a caption to ggplot2 Plots in R? (datasciencetut.com)

"doge""doge_strong""chihuahua""eyes""gabe""glasses""tail""surprised""thisisfine""hearing""pug""ears""husky""husky_2""chilaquil"

All of the dogs are shown in the following figure:

install.packages("remotes") remotes::install_github("R-CoderDotCom/ggdogs@main") library(ggdogs) install.packages("ggplot2") library(ggplot2) grid <- expand.grid(1:5, 3:1) df <- data.frame(x = grid[, 1], y = grid[, 2], image = c("doge", "doge_strong", "chihuahua", "eyes", "gabe", "glasses", "tail", "surprised", "thisisfine", "hearing", "pug", "ears", "husky", "husky_2", "chilaquil")) ggplot(df) + geom_dog(aes(x, y, dog = image), size = 5) + geom_text(aes(x, y - 0.5, label = image), size = 2.5) + xlim(c(0.25, 5.5)) + ylim(c(0.25, 3.5))

**Making dog-themed graphics using geom_dog**

The function can be used in the same way as when given a data frame. The primary distinction is that default points have been replaced with Doge dogs.

Note that the function’s argument allows you to change the size of photos.

5 Free Books to Learn Statistics For Data Science – Data Science Tutorials

geom_doggeom_pointsize

Additionally, you can combine typical charts with. In the example below, we’re making a scatter plot with a picture of a dog and some text.

set.seed(123) df <- data.frame(x = 1:10, y = rnorm(10)) ggplot(df, aes(x = x, y = y)) + geom_point(size = 3, color = 4) + geom_dog(aes(x = 7, y = -0.5), dog = "thisisfine", size = 5) + geom_label(aes(x = 7.75, y = -0.1, label = "datasciencetut.com"))

Be aware that you can send that column as an argument so that each point has the appropriate dog if your data frame contains a column with the dog name matching each data point.

set.seed(123) df <- data.frame(x = 1:10, y = rnorm(10), dog = c(rep("husky", 5), rep("gabe", 5))) ggplot(df, aes(x = x, y = y, dog = dog)) + geom_dog(size = 5)

The final illustration displays a number of Doge canines.

How to make a rounded corner bar plot in R? – Data Science Tutorials

set.seed(123) df <- data.frame(x = 1:10, y = rnorm(10), dog = c(rep("husky", 5), rep("gabe", 5))) ggplot(df, aes(x = x, y = y)) + geom_dog(size = 2.5) + geom_dog(aes(x = 5, y = 0.25, dog = "doge_strong"), size = 12)

The post ggdogs on ggplot2 appeared first on Data Science Tutorials

Learn how to expert in the Data Science field with Data Science Tutorials.

**leave a comment**for the author, please follow the link and comment on their blog:

**Data Science Tutorials**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.