Introduction to the Tidyverse
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner

    Introduction to the Tidyverse

    Run the hidden code cell below to import the data used in this course.

    # ggplot scatter point kode 
    ggplot(gapminder_1952,aes(x=gdpPercap, y=lifeExp, color = continent, size = pop))+
    geom_point()+
    scale_x_log10()

    ggplot2

    gapminder_1952 = det datasæt hvorfra grafen generes

    aes = Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms. Aesthetic mappings can be set in ggplot() and in individual layers.

    x, y, color, size er argumenter i aes der fortæller hvordan de forskellige variabler skal visualiseres.

    geom_point = fortæller ggplot at grafen skal laves som et scatterplot

    scale_x_log10(): gør X-aksen logaritmisk scale_y_log10(): gør Y-aksen logaritmisk

    # Faecting 
    

    ** Faceting**

    faceting kan opdele et plot i flere mindre plot via en given variabel