Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: python xml to csv 
Python :: python functions 
Python :: python program to add two numbers using function 
Python :: python parentheses 
Python :: hashing vs encryption vs encoding 
Python :: WebDriverWait 
Python :: delete key value in dictionary python 
Python :: generate random token or id in django 
Python :: sum all values in a matrix python 
Python :: get all subsets of a list python 
Python :: how to create 3 dimensional array in numpy 
Python :: how to make a variable 
Python :: random torch tensor 
Python :: Find the title of a page in python 
Python :: try catch in python 
Python :: pandas column filter 
Python :: good python ide 
Python :: gematria python 
Python :: pandas read excel with two headers 
Python :: check if variable is of type decimal.Decimal python 
Python :: connect to spark cluster 
Python :: check python version windows 
Python :: dataframe string find count 
Python :: validity of password in python 
Python :: How to convert string date to datetime format in python 
Python :: python pyqt5 
Python :: create pytorch zeros 
Python :: yaxis on the right matplotlib 
Python :: python script as service linux 
Python :: python how to add up all numbers in a list 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =