MulaiMulai sekarang secara gratis

Beyond color: Symbols

Using both color and shape to encode a categorical variable can be a useful strategy to reveal relationships more effectively. This double-encoding strategy uses two pre-attentive visual cues to more-quickly communicate information to the reader. This idea is implemented by default in plotly; if you map a variable to the symbol, plotly automatically maps the variable to the color.

To map a variable to the plotting shape, add a symbol argument to the plot_ly() command.

Caution: It is poor practice to use color and shape to communicate different variables, since the two features have been shown to interfere with each other, making it more difficult to distinguish either variable.

Latihan ini adalah bagian dari kursus

Interactive Data Visualization with plotly in R

Lihat Kursus

Petunjuk latihan

  • Use the vgsales2016 data frame to create a scatterplot with Critic_Score on the x-axis and User_Score on the y-axis where the plotting symbol represents a game's Rating.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Create a scatterplot of User_Score against Critic_Score coded by Rating
___ %>%
   ___ %>%
   ___
Edit dan Jalankan Kode