简体   繁体   中英

What is the difference between ggplot and ggplot2?

everyone! I am new to . I have a disease rate data from different counties and I want to visualize them on the map.

I follow the instructions on this website: https://socviz.co/maps.html

I wanted to try their example first but R gave me a wrong message:

> p <- ggplot(data = county_full,
        mapping = aes(x = long, y = lat,
                      fill = pop_dens, 
                       group = group))

Error in ggplot(data = county_full, mapping = aes(x = long, y = lat, : could not find function "ggplot"

I want to install the ggplot but it said:

Warning in install.packages :package 'ggplot' is not available (for R version 3.6.1)

I don't know how to modify the code so that I can use to try their examples.

Thanks!

This rounds up the idea by @dc37:

library(ggplot2)
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point()

ggplot2 is the package and ggplot() is the main function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM