How to Use the Symbol of Pi on the Axis in Julia
Overview
In Julia, this document explains how to directly use the pi symbol on ticks. It doesn’t necessarily have to be pi; you can apply in various forms by passing the tick locations and labels as tuples.
Code
For xticks
, provide the tick locations and labels in the form (A, B)
where A
indicates the location and B
represents the label.
Full Code
using Plots
piticks = [0, π, 2π, 3π, 4π]
θ = 0:0.01:4π
plot(θ, sin.(θ), xticks = (piticks, ["0", "π", "2π", "3π", "4π"]))
png("sine")
Environment
- OS: Windows
- Julia: v1.10.3