Site icon R-bloggers

Horizon Plots in Base Graphics

[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.

< size="1">for background please see prior posts < >< size="1">More on Horizon Charts< >< size="1">, < >< size="1">Application of Horizon Plots< >< size="1">, < >< size="1">Horizon Plot Already Available< >< size="1">, and < >< size="1">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 < size="2">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.

From TimelyPortfolio
From TimelyPortfolio
From TimelyPortfolio
From TimelyPortfolio
From TimelyPortfolio
From TimelyPortfolio
From TimelyPortfolio

Now, let’s implement a for loop and mirror the negative values.

From TimelyPortfolio

With horizon chart functionality in base graphics, hopefully we can add this type now to other packages.  Here is a potential example using quantmod.

From TimelyPortfolio

 

R code in GIST (do raw for copy/paste)

To leave a comment for the author, please follow the link and comment on their blog: Timely Portfolio.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.