"Example where pyicon is only used for splitting the axes:"
]
},
{
"cell_type": "markdown",
"id": "c3e8d792",
"metadata": {},
"source": [
"Note: You can modify the space between the axes and the ratio of the upper axes compared to the total axes by giving the arguments 'frac' and 'space_between_axs'. Defaults are:\n",
"```\n",
"frac = 0.4\n",
"space_between_axs=0.05\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 6,
...
...
%% Cell type:code id:7f0d3233 tags:
``` python
# Jupyter Notebook with widget matplotlib plots
#%matplotlib notebook
# Jupyter Lab with widget matplotlib plots
#%matplotlib widget
# with Jupyter and Jupyter Lab but without widget matplotlib plots
%matplotlibinline
%load_extautoreload
%autoreload2
```
%% Cell type:code id:3f7a1734 tags:
``` python
importnumpyasnp
importmatplotlib.pyplotasplt
fromnetCDF4importDataset
importsys
importcartopy
importpyiconaspyic
importmatplotlib
```
%% Cell type:markdown id:c6f1dd69 tags:
Generate some example data
%% Cell type:code id:9d11da1f tags:
``` python
depth=np.linspace(0,6000,100)
lat=np.linspace(-90,90,180)
L,D=np.meshgrid(lat,depth)
data=np.cos(L*np.pi/180.)*np.cos(D/6000)
```
%% Cell type:markdown id:f4a595a4 tags:
Example where pyicon is only used for splitting the axes:
%% Cell type:markdown id:c3e8d792 tags:
Note: You can modify the space between the axes and the ratio of the upper axes compared to the total axes by giving the arguments 'frac' and 'space_between_axs'. Defaults are:
```
frac = 0.4
space_between_axs=0.05
```
%% Cell type:code id:a34c9ca0 tags:
``` python
split_ax=True# switch between splitting axes (using pyicon) and not splitting axes (without pyicon)
# --- make figure and origional axes
fig=plt.figure()
ax=fig.add_subplot()
# --- add colorbar (similar to make_axes_locatable method, which cannot be used here)