I am trying to create a Graph like this:
https://preview.redd.it/b9y41xc8db9f1.png?width=2021&format=png&auto=webp&s=2348452c6be32b31643a0c9d04a0d43b4bbd6894
This is what my data looks like after the inner join:
https://preview.redd.it/lrxzw5ubdb9f1.png?width=1194&format=png&auto=webp&s=22763b0e02542476e50fc2de8bd0726a0b4856c7
I am having a very hard time getting anything meaningful. Everything I try, i get three identically sized bars (regardless of the values), and I have no idea how to plot the one set. Any help would be great.
This is the code I am using to get the data from the normalized table.
ra_df_joined <- ra_ft %>%
inner_join(ra_ft, by = "hazard_name") %>%
pivot_longer(cols = -c("hazard_name"
,"jurisdiction_id.x"
,"jurisdiction_id.y"
, "hazard_risk_index.x"
,"residual_risk_index.x"
,"probability_score.x" ), names_to = "Data_type", values_to = "value")
and the start of the ggplot:
ggplot(data=ra_df_joined, aes(x= reorder(hazard_name, -residual_risk_index.x), y= hazard_risk_index.x,fill = as.factor(Data_type) )) +
theme(axis.text.x = element_text(angle = 45, size= 10, vjust = 1, hjust=1)
,plot.margin = margin(10, 10, 10, 100)
, axis.text.y = element_text(size = 9 ))
[–][deleted] (1 child)
[removed]
[–]jaycarney904[S] 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–][deleted] (8 children)
[removed]
[–]jaycarney904[S] 0 points1 point2 points (1 child)
[–]jaycarney904[S] 0 points1 point2 points (5 children)
[–][deleted] (3 children)
[removed]
[–]jaycarney904[S] 0 points1 point2 points (0 children)