Julia | Plotting
Notes about Julia plotting for future self. And I’m not duplicating other’s work except for the structure of this post.
Plotting libraries in Julia
The most famous ones are:
Other libraries I just saw and have not researched fully:
- Makie.jl: A new Julia-native plotting library
- Gaston.jl: A Julia front-end for gnuplot.
- PGFPlotsX.jl: LaTeX PGFPlots in Julia
Plots.jl: docs for Plots.jl and its gallery, and Tony Allen’s plotting tutorial.
PyPlot.jl: docs of matplotlib and the gallery of PyPlot.jl.
Makie.jl: docs for Makie.jl and its gallery.
Gaston.jl: docs for Gaston.jl and the v5.4 manual (pdf) of gnuplot.
PGFPlotsX.jl: docs for PGFPlotsX.jl and the manual (pdf) of PGFPlots.
Tips about Plots.jl
You don’t have to generate data points
Plots.jl suppots function plotting.
plot(f, tmin, tmax)or
plot(fx, fy, tmin, tmax)or
plot(fx, fy, tArray)
For example, you can easily draw a parametric plot like this
Or make a contour plot without precalculating the function values
You can combine multiple plots into one single plot.
See also layouts for more options.
From this tutorial.
Tips about PyPlot.jl
Dealing with installation errors
Since PyPlot.jl depends on the Python package
matplotlib, sometimes simply
]add the package will not work due to some quirks in the installation process.
It is recommended to have a clean Conda environment inside Julia to minimize installation issues.
Finally rebuild the related packages.