Skip to content

Issue with plot_catchCompSpp #12

@pdolder

Description

@pdolder

Hi,

I am working with this function but have found issues with how the labels for the plots are hard-coded.

Basically, if a region does not have landing for one of the species in the label list, the colours end up being mislabelled.

As a short-term fix, I created as table with the species codes and names:

spp_names <- data.frame(Code= sort(unique(dat$MIXFISHspp)), name =
c("Anglerfishes","Brill","Cod","Dab","Flounder","Gurnards","Haddock","Hake","Lemon sole",
"Megrims","Ling","Norway lobster","Norway pout","Plaice","Saithe","Pollack","Smoothhounds",
"Skates and rays","Sole","Turbot","Whiting","Witch"))

And then passed that to the function, redefining the colour scale as

stkColorScale <- scale_colour_manual(name = "Species", values = col.pal.MFspecies[which(spp_names$Code %in% data$MIXFISHspp)],
aesthetics= c("colour", "fill"),
labels = spp_names$name[which(spp_names$Code %in% data$MIXFISHspp)])

This ensures that the same colours get used for the same species in each region.

But the answer is probably a lookup table within the package (or externally passed) that can be used consistently across all FO regions ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions