Answers for "saving 3D plots on python as png"

2

python code for where to save the figures

#where to save the figures
PROJECT_ROOT_DIR = "."
CHAPTER_ID = "classification"
IMAGES_PATH = os.path.join(PROJECT_ROOT_DIR, "images", CHAPTER_ID)
os.makedirs(IMAGES_PATH, exist_ok = True)

def save_fig(fig_id, tight_layout=True, fig_extension="png", resolution=300):
    path = os.path.join(IMAGES_PATH, fig_id + "." + fig_extension)
    print("Saving figure", fig_id)
    if tight_layout:
        plt.tight_layout()
    plt.savefig(path, format=fig_extension, dpi=resolution)
Posted by: Guest on April-04-2020
-2

savefig matplotlib python

import matplotlib.pyplot as plt
plt.figure()
plt.plot([1,2,3],[1,2,3])
plt.savefig("out.png")
Posted by: Guest on March-21-2020
0

saving 3D plots on python as png

I can't get this to work. Do I need to modify the paths or anything? ALso, when I try to run the save_fig, it needs the fig_id. I don't knoww what this is.
Posted by: Guest on July-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language