{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "\"\"\"fixture\"\"\"\n", "import nose\n", "import os\n", "import string\n", "from distutils.version import LooseVersion\n", "\n", "from datetime import datetime, date, timedelta\n", "\n", "from pandas import Series, DataFrame, MultiIndex, PeriodIndex, date_range\n", "from pandas.compat import range, lrange, StringIO, lmap, lzip, u, zip\n", "import pandas.util.testing as tm\n", "from pandas.util.testing import ensure_clean\n", "from pandas.core.config import set_option\n", "\n", "import numpy as np\n", "from numpy import random\n", "from numpy.random import randn\n", "\n", "from numpy.testing import assert_array_equal\n", "from numpy.testing.decorators import slow\n", "import pandas.tools.plotting as plotting\n", "\n", "import matplotlib as mpl\n", "mpl_le_1_2_1 = str(mpl.__version__) <= LooseVersion('1.2.1')\n", "ts = tm.makeTimeSeries()\n", "ts.name = 'ts'\n", "\n", "series = tm.makeStringSeries()\n", "series.name = 'series'\n", "\n", "iseries = tm.makePeriodSeries()\n", "iseries.name = 'iseries'\n", "\n", "%matplotlib inline" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "\"\"\"test_plot_figsize_and_title\"\"\"\n", "ax = series.plot(title='Test', figsize=(16, 8))\n", "\n", "assert ax.title.get_text() == 'Test'\n", "assert_array_equal(np.round(ax.figure.get_size_inches()),\n", " np.array((16., 8.)))" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "\"\"\"test_bar_linewidth\"\"\"\n", "df = DataFrame(randn(5, 5))\n", "\n", "# regular\n", "ax = df.plot(kind='bar', linewidth=2)\n", "for r in ax.patches:\n", " assert r.get_linewidth() == 2\n", "\n", "# stacked\n", "ax = df.plot(kind='bar', stacked=True, linewidth=2)\n", "for r in ax.patches:\n", " assert r.get_linewidth() == 2\n", "\n", "# subplots\n", "axes = df.plot(kind='bar', linewidth=2, subplots=True)\n", "for ax in axes:\n", " for r in ax.patches:\n", " assert r.get_linewidth() == 2" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "\"\"\"test_irregular_datetime\"\"\"\n", "rng = date_range('1/1/2000', '3/1/2000')\n", "rng = rng[[0, 1, 2, 3, 5, 9, 10, 11, 12]]\n", "ser = Series(randn(len(rng)), rng)\n", "ax = ser.plot()\n", "xp = datetime(1999, 1, 1).toordinal()\n", "ax.set_xlim('1/1/1999', '1/1/2001')\n", "assert xp == ax.get_xlim()[0]" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "\"\"\"failing test\"\"\"\n", "1/0\n", "a = 3" ], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }