COMU3120 -无代写
时间:2026-05-06
COMU3120 Assessment 3: Coding and Conceptualising
Student: Kewen Zhao
Tutor: Leah Henrickson
Due date: 13/5/2024
The dataset: https://rspca.sfo2.cdn.digitaloceanspaces.com/public/Uploads/annual-
statistics/RSPCA-Australia-Annual-Statistics-2022-2023.pdf
The high cost of living in Australia has led to a notable rise in the surrender and abandonment
of pets; while popular pets like cats and dogs often find new homes in RSPCA shelters, other
animals face the unfortunate reality of being euthanised due to overcrowding; thus, this
dataset seeks to raise awareness among Australians about the challenges faced by less popular
animals (Travers & French, 2023).
Part 1:
 Visualisation 1- Barplot
Source: RSPCA, (2023), RSPCA Australia Annual Statistics
The barplot displays the outcomes of dogs received by RSPCA shelters nationwide from
2022 to 2023, arranged in descending order. 'Rehomed' claims the top spot on the chart, as the
RSPCA successfully placed nearly 8,000 dogs in new homes. It is followed by 'reclaimed',
with almost 5,000 dogs being reunited with their owners. It is evident that dogs are a
favoured choice among Australians when it comes to adopting pets. Unfortunately, the shelter
continues to euthanise around 3000 dogs. Within the community, there is a disagreement
regarding the health and treatability of some of these dogs (Chua et al., 2023).
The codes used to generate the first visualisation
#import the dataset int R
dogsreceived<-read.csv ("22-23 received dogs.csv")
#using barplot()function and 'Count' values in the dataset to make our base plot
barplot (dogsreceived$Count)
#using only the first 7 of the dataset= only dogs
barplot (dogsreceived$Count[1:7])
#naming each bar and making each label perpendicular to the axis
barplot (dogsreceived$Count[1:7], name.arg=dogsreceived$Status[1:7], las=2)
#sorting 1-7 data from the most to the least
dogsreceived_sorted<-dogsreceived[order (-dogsreceived$Count[1:7]),]
#using barplot()function again, and adding xlab, ylab,and main
barplot (dogsreceived_sorted$Count[1:7], names.arg =dogsreceived_sorted$Status[1:7],
xlab="Outcomes of dogs ", ylab="Number of dogs", las=2, main=" Dogs outcomes from
2022-2023")
#installing and activating RColorBrewer
install.packages ("RColorBrewer")
library (RColorBrewer)
#YlGnBu is the variable for the palette's first 7 colours
display.brewer.all ()
YlGnBu<- brewer.pal (7, "YlGnBu")
#adding the colours to the barplot
barplot (dogsreceived_sorted$Count[1:7], names.arg =dogsreceived_sorted$Status[1:7],
xlab="Outcomes of dogs", ylab="Number of dogs", las=2, main="Dogs outcomes from 2022-
2023", col=YlGnBu)
# extending the y-axis scale and decreasing the size of main and axis words
barplot (dogsreceived_sorted$Count[1:7], names.arg =dogsreceived_sorted$Status[1:7],
xlab=" Outcomes of dogs ", ylab="Number of dogs", las=2, main="Dogs outcomes from
2022-2023", col=YlGnBu, ylim=c(0,8000), cex.axis = 0.8, cex.names = 0.6, cex.main=0.9)
 Visualisation 2- Stacked barchart
Source: RSPCA, (2023), RSPCA Australia Annual Statistics
This stacked bar chart presents a comparison of the outcomes of various animals, including
dogs, cats, and other animals, between the years 2022 and 2023. There is no denying that a
much larger number of other animals are euthanised compared to dogs and cats, more than
doubling the count. Nevertheless, their adoption rate is significantly lower than that of dogs
and cats. Despite the financial constraints and lack of necessary infrastructure in many
Australian households, the low adoption rate of other animals like horses can be attributed to
a general disregard for their well-being.
The codes used to generate the second visualisation
#importing the same dataset into R
animalsreceived<-read.csv ("22-23 received animals.csv")
#installing and activating ggplot2
Install.packages ("ggplot2")
library (ggplot2)
#creating data
animalsreceived$Status<-factor (animalsreceived$Status, level=c ("Reclaimed", "Returned",
"Rehomed", "Currently in Care", "Transferred", "Euthanased", "Other", replace=TRUE))
animalsreceived$Animals<-factor (animalsreceived$Animals, level=c ("Dogs", "Cats",
"Other animals", replace=TRUE))
#using ggplot()function and gemo_bar() to make base stacked chart
ggplot (animalsreceived, aes (x=Status, y=Count, fill=Animals))+geom_bar (stat = "identity",
position = "stack")
#installing and activating RColorBrewer
install.packages ("RColorBrewer")
library (RColorBrewer)
#Set2 is the variable for the palette's first 3 colours
Set2<- brewer.pal (3, "Set2")
#adding the colours, legend title, title, xlab, ylab
ggplot (animalsreceived, aes(x=Status, y=Count, fill=Animals))+geom_bar (stat = "identity",
position = "stack") + scale_fill_brewer (Set2) + guides (fill=guide_legend (title="Animals"))
+ labs(title="Animals received nationally by the RSPCA for 2022-2023")+ xlab ("Outcomes
of animials")+ ylab ("Number of animals")
# tilting each label by 15 degrees along the x-axis to make labels readable, and extending
the y-axis scale
ggplot (animalsreceived, aes(x=Status, y=Count, fill=Animals))+geom_bar (stat = "identity",
position = "stack") + scale_fill_brewer (Set2) + guides (fill=guide_legend (title="Animals"))
+ labs(title="Animals received nationally by the RSPCA for 2022-2023")+ xlab ("Outcomes
of animials")+ ylab ("Number of animals")+ theme_classic()+ theme (axis.text.x =
element_text (angle=15))+ ylim (0,40000)
Training sources that I used in my self-directed learning:
R CHARTS, (2024), https://r-charts.com/part-whole/stacked-bar-chart-ggplot2/
Holtz, (n.d.), https://r-graph-gallery.com/48-grouped-barplot-with-ggplot2.html
RPubs, (2021), https://rpubs.com/techanswers88/stackedbarcharts


Part 2:
References:
Chua, D., Rand, J., & Morton, J. (2023). Stray and Owner-Relinquished Cats in Australia—
Estimation of Numbers Entering Municipal Pounds, Shelters and Rescue Groups and
Their Outcomes, 13(11). https://doi.org/10.3390/ani13111771
Holtz, Y. (n.d.). Grouped, stacked and percent stacked barplot in GGPLOT2. The R Graph
Gallery. https://r-graph-gallery.com/48-grouped-barplot-with-ggplot2.html
Palladino, V. (2013, February 6). Gun-death data boldly illustrates stolen years. Wired.
https://www.wired.com/2013/02/periscopic-gun-statistic-visualization/
R CHARTS. (2024, January 4). Stacked bar chart in GGPLOT2. A collection of charts and
graphs made with the R programming language.
https://r-charts.com/part-whole/stacked-bar-chart-ggplot2/
RPubs. (n.d.). Stacked Bar Charts. https://rpubs.com/techanswers88/stackedbarcharts
Travers, P., & French, E. (2023, May 2). “rate of abandonment unacceptable”: Animal
shelters overflowing as pet surrenders reach all-time high. ABC News.
https://www.abc.net.au/news/2023-05-02/animal-shelters-overflowing-with-record-pet-
surrenders/102284546
Zhang, Y., Reynolds, M., Lugmayr, A., Damjanov, K., & Hassan, G. M. (2022). A visual
data storytelling framework. Informatics, 9(4), 73.
https://doi.org/10.3390/informatics9040073
Appendix:
The eyes in Part 2’s visualisaton in Part 2 were taken from posts by “Faye L” on Little Red
Book (Xiaohongshu).


学霸联盟
essay、essay代写