{ "cells": [ { "cell_type": "code", "execution_count": 53, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy\n", "import toyplot" ] }, { "cell_type": "code", "execution_count": 54, "metadata": { "collapsed": true }, "outputs": [], "source": [ "x1 = numpy.linspace(0, 10, 10)\n", "y1 = x ** 2\n", "y2 = x * 2" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 67, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/html": [ "
051005101520Axis 20510050100Axis 1
  • Save as .csv
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "canvas = toyplot.Canvas()\n", "axes = canvas.axes(ylabel=\"Axis 2\")\n", "axes.bars(x, y2, color=\"steelblue\")\n", "axes = canvas.axes(ylabel=\"Axis 1\")\n", "axes.y.spine.position = \"high\"\n", "offset = -(axes._xmax_range - axes._xmin_range + (2*axes.padding))\n", "axes.y.ticks.labels.offset = offset\n", "axes.y.label.style = {\"baseline-shift\": offset - axes.padding}\n", "axes.plot(x, y1, color=\"darkred\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }