{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Example Size Distribution Plots\n\nExample shows how to plot up CCN droplet count\nin a size distribution plot. Also shows how to\nadd different plot types together using\nassign_to_figure_axis.\n\nAuthor: Adam Theisen\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\nfrom arm_test_data import DATASETS\n\nimport act\n\n# Read CCN data in from the test data area\nfilename_ccn = DATASETS.fetch('sgpaosccn2colaE13.b1.20170903.000000.nc')\nds = act.io.arm.read_arm_netcdf(filename_ccn)\n\n# Create a DistributionDisplay object\ndisplay = act.plotting.DistributionDisplay(ds, subplot_shape=(2,), figsize=(12, 10))\n\n# Create a size distribution plot while plotting the\n# size distribution in the second plot\nt_ind = np.datetime64('2017-09-03T15:47:31')\ndisplay.plot_size_distribution('N_CCN_dN', 'droplet_size', time=t_ind, subplot_index=(0,))\n\n# This part shows how you can use different display types in a single plot\n# by assigning the new display object to a figure and axes from the first one.\ndisplay2 = act.plotting.TimeSeriesDisplay(ds)\ndisplay2.assign_to_figure_axis(display.fig, display.axes[1])\ndisplay2.plot('N_CCN_dN')\n\nplt.show()" ] } ], "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.14.3" } }, "nbformat": 4, "nbformat_minor": 0 }