1. Learn
  2. /
  3. Courses
  4. /
  5. Plotly Tutorial: Plotly and R

Exercise

From the bar to the box: the box plot

In the final exercise of this chapter, you will make an interactive box plot in R.

Using plotly, you can create box plots that are grouped, colored, and that display the underlying data distribution. The code to create a simple box plot using plotly is provided on your right.

Note how you use type= "box" in the function plot_ly() to create a box plot. Make sure to run the code (plotly is already loaded in).

Instructions

100 XP
  • Create a second, more fancy, box plot using diamonds. The y-axis should represent the price. The color should depend on the cut.
  • Create a third box plot where you bucket the diamonds not only by cut but also by clarity. The color should depend on the clarity of the diamond.