Plotting in Julia is available through external packages.
Plots.jl is a plotting metapackage which brings many different plotting packages under a single API, making it easy to swap between plotting "backends". Installation and example usage is as follows:
using Pkg Pkg.add("Plots") using Plots plotly() # Choose the Plotly.jl backend for web interactivity plot(rand(5,5),linewidth=2,title="My Plot") Pkg.add("PyPlot") # Install a different backend pyplot() # Switch to using the PyPlot.jl backend plot(rand(5,5),linewidth=2,title="My Plot") # The same plotting command works
A guide to the available backends can be found in the manual. Additionally, many Julia packages add plotting functionality through its recipe system. These can be used to do tasks like creating a default visualization for Julia types and create entirely new types of plots. The ecosystems page shows some visualizations the extension packages have added to Plots.jl.
PyPlot uses the Julia PyCall package to call Python's matplotlib directly from Julia with little or no overhead (arrays are passed without making a copy). Make sure that Python and MatPlotlib are correctly installed. Installation of PyPlot.jl and example usage are as follows:
using Pkg Pkg.add("PyPlot") using PyPlot x = range(0,stop=2*pi,length=1000); y = sin.(3*x + 4*cos.(2*x)) plot(x, y, color="red", linewidth=2.0, linestyle="--")
Gadfly is an implementation of a Wickham-Wilkinson style grammar of graphics in Julia. Add the Gadfly package to your Julia installation with the following command on the Julia prompt:
using Pkg Pkg.add("Gadfly") using Gadfly draw(SVG("output.svg", 6inch, 3inch), plot([sin, cos], 0, 25))