Skip to content

Instantly share code, notes, and snippets.

@digi0ps
Created December 5, 2017 10:17
Show Gist options
  • Save digi0ps/e65a9402db54f241e4c876478408904e to your computer and use it in GitHub Desktop.
Save digi0ps/e65a9402db54f241e4c876478408904e to your computer and use it in GitHub Desktop.
DataVizLab1
Age Group No. of Loans Bad Loans Good Loans Bad Rate
21-24 310 14 296 4.5
24-27 511 20 491 3.9
27-30 4000 172 3828 4.3
30-33 4568 169 4399 3.7
33-36 5698 188 5510 3.3
36-39 8209 197 8012 2.4
39-42 8117 211 7906 2.6
42-45 9000 216 8784 2.4
45-48 7600 152 7448 2
48-51 6000 84 5916 1.4
51-54 4000 64 3936 1.6
54-57 2000 26 1974 1.3
57-60 788 9 779 1.1

Visualization of the Given Data

Data Viz Lab 01

Sriram

16BCE1026

Before this, import the given csv data by clicking import dataset on the top right corner.

Let's assume it's imported as dataz. Then type the following code into your editor.

p1 <- ggplot(data=dataz, aes(x=dataz$Age.Group, y=dataz$No..of.Loans)) + geom_bar(stat="identity", width=0.4, color="white", fill="white")
p2 <- ggplot(data=dataz, aes(x=dataz$Age.Group, y=dataz$Bad.Loans)) + geom_bar(stat="identity", width=0.4, color="white", fill="steelblue")
p3 <- ggplot(data=dataz, aes(x=dataz$Age.Group, y=dataz$Good.Loans)) + geom_bar(stat="identity", width=0.4, color="white", fill="red")
p4 <- ggplot(data=dataz, aes(x=dataz$Age.Group, y=dataz$Bad.Rate)) + geom_bar(stat="identity", width=0.4, color="white", fill="gold")
p1
p2
p3
p4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment