Skip to content

Instantly share code, notes, and snippets.

@dominiccooney
Last active August 29, 2015 14:13
Show Gist options
  • Save dominiccooney/59f7b750c3817eaa8e33 to your computer and use it in GitHub Desktop.
Save dominiccooney/59f7b750c3817eaa8e33 to your computer and use it in GitHub Desktop.
Plotting in Julia

Preamble:

Pkg.add("Gadfly")
Pkg.add("Cairo")
using Gadfly

Dot diagram:

xs = [17.8, 14.3, 15.8, 18.0, 20.2]
plot(x=xs, y=zeros(length(xs)), Geom.point)

Histogram:

xs = [6.5, 2.1, 4.4, 4.7, 5.3, 2.6, 4.7, 3.0, 4.9, 4.7,
      8.6, 5.0, 4.9, 4.0, 3.4, 5.6, 4.7, 2.7, 2.4, 2.7,
      2.2, 5.2, 5.3, 4.7, 6.8, 4.1, 5.3, 7.6, 2.4, 2.1,
      4.6, 4.3, 3.0, 4.1, 6.1, 4.2]
plot(x=xs, Geom.histogram)

See also:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment