Plotting values from a function

Hi Maxim,
So it's easier to understand your code, could your post a fully reproducible example? The goal is to have someone else be able to take the code you posted and run it in their own R session, without it depending on any other objects, etc. that only you have access to. For example, when I tried to run the example you posted, I couldn't because you haven't defined the object x_test or the object Scaled.

For more information on how to create a reproducible example, you can see this guide: FAQ: What's a reproducible example (`reprex`) and how do I do one?