I am learning how to use dotchart as an alternative to bar chart. I have the following data set, please use the link;[https://www.dropbox.com/s/ytjd5t4xej87dqm/data.csv?dl=0]
The goal is to plot the crime percent by year, faceted by crime type (i.e. Primary.Type). There are two primary goals, sort the crime percent for each crime type, and reduce the size of the axis labels.
Here is my code to achieve this;
ggdotchart(street_crime_year_pct %>% arrange(Primary.Type,crime_percent),x="Year",y="crime_percent", color="tomato", facet.by = c("Primary.Type"), dot.size=2,rotate=TRUE, ggtheme=theme_pubr())+ labs(x="Type of Criminal Activity",y="Crime Percent", title="Yearly Trend of Different types of Crimes on Streets of Chicago")
This code gives me the following output;
As seen , the values are not sorted despite of using
arrange. Moreover we can't read the values for
Yearproperly. Can I kindly get help to sort these two issues?thanks in advance.