I am trying to reorder plot first by am
and then by mpg
. Attached in the result in R using ggplot2.
I trying to attain the same result using siuba and plotnine. Below is my code so far.
(
mtcars
>> arrange(_.am, _.mpg)
>> mutate(model = fct_reorder(_.model, _.am))
>> ggplot(aes(y="mpg", x="model", fill='factor(am)'))
+ geom_col()
+ labs(fill = "Automatic/Manual Transmission")
+ coord_flip()
)