Specifying the Color of Axes, Axis Names, Ticks, and Tick Values in Julia Plots
Overview
The keywords related to specifying the color of axes and ticks in Plots.jl are as follows.
| Keyword Name | Function |
|---|---|
guidefontcolor | Specify axis name color |
foreground_color_border, fgcolor_border | Specify axis color |
foreground_color_axis, fgcolor_axis | Specify tick color |
foreground_color_text, fgcolor_text | Specify tick value color |
Adding x_ or y_ in front of the keyword name applies it to the respective axis only.
Code1
Axis Names
The keyword to specify the color of axis names is guidefontcolor. Axis names can be specified with xlabel, ylabel.
x = randn(10, 3)
plot(plot(x, guidefontcolor = :red),
plot(x, x_guidefontcolor = :red),
plot(x, y_guidefontcolor = :red),
xlabel = "x label",
ylabel = "y label",
)

Axes
The keyword to specify the color of axes is foreground_color_border.
plot(plot(x, foreground_color_border = :red),
plot(x, x_foreground_color_border = :red),
plot(x, y_foreground_color_border = :red),
xlabel = "x label",
ylabel = "y label",
)

Ticks
The keyword to specify the color of ticks is foreground_color_axis. Setting it to false only removes the ticks.
plot(plot(x, foreground_color_axis = :red),
plot(x, x_foreground_color_axis = :red),
plot(x, y_foreground_color_axis = false),
xlabel = "x label",
ylabel = "y label",
)

Tick Values
The keyword to specify the color of tick values is foreground_color_text. Setting it to false only removes the tick values.
plot(plot(x, foreground_color_text = :red),
plot(x, x_foreground_color_text = :red),
plot(x, y_foreground_color_text = flase),
xlabel = "x label",
ylabel = "y label",
)

Environment
- OS: Windows11
- Version: Julia 1.9.4, Plots v1.39.0
