In this section, we'll generate some numbers and plot them as Cartesian and polar coordinates.
Let's begin by implementing the following steps:
- Generate angles between 0-360, in intervals of 15:
t <- seq(0, 360, by=15).
- Define another variable - the radius r:
r <- 2.
- Use qplot to plot the vectors in Cartesian coordinates (Plot1). What do you see? Write your answer as a comment in the code:
qplot(r,t)
Your first plot should look like plot 1.
- Use qplot to plot the vectors in polar coordinates. What do you see? Write your answer:
qplot(r,t)+coord_polar(theta="y").
- Use scales to change the labeling and make it look like plot 3. Here, we define the range from 0-360, with breaks of 30:
qplot(r,t)+coord_polar(theta="y")+scale_y_continuous(breaks=seq(0,360,30)).
Refer to the complete code at https://goo.gl/RheL2G.
Plot 1 is as follows:

Plot 2 is as follows:

The final plot is as follows:

Various label formats are available, and you can change label formats as well. The following label formats are available:
- scales::comma_format() adds commas, in order to make it easier to read large numbers.
- scales::unit_format(unit, scale) adds a unit suffix and optionally, scaling.
- scales::dollar_format(prefix, suffix) displays currency values, rounding to two decimal places and adding a prefix or suffix.
- scales::wrap_format() wraps long labels into multiple lines.
We will combine all of the preceding commands to make a single plot.