줄리아 Plots에서 축, 축 이름, 눈금, 눈금 값의 색상 지정하는 법
요약
Plots.jl에서 축과 눈금의 색상 지정와 관련된 키워드는 다음과 같다.
| 키워드 이름 | 기능 |
|---|---|
guidefontcolor | 축 이름 색상 지정 |
foreground_color_border, fgcolor_border | 축 색상 지정 |
foreground_color_axis, fgcolor_axis | 눈금 색상 지정 |
foreground_color_text, fgcolor_text | 눈금 값 색상 지정 |
키워드 이름 앞에 x_나 y_를 붙이면 해당 축에 대해서만 적용된다.
코드1
축 이름
축 이름의 색상을 지정하는 키워드는 guidefontcolor이다. 축 이름은 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",
)

축
축의 색상을 지정하는 키워드는 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",
)

눈금
눈금의 색상을 지정하는 키워드는 foreground_color_axis이다. 이를 false로 두면 눈금만 지울 수 있다.
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",
)

눈금 값
눈금 값의 색상을 지정하는 키워드는 foreground_color_text이다. 이를 false로 두면 눈금의 값만 지울 수 있다.
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",
)

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

저희들의 저서 「줄리아 프로그래밍」이 2024 세종도서 학술부문에 선정되었습니다!

