{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "window.__context = { glowscript_container: $(\"#glowscript\").removeAttr(\"id\")}" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "done\n" ] } ], "source": [ "from vpython import *\n", "scene = canvas() # This is needed in Jupyter notebook and lab to make programs easily rerunnable\n", "s = ' Test of graphing. Move the mouse over the graph to display data.'\n", "test = graph(title=s, xtitle='time', ytitle='value', fast=False)\n", "funct1 = gcurve(color=color.blue, width=4, dot=True, \n", " dot_color=color.green, dot_radius=15, radius=5, markers=True, marker_color=color.cyan)\n", "funct2 = gvbars(delta=0.4, color=color.red, label='bars')\n", "funct3 = gdots(color=color.orange)\n", "\n", "for t in range(-30, 74):\n", " rate(500)\n", " funct1.plot( t, 5.0+5.0*cos(-0.2*t)*exp(0.015*t) )\n", " funct2.plot( t, 2.0+5.0*cos(-0.1*t)*exp(0.015*t) )\n", " funct3.plot( t, 5.0*cos(-0.03*t)*exp(0.015*t) )\n", "\n", "scene.width = scene.height = 100\n", "box()\n", "scene.pause()\n", "test.title = 'New title'\n", "test.xtitle = \"New xtitle\"\n", "test.ytitle = 'New ytitle'\n", "scene.pause()\n", "funct2.data = [(-20,8), (-30,4)]\n", "funct2.color = color.green\n", "scene.pause()\n", "funct2.label = 'new bars'\n", "funct3.label = 'dots'\n", "scene.pause()\n", "funct2.legend = False\n", "scene.pause()\n", "funct2.delta = 10\n", "funct1.width = 1\n", "funct3.radius = 2*funct3.radius\n", "scene.pause()\n", "#funct3.size = 20\n", "#funct2.horizontal = True\n", "#funct2.orientation = 'h'\n", "funct1.dot_radius = 40\n", "funct1.dot_color = color.cyan\n", "funct1.marker_color = color.black\n", "scene.pause()\n", "funct1.markers = False\n", "scene.pause()\n", "funct1.delete()\n", "scene.pause()\n", "test.delete()\n", "print('done')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "VPython", "language": "python", "name": "vpython" }, "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 }