Chapter 2: Improvement of code in "Setup" & "Get the data"

main
pannoos 2017-10-15 14:14:05 -07:00
parent bbe33f7039
commit e287581c93
1 changed files with 6 additions and 6 deletions

View File

@ -62,14 +62,13 @@
"PROJECT_ROOT_DIR = \".\"\n",
"CHAPTER_ID = \"end_to_end_project\"\n",
"IMAGES_PATH = os.path.join(PROJECT_ROOT_DIR, \"images\", CHAPTER_ID)\n",
"FIG_EXTENSION = \"png\"\n",
"\n",
"def save_fig(fig_id, tight_layout=True):\n",
" path = os.path.join(IMAGES_PATH, fig_id + \".\" + FIG_EXTENSION)\n",
"def save_fig(fig_id, tight_layout=True, fig_extension=\"png\", resolution=300):\n",
" path = os.path.join(IMAGES_PATH, fig_id + \".\" + fig_extension)\n",
" print(\"Saving figure\", fig_id)\n",
" if tight_layout:\n",
" plt.tight_layout()\n",
" plt.savefig(path, format=FIG_EXTENSION, dpi=300)"
" plt.savefig(path, format=fig_extension, dpi=resolution)"
]
},
{
@ -2322,11 +2321,12 @@
"width": "309px"
},
"toc": {
"navigate_menu": true,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"threshold": 6,
"skip_h1_title": false,
"toc_cell": false,
"toc_position": {},
"toc_section_display": "block",
"toc_window_display": false
}