Julia Plotting Cheat Sheet

Code on the Rocks
4 min readApr 16, 2023

This cheat sheet provides an overview of the most commonly used plotting functions and attributes in Julia using the popular plotting library Plots.jl. To get started, make sure you have the Plots package installed by running:

using Pkg
Pkg.add("Plots")

Then load the Plots library by running:

using Plots

Basic Plotting Functions

Line plot:

function linePlot()
x = 1:0.1:10
y = cos.(x)
plot(x, y, label="cos(x)")
end

Scatter plot:

function scatterPlot()
x = 1:0.1:10
y = cos.(x)
scatter(x, y, label="cos(x)")
end

Bar plot:

function barPlot()
x = 1:0.1:10
y = cos.(x)
bar(x, y, label="cos(x)")
end

Histogram:

function histogramPlot()
x = 1:0.1:10
y = cos.(x)
histogram(x, y, label="cos(x)")
end

--

--