CoCalc Public FilesPublic / gaston-demo.ipynbOpen with one click!
Author: Hal Snyder
Views : 140
Description: Jupyter demo of Gaston: Julia interface to gnuplot
Compute Environment: Ubuntu 18.04 (Deprecated)

testing Gaston with Julia in CoCalc in a Jupyter notebook

Gaston provides an interface to gnuplot from the Julia language system.

This notebook shows a few examples from the excellent Gaston Tutorial

There is a Sage worksheet version of this demo notebook.

links

In [10]:
# Gaston requires Julia 0.6 or later versioninfo()
Julia Version 0.6.2 Commit d386e40c17 (2017-12-13 18:08 UTC) Platform Info: OS: Linux (x86_64-pc-linux-gnu) CPU: Intel(R) Xeon(R) CPU @ 2.20GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell) LAPACK: libopenblas64_ LIBM: libopenlibm LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)
In [2]:
# make sure gnuplot is installed run(`gnuplot --version`)
gnuplot 5.0 patchlevel 3
In [3]:
Pkg.status()
1 required packages: - Gaston 0.7.4
In [4]:
# if Gaston package is not available, add it. # Only need to do this once in a project. # Packages are stored in ~/.julia/ # Pkg.add("Gaston")
In [5]:
using Gaston

try different plotting modes with Gaston

  • 2D
  • 3D
  • image
  • histogram
In [6]:
# 2D plot t = 0:0.01:1 plot(t, sin.(2π*5*t))
1
In [7]:
# 3D plot x = y = -15:0.33:15 surf(x,y,(x,y)->sin.(sqrt.(x.*x+y.*y))./sqrt.(x.*x+y.*y),title="Sombrero",plotstyle="pm3d")
1
In [8]:
# image Z = [5 4 3 1 0; 2 2 0 0 1; 0 0 0 1 0; 0 1 2 4 3] imagesc(Z,title="Simple scaled image")
1
In [9]:
# histogram histogram(rand(1000),bins=15,norm=1,title="Histogram",yrange="[0:1.6]")
1
In [ ]: