Hello,
I made a histogram representing the CPUE values of my species ("Species") by stations and zones.
I would like to do 2 important manipulations.
I have many different species, so I would like to display only the 20 most abundant species (whose value of each species is in the "Number" column).
Also, in my legend I would like it to display in descending order. That is to say that the first species of the legend is the most abundant and so on because by default it displays them to me in alphabetical order.
I would also like (not urgent) to color my station names (which are in x) according to another column.
I can't give an example of dataset, it would be too complex to transcribe sorry..
Hoping you understand what I want to do.
x <- df %>%
group_by(Station)
head(x)
ggplot(x,aes(Station)) + geom_col(aes(y = Number, fill = Species),
color = "white") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
scale_fill_manual(name = "Species",values=col)
Created on 2022-06-02 by the reprex package (v2.0.1)
Thanks