m |
m |
||
Line 1: | Line 1: | ||
= Crash Course in Scientific Computing = | = Crash Course in Scientific Computing = | ||
== V. Plotting == | == V. Plotting == | ||
+ | |||
+ | We'll be using the notebook feature. The main shortcuts are: | ||
+ | |||
+ | * toggle between edit (green) and command (blue) with <tt>esc</tt> and <tt>enter</tt> respectively. | ||
+ | * <tt>a</tt> and <tt>b</tt> to insert a cell above and below the current position. | ||
+ | * <tt>d d</tt> to delete the current cell | ||
+ | * <tt>z</tt> to undo | ||
+ | * <tt>m</tt> to transform a cell into markdown (text, documentation, etc.) | ||
+ | |||
<pre> | <pre> | ||
using Plots | using Plots | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | heatmap(space,c=cgrad([:white, :black]), axis=nothing, legend=:none, aspect_ratio=1, yflip=true) | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | gosper = @animate for i ∈ 1:1000 | ||
+ | nextgen(); | ||
+ | heatmap(space,c=cgrad([:white, :black]), axis=nothing, legend=:none, aspect_ratio=1, yflip=true) | ||
+ | end | ||
+ | gif(gosper, fps=25) | ||
+ | </pre> | ||
+ | |||
+ | Plotting mathematical functions can be done as follows: | ||
+ | |||
+ | <pre> | ||
+ | plot(sin, x, -π, π) | ||
+ | plot!(x->x, -π, π) | ||
</pre> | </pre> | ||
We'll be using the notebook feature. The main shortcuts are:
using Plots
heatmap(space,c=cgrad([:white, :black]), axis=nothing, legend=:none, aspect_ratio=1, yflip=true)
gosper = @animate for i ∈ 1:1000 nextgen(); heatmap(space,c=cgrad([:white, :black]), axis=nothing, legend=:none, aspect_ratio=1, yflip=true) end gif(gosper, fps=25)
Plotting mathematical functions can be done as follows:
plot(sin, x, -π, π) plot!(x->x, -π, π)