From b9d65e84f0c391baf9f61f0a169d62cc605ba6d0 Mon Sep 17 00:00:00 2001 From: Filipi Nascimento Silva Date: Wed, 17 Feb 2021 21:26:28 -0500 Subject: [PATCH] Will now create Figures directory. --- Notebooks/DrawMaps.ipynb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Notebooks/DrawMaps.ipynb b/Notebooks/DrawMaps.ipynb index 1d54b84..ecdbe82 100644 --- a/Notebooks/DrawMaps.ipynb +++ b/Notebooks/DrawMaps.ipynb @@ -20,7 +20,7 @@ "import numpy as np\n", "import geopandas as gpd\n", "from scipy.sparse import coo_matrix,csr_matrix,save_npz,load_npz\n", - "%matplotlib widget\n", + "%matplotlib inline\n", "from IPython.display import set_matplotlib_formats\n", "set_matplotlib_formats('retina')\n", "import os\n", @@ -37,7 +37,8 @@ "import matplotlib.ticker as ticker\n", "from collections import Counter\n", "import matplotlib.patches as mpatches\n", - "import matplotlib as mpl" + "import matplotlib as mpl\n", + "os.makedirs(\"../Figures/\", exist_ok=True)" ] }, { @@ -271,8 +272,8 @@ " # ax.set_extent([-30, 150, -70, 70])\n", " # ax.stock_img()\n", " ax.set_global()\n", - " if(not useCircular):\n", - " ax.set_extent([-30, 150, -70, 70])\n", + "# if(not useCircular):\n", + "# ax.set_extent([-30, 150, -70, 70])\n", " ax.add_feature(cfeature.LAND,facecolor='gray',alpha=1.0)\n", " ax.add_feature(cfeature.OCEAN,facecolor=(0.7,0.7,0.7),alpha=1.0)\n", " # ax.add_feature(cfeature.OCEAN)\n", @@ -294,7 +295,7 @@ " lw=0.1,\n", " ec=(0.1,0.1,0.1,1.0)))\n", " if(name):\n", - " ax.text((region[3]+region[2])*0.5, (region[1]), name,horizontalalignment='center',verticalalignment='bottom', transform=ccrs.Geodetic(),zorder=6)\n", + " ax.text((region[3]+region[2])*0.5, (region[0]+region[1])*0.5, name,horizontalalignment='center',verticalalignment='center', transform=ccrs.Geodetic(),zorder=6)\n", " \n", " \n", " norm = mpl.colors.Normalize(vmin=maxPositivePValue, vmax=np.log10(thresholdCorrelation))\n", @@ -341,7 +342,7 @@ " \n", " print(maxPositivePValue);\n", " if(exportName):\n", - " fig.savefig(\"Figures/\"+exportName+\".pdf\");\n", + " fig.savefig(\"../Figures/\"+exportName+\".pdf\");\n", " plt.show()\n", "\n", " fig, ax = plt.subplots(figsize=(6, 1))\n", @@ -376,7 +377,7 @@ " format=ticker.FuncFormatter(fmt))\n", " \n", " if(exportName):\n", - " plt.savefig(\"Figures/cm_%s.pdf\"%exportName)\n", + " plt.savefig(\"../Figures/cm_%s.pdf\"%exportName)\n", " fig.show()\n" ] }, @@ -388,7 +389,7 @@ "source": [ "import warnings\n", "warnings.filterwarnings(\"ignore\")\n", - "\n", + "# use the name ofthe file\n", "plotConfigs = [\n", "# (\"LaggedCorrelation\",0,None),\n", "# (\"LaggedCorrelation\",30,None),\n", @@ -411,7 +412,7 @@ " extraEpsilonFactor = 0.5,\n", " min_samples = 5,\n", " min_points = 30,\n", - "# exportName=\"region_%s_d%d_l%d_v3_complete\"%(propertyName,windowDays,maxLag),\n", + " exportName=\"region_%s_d%d_l%d_v3_complete\"%(propertyName,windowDays,maxLag),\n", " maxPositivePValue=maxPositivePValue,\n", " );" ] @@ -419,9 +420,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python [conda env:climate]", + "display_name": "Python [conda env:teleconnectionsgranger]", "language": "python", - "name": "conda-env-climate-py" + "name": "conda-env-teleconnectionsgranger-py" }, "language_info": { "codemirror_mode": { @@ -433,7 +434,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.6" + "version": "3.8.6" } }, "nbformat": 4,