[This article was first published on Timely Portfolio
, and kindly contributed to R-bloggers
]. (You can report issue about the content on this page here
Want to share your content on R-bloggers? click here
if you have a blog, or here
if you don't.
for background please see prior posts More on Horizon Charts, Application of Horizon Plots, Horizon Plot Already Available, and Cubism Horizon Charts in R
There are three primary graphics routes in R (base graphics, lattice, and ggplot2), and each have their zealots. Last time in More on Horizon Charts, I used lattice and latticeExtra. This time we will build horizon plots in base graphics, and I was pleased with the result. Unfortunately, there is one small issue in that the points of change from positive to negative overlap. Please let me know if you have a solution.
Now, let’s implement a for loop and mirror the negative values.
With horizon chart functionality in base graphics, hopefully we can add this type now to other packages. Here is a potential example using quantmod.
R code in GIST (do raw for copy/paste)