Plotly’s R graphing library makes interactive, publication-quality web graphs. More specifically it gives us the ability to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, and 3D charts.
In this tutorial we are going to make a first step in plotly’s world by learning to create some basic charts enhanced with proper layouts that the plotly package provides.
Before proceeding, please follow our short tutorial.
Look at the examples given and try to understand the logic behind them. Then try to solve the exercises below using R and without looking at the answers. Then check the solutions.
to check your answers.
For other parts of this series follow the tag plotly visualizations
Create a line plot of x and y. HINT: Use
mode = "lines".
Create a scatter plot of x and y. HINT: Use
mode = "markers".
Create a bar plot of x and y. HINT: Use
type = "bar".
Create a bubble chart of x and y. Choose size and color of your choice for every marker. HINT: Use
Create a heatmap of the “volcano” dataset. HINT: Use z.
Create an area plot of x and y. HINT: Use
fill = "tozeroy".
Add y3 to the scatterplot of Exercise 2. Then create your scatter plot with trace. HINT: Use
Transform the trace you added in Exercise 7 into legend with coordinates(1,1) and red color. HINT: Use
Add axes to the scatterplot you built in Exercise 2. Set
nticks to 40, add
showline, give a
title and set
mirror to “all”. HINT: Use
nticks to 20 and remove
showline to spot the differences.
- Become a Top R Programmer Fast with our Individual Coaching Program
- Explore all our (>4000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below