{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Stitch plots together into a grid\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import pylab as pyl\npyl.ioff()\n\nimport pygeode as pyg\nimport numpy as np\nfrom pygeode.tutorial import t2\n\n\n# Generate some data for a scatter plot\nN = 50\nx_values = np.linspace(-1,1,N)\ncolors = np.random.rand(N)\narea = 1000 * np.random.rand(N) * (1 - abs(x_values))\n\nx = pyg.NamedAxis(values=x_values, name='x') \ny = pyg.NamedAxis(values=x_values + np.random.rand(N), name='y')\n\nax_scatter = pyg.vscatter(x,y, c=colors, s=area, alpha=0.5)\n\n# Make a vcontour\nax_vcontour = pyg.vcontour(t2.Temp(pres=500, time='10 May 2012')*(pyg.cos(t2.lat))*pyg.sin(t2.lon), cmap='Oranges')\n\n# Stitch the axes together side by side into a grid\nax_both = pyg.plot.grid([[ax_scatter, ax_vcontour]])\n\npyl.ion()\nax_both.render()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" } }, "nbformat": 4, "nbformat_minor": 0 }