no able to produce a legend

You have to map your variables to an aesthetics (shape, color, etc.) to get an automatic legend, this could be achieved by reshaping your dataframe to a long format before plotting or you could manually add some scales to get a legend.

We could give you more specific help if you provide a reproducible example, could you please turn this into a self-contained REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ: