Description Usage Arguments Value Cosmetic Tips Also See Examples
View source: R/ggplot_waterfall.R
A waterfall plot highlights the change in the time series rather than the value of the time series itself.
1 2 | ggplot_waterfall(dtData, cXColumnName, cYColumnName, nArrowSize = 0.25,
vcGroupingColumnNames = NULL)
|
dtData |
Data set which may include other columns apart from the columns mapped to x and y . |
cXColumnName |
Column name of the x mapping. |
cYColumnName |
Column name of the y mapping. |
nArrowSize |
the size of the arrow head on the plot in cm |
vcGroupingColumnNames |
The set of columns which together define the group for the chart to operate between. If you plan to facet your plot, you should specify the same column names to this argument. |
Returns a gpplot friendly object which means the user can use ggplot scales to modify the look, add more geoms, etc.
The minimalist look can be achieved by appending the
following chunk of code to the output object:
+
xlab(NULL) +
ylab(NULL) +
scale_fill_continuous(low = 'green', high = 'red') +
theme(
axis.text = element_blank(),
axis.ticks = element_blank(),
legend.position = 'none',
strip.background = element_blank(),
# strip.text = element_blank(), # useful if only one year of data
plot.background = element_blank(),
panel.background = element_blank(),
panel.border = element_blank(),
panel.grid = element_blank(),
panel.border = element_blank()
)
stat_waterfall
, a
flexible but less polished alternative.
1 2 3 4 5 6 7 8 9 | {
library(ggplot2)
set.seed(1)
dfData = data.frame(x = 1:100, y = cumsum(rnorm(100)))
ggplot_waterfall(
dtData = dfData,
'x',
'y'
)}
|
Loading required package: ggplot2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.