If it were me...
How about creating a symbolic link of /usr/local/gnuplot -> actual location of the binary object for gnuplot 5.0
You will need root access to be able to create files in /usr/... files.
You can obtain this by using the sudo command.
password if sudo asks for a password.
I might mention that this is not guaranteed to work, but it might save a recompilation.
Alternatively, another method would be to tell apt-get to remove gnuplot (since it doesn't know anything about your compiled version) with
sudo apt-get purge gnuplot
Assuming your version is in your path, this is the only one which will get found (hopefully it isn't called gnuplot5.0.0 or whatever).
Of course, if gnuplot is used by any other software on your system, it will likely fail.
It's generally a bad idea to mix compiled code with stuff in repositories.
Next time you upgrade, you might have to repeat all this stuff.