Help:Plots

From OpenWetWare
Jump to navigationJump to search

< Help

Plots can be made using gnuplot on the wiki. The syntax is as follows:

<plot>
plot [-pi:pi][-1:1] sin(x)
</plot>

<plot> plot [-pi:pi][-1:1] sin(x) </plot>

Note that gnuplot has MANY options so read it the manual to understand what you can do. To plot data, you can incorporate the data inline like such:

<plot>
plot "-" title "stupid plot 1" with lines, "-" title "stupid plot 2" with lines
1 1
2 2
3 3
4 4
5 3
6 2
7 1
e
1 3
2 4
3 3
4 2
5 1
6 2
7 3
e
</plot>

<plot> plot "-" title "stupid plot 1" with lines, "-" title "stupid plot 2" with lines 1 1 2 2 3 3 4 4 5 3 6 2 7 1 e 1 3 2 4 3 3 4 2 5 1 6 2 7 3 e </plot>

You can also upload a data file, for example, at File:MyData.txt and include it in a plot as follows

<plot data="MyData.txt">
plot "MyData.txt" title "my data" using 1:4
</plot>

A 3D plot:

<plot>
set contour base
set nokey
splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
</plot>

<plot> set contour base set nokey splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2) </plot>