Black Lives Matter. Please consider donating to Black Girls Code today.

Updating plot with py.plot() not working in crontab on raspberry

I have a python script scheduled to run on my raspberry pi from sudo crontab, but tha last line of the script saving the file (py.plot) does not work. same result when replacing it with plotly.offline to save locally. The log shows script is executed and runs, but the graphs just wont update/save.

The script work as expected when I run it manually.