НачатьНачать бесплатно

A first stacked bar chart

In this exercise, your task is to create a stacked bar chart to investigate whether there is an association between the Genre and Rating of video games.

Be sure to investigate what happens when you click on the color swatches in the legend.

Note that plotly has already been loaded for you.

Это упражнение является частью курса

Interactive Data Visualization with plotly in R

Посмотреть курс

Инструкции к упражнению

  • Create a stacked bar chart of counts with Genre on the x-axis and Rating used to color in the bars.

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# Filter out the 2016 video games
vg2016 <- vgsales %>%
	filter(Year == 2016)

# Create a stacked bar chart of Rating by Genre
vg2016 %>%
	count(___, ___) %>%
	plot_ly(x = ___, y = ___, color = ___) %>%
  	___() %>%
  	layout(barmode = ___)
Редактировать и запускать код