R Script: Using ggplot to make a pie chart of continent areas

Поделиться
HTML-код
  • Опубликовано: 24 авг 2023
  • In this video we use the ggplot2 library to make a pie chart of the areas of the continents (Asia, Africa, etc.). We read a csv to create a data frame. We added columns to the data frame and sorted the data frame on one of its columns. We used the ggplot() and geom_bar() to make a stacked bar chart. We used the labs() method to add a title and the guides() method to change the legend title. We used the geom_text() method to label the sections with percentages. We used the scale_fill_manual() method to control the section colors. We took out the grid with the theme_void() method. Finally we used the coord_polar() method to turn the stacked bar plot into a pie chart.

Комментарии • 1

  • @thomasblum9803
    @thomasblum9803  10 месяцев назад

    www1.lasalle.edu/~blum/c152wks/R_continent_pie_ggplot.zip