Error in plot.window(xlim, ylim, log, ...) : need finite 'ylim' values

Hi, welcome!

When asking programming related questions you have to be more specific, saying "I have tried X and Y but neither work", doesn't give us any information to help you out, we need to know what code are you running and what error messages you are getting so, Could you ask this with a minimal 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: