{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Logarithmic Timescales\n", "\n", "Simply pass the keyword argument ```log=True``` to the Timeline, to get logarithmic timescales." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import animatplot as amp\n", "\n", "x = np.linspace(0, 1, 20)\n", "t = np.logspace(0, 2, 30)\n", "\n", "X, T = np.meshgrid(x, t)\n", "Y = np.sin(X * np.pi) * np.log(T)\n", "\n", "timeline = amp.Timeline(t, log=True)\n", "block = amp.blocks.Line(X, Y)\n", "anim = amp.Animation([block], timeline)\n", "\n", "plt.xlim([0, 1])\n", "plt.ylim([0, Y.max() + 1])\n", "\n", "anim.controls()\n", "anim.save_gif(\"logtime\")\n", "plt.show()" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. image:: logtime.gif" ] } ], "metadata": { "celltoolbar": "Raw Cell Format", "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.6.6" } }, "nbformat": 4, "nbformat_minor": 2 }