```
In [ ]:
```Pkg.add("Images")
Pkg.clone("https://github.com/sisl/PGFPlots.jl")
Pkg.clone("https://github.com/sisl/TikzPictures.jl")

In addition, you will need to install the following dependencies if you do not already have them on your system.

- Pdf2svg. This is required by TikzPictures. On Ubuntu, you can get this by running
`sudo apt-get install pdf2svg`

. On Windows, you can download the binaries from http://www.cityinthesky.co.uk/opensource/pdf2svg/. Be sure to add pdf2svg to your path (and restart). - Pgfplots (version 1.10 or later). Install using your latex package manager (e.g., texlive or miktex).
- In order to plot contours, you will need GNUPlot installed and on your path.

Once these things are installed, you should be able to run the following:

```
In [2]:
```using PGFPlots

You can create a very basic plot by passing in vectors of $x$ and $y$ coordinates.

```
In [3]:
```x = [1,2,3]
y = [2,4,1]
plot(x, y)

```
Out[3]:
```

```
In [4]:
```Axis(Plots.Linear(x, y))

```
Out[4]:
```

```
In [5]:
```Axis(Plots.Linear(x, y), xlabel="X", ylabel="Y", title="My Title")

```
Out[5]:
```

```
In [6]:
```Axis(Plots.Linear(x, y), xlabel="\$X\$", ylabel="\$Y\$", title="\$\\int_0^\\infty e^{\\pi x}dx\$")

```
Out[6]:
```

```
In [7]:
```d = randn(100)
Axis(Plots.Histogram(d, bins=10), ymin=0)

```
Out[7]:
```

You can even create a cumulative distribution function from the data.

```
In [8]:
```Axis(Plots.Histogram(d, bins=20, cumulative=true, density=true), ymin=0)

```
Out[8]:
```

```
In [9]:
```Axis(Plots.Histogram(d, bins=10, style="red,fill=red!10"), ymin=0, ylabel="Counts")

```
Out[9]:
```

```
In [10]:
```f = (x,y)->x*exp(-x^2-y^2)
Plots.Image(f, (-2,2), (-2,2))

```
Out[10]:
```

```
In [11]:
```Plots.Contour(f, (-2,2), (-2,2))

```
Out[11]:
```

You can specify the levels explicitly.

```
In [12]:
```Plots.Contour(f, (-2,2), (-2,2), levels=[-0.4:0.1:4])

```
Out[12]:
```

You can also just specify the number of contours you want.

```
In [13]:
```Plots.Contour(f, (-2,2), (-2,2), number=20)

```
Out[13]:
```

A GroupPlot is just a container for plots. You can specify the number or columns and rows to use.

```
In [14]:
```# generate 1000 samples
d = randn(1000)
# try out histograms with a variety of different number of bins
bins = [3 10 50 1000]
g = GroupPlot(2,2) # create a 2 x 2 group plot
for i = 1:length(bins)
push!(g, Axis(Plots.Histogram(d, bins=bins[i]), ymin=0))
end
g

```
Out[14]:
```

All of the images above can be saved in tex, pdf, or svg format.

```
In [15]:
```p = Plots.Histogram(rand(10))
save("myfile.tex", p)
save("myfile.pdf", p)
save("myfile.svg", p)