Plots.jl/examples/playground.ipynb
2015-09-24 16:47:30 -04:00

146 lines
2.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"using Plots; pyplot!()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"plotter()\n",
"Plots.PyPlot.ioff()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"plot(rand(10))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"using Plots\n",
"plotDefault!(:size,(400,300));"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"plt = plot([0,0.1], Any[rand(2),sin])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [],
"source": [
"function add_to_plot(plt, rng)\n",
" for x in rng\n",
" push!(plt, 1, x, rand())\n",
" push!(plt, 2, x, sin(x))\n",
" gui() # ; sleep(0.5)\n",
" end\n",
"end\n",
"\n",
"rng = 0.2:0.01:2π\n",
"println(\"Testing $(n=length(rng)) points\")\n",
"\n",
"plt = plot([0,0.1], Any[rand(2),sin])\n",
"@time add_to_plot(plt, rng)\n",
"\n",
"plt = plot([0,0.1], Any[rand(2),sin])\n",
"t = @elapsed add_to_plot(plt, rng)\n",
"\n",
"@printf \"Average millis per update: %1.3f\" 1000*t/n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "MethodError",
"evalue": "SYSTEM: show(lasterr) caused an error",
"output_type": "error",
"traceback": [
"SYSTEM: show(lasterr) caused an error",
""
]
}
],
"source": [
"using Plots\n",
"p = plot(rand(10), c=Any[distinguishable_colors(9)], legend=false)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.4.0-rc1",
"language": "julia",
"name": "julia-0.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "0.4.0"
}
},
"nbformat": 4,
"nbformat_minor": 0
}