Sharing legends across two plots

I assume your have a full list of categories. I would assign a color to each of these categories, for example using a dictionary.

Here an example: