Realtime Plotting made simple using gnuplot
So, I was stuck in tuning the hyperparameters for a DQN agent when a problem struck me! I needed graphs to reliably compare as well as view the whole performance of the agent in all the episodes. gnuplots was the way forward. Lightweight, simple and fast.
The syntax is as follows:
plot 'plotRewards.dat' using 1:2 with lines
pause 0.5
reread
set autoscale
The plotRewards.dat
is the file storing the data that was written it the relevent program in the format of every datax y
on a new line.
The pause
lets you specify the break in seconds (Self-explanatory).
Coming to reread
is the most important part for realtime plotting as this tells gnuplots to re-read the above specified file again.
As the new values keep coming, they go out of range. Setting the autoscale using set autoscale
enables autoscaling in both the axis.
This is really helpful for quick insight into the loads of data which is getting published in the terminal faster than can be sanely understood.
Please Clap if you found this helpful!