Stata graphs are command-driven, parametric, and publication-quality with a small amount of work. The base command is twoway; line, scatter, bar, hist are the workhorses.
twoway line and scatter
twoway line lending_rate monthtwoway scatter lending_rate deposit_rate* Multiple seriestwoway (line lending_rate month) (line deposit_rate month)
Adding labels and titles
twoway (line lending_rate month) (line deposit_rate month), ///title("Kenyan commercial bank rates") ///ytitle("Rate (%)") xtitle("Month") ///legend(label(1 "Lending") label(2 "Deposit"))
histogram and kdensity
histogram lending_rate, frequencyhistogram lending_rate, normal // overlay normal densitykdensity lending_rate
bar and graph bar
graph bar (mean) lending_rate, over(year)graph bar (mean) lending_rate (mean) deposit_rate, over(year)
Saving graphs
graph export figure1.png, replacegraph export figure1.pdf, replacegraph save figure1.gph, replace // Stata's native format, can re-edit later
marginsplot — visualising regression effects
regress lending_rate deposit_rate i.yearmargins yearmarginsplot, recast(line) // shows year fixed effects
Triple-slash is the line-continuation
Stata commands are one line by default. To split across lines for readability, use /// at the end of each line. Easy to forget; very useful.
Exercise
Plot a line graph of lending_rate against month.