{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%gui qt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Spectrogram and Line Plot\n\nA spectrogram and waveform plot of 1D data.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\n\nfrom vispy import plot as vp\n\n# Create a logarithmic chirp\nfs = 1000.\nN = 10000\nt = np.arange(N) / float(fs)\nf0, f1 = 1., 500.\nphase = (t[-1] / np.log(f1 / f0)) * f0 * (pow(f1 / f0, t / t[-1]) - 1.0)\ndata = np.cos(2 * np.pi * phase)\n\nfig = vp.Fig(size=(800, 400), show=False)\nfig[0:2, 0].spectrogram(data, fs=fs, clim=(-100, -20))\nfig[2, 0].plot(np.array((t, data)).T, marker_size=0)\n\nif __name__ == '__main__':\n fig.show(run=True)" ] } ], "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.9.19" } }, "nbformat": 4, "nbformat_minor": 0 }