I am trying to save matplotlib to my S3 bucket on AWS.
I use the savefig()
function like so:
import matplotlib.pyplot as plt
f = plt.figure()
plt.plot(some figure)
f.savefig("s3://bucketpath/foo.pdf", bbox_inches='tight')
But I get the path not found error
.
If I don't specify the path, it seems to work fine, but I don't know where it is saved.
I am running my code (in pyspark) using sagemaker jupyterlab and therefore running on one of the EC2 instances.
Is there a way to specify the path to save the pdf to like how one would use the write()
function when saving dataframes to an S3 bucket?
I came across this post on this site, but it is for uploading from your local client to S3 on the cloud using boto. Is there a way to save it directly to S3 without using aws access keys etc?