Skip to content
R for the Rest of Us Logo

Data encoding process

This lesson is locked

Get access to all lessons in this course.

If the video is not playing correctly, you can watch it in a new window

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

Using the plastic pollution dataset, follow the data encoding process to design one or multiple charts. Try to think outside the box a bit and go beyond just a line or bar chart.

Slides

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Erick Kiprotich Yegon

Erick Kiprotich Yegon

January 11, 2023

i tried a lollipop chart. I could not have it arranged by descending order below is my code

Plot

grand_pastics_tbl %>% filter(!is.na(grand_total)) %>% arrange(desc(grand_total)) %>% head(20) %>% mutate(country=factor(country)) %>% ggplot( aes(x=country, y=grand_total) ) + geom_segment( aes(x=country ,xend=country, y=0, yend=grand_total), color="grey") + geom_point(size=3, color="#69b3a2") + coord_flip() + theme( panel.grid.minor.y = element_blank(), panel.grid.major.y = element_blank(), legend.position="none") + #Add all my labels labs(title = "Top 10 Countries contributing to total Plastic Pollutions Worldwide", subtitle = "Out of all cleanup events in 2019 and 2020, these 10 countries had the most plastic items that were made by the company.", caption = "Data from breakfreefromplastic.org | Viz by Erick Yegon|Glamour of Graphics Courseby RfortheRest of Us", y = "Grand total count (all types of plastic)", x = "Country") +

#All theme elements theme(legend.position ="none", panel.background = element_blank(), #remove gray background axis.text.y = element_text(face = "bold", size = 10), #no y-axis tick labels axis.ticks.y = element_blank(), #no y-axis tick marks axis.ticks.x = element_blank()) #no x-axis tick marks

Yuri Zharikov

Yuri Zharikov

January 24, 2023

Wondering if you can suggest a way to map data to a symbol. E.g. to plot a bird abundance value not as a bar or point but as a bird symbol, e.g. a lollipop with a bird at the end.