A Waterfall Chart is a form of data visualization which helps in determining the cumulative effect of sequentially introduced positive or negative values – Wikipedia
Waterfall charts can be used in many areas including inventory analysis, profit-loss analysis, and sales analysis.ย Excel is a popular tool used for creating waterfall charts. But R gives us a quick easy way to create these charts!
We are going to visually understand a profit and loss statement by creating a waterfall chart. Letโs first create a dataset in R, which talks about the different sources of income and cost.
Now letโs proceed with some data preparation steps in R.
Next we create two columns called start and end.
We are going to use the function ggplot, to plot the different metrics of a P&L statement (balance dataset which we have created).It also gives us the range for every type of cash flow (in,out or net)
Letโs first look at the various components of a ggplot to understand better:
The beauty of plotting charts using ggplot is that we can add functions as layers. we can add layers to our chart using the โ+โ symbol. For example in the chart shown above,we have used the ggplot function to first plot desc variable.Next,we have added another layer using the geom_rect which specifies that the type of chart is rectangles. Also we have specified what values these rectangular bars should take using the variables ymin and ymax (ymin=end, ymax=start)
So hereโs your waterfall chart! You can also refer to the following link to add different kinds of layers to your chart.
https://docs.ggplot2.org/current/
Related Articles:
ย Examples of How R is Used Stringi Package in R
Fill in the details to know more
Important Artificial Intelligence Tools
October 31, 2022
Top 28 Data Analytics Tools For Data Analysts | UNext
September 27, 2022
Stringi Package in R
May 5, 2022
Best Frameworks In Java You Should Know In 2021
May 5, 2021
Lean Management Tools: An Ultimate Overview For 2021
May 4, 2021
Talend ETL: An Interesting Guide In 4 Points
Add your details:
By proceeding, you agree to our privacy policy and also agree to receive information from UNext through WhatsApp & other means of communication.
Upgrade your inbox with our curated newletters once every month. We appreciate your support and will make sure to keep your subscription worthwhile