플롯 속성과 색상 팔레트

Julia로 시작하는 데이터 시각화

Gustavo Vieira Suñe

Data Analyst

색상 팔레트

  • 다양한 색상 팔레트, 예:

여러 Julia 색상 팔레트 미리보기 그림.

1 https://juliagraphics.github.io/ColorSchemes.jl/stable/catalogue/
Julia로 시작하는 데이터 시각화

팔레트 사용하기

# Set the theme
theme(:bright)


# Create a scatter plot scatter( streaming.Age, streaming."Frequency [K pop]", group=streaming."Frequency [K pop]", label=false,
# Set color palette palette=:Dark2_5 )
xlabel!("Age") ylabel!("Frequency of Play")

응답자의 K-Pop 청취 빈도를 연령과 비교한 산점도.

Julia로 시작하는 데이터 시각화

플롯 속성

이전에 본 속성:

  • title, xlabel, ylabel
  • xticks, yticks
  • color
  • linecolor, linewidth
  • markercolor
  • framestyle

더 많은 속성:

  • xlims, ylims
  • alpha
  • linestyle
  • legend_title, legend_position
  • markersize, markershape

...

1 https://docs.juliaplots.org/stable/attributes/#attributes
Julia로 시작하는 데이터 시각화

마커 속성

theme(:bright)

scatter(
    streaming.Age,
    streaming."Frequency [K pop]",
    group=streaming."Frequency [K pop]",
    label=false,
    palette=:Dark2_5

# Marker attributes markershape=:diamond, markersize=8, )
xlabel!("Age") ylabel!("Frequency of Play")

응답자의 K-Pop 청취 빈도를 연령과 비교한 산점도. 큰 마름모 모양 마커 사용.

Julia로 시작하는 데이터 시각화

불투명도/투명도

theme(:bright)

scatter(
    streaming.Age,
    streaming."Frequency [K pop]",
    group=streaming."Frequency [K pop]",
    label=false,
    palette=:Dark2_5
    markershape=:diamond,
    markersize=8,

# Opacity alpha=0.25 )
xlabel!("Age") ylabel!("Frequency of Play")

응답자의 K-Pop 청취 빈도를 연령과 비교한 산점도. 일부 투명도가 있는 큰 마름모 마커.

Julia로 시작하는 데이터 시각화

선 속성

# Set theme and default line width
theme(:dao, linewidth=4)

# Create histogram histogram(streaming.BPM, label="Observed", color=:lightslateblue, normalize=true)
# Add density plot density!(streaming.BPM, label="Distribution", linecolor=:green2,
# Line style linestyle=:dash)
xlabel!("BPM") ylabel!("Probability")

설문 응답자의 선호 BPM을 정규화한 히스토그램과 추정 분포를 보여주는 밀도 곡선.

Julia로 시작하는 데이터 시각화

축 범위와 범례 속성

theme(:dao, linewidth=4)

histogram(streaming.BPM, label="Observed", 
    color=:lightslateblue, normalize=true)
density!(streaming.BPM, label="Distribution",
    linecolor=:green2, linestyle=:dash

# Customize legend legend_title="Type", legend_position=:topright)
# Set the x-axis bounds xlims!(50, 230)
xlabel!("BPM") ylabel!("Probability")

설문 응답자의 선호 BPM을 정규화한 히스토그램과 추정 분포를 보여주는 밀도 곡선.

Julia로 시작하는 데이터 시각화

치트시트

  • 색상 팔레트
    • plot(..., palette=palette_symbol)
  • 마커 속성
    • markersize
    • markershape

Plots.jl에서 사용 가능한 마커 모양 미리보기.

  • 투명도: alpha=opacity_value
  • 축 범위: xlims!(), ylims!()
  • 선 속성: linetyle Plots.jl에서 사용 가능한 선 스타일 미리보기.

  • 범례 속성

    • legend_title
    • legend_position (:right, :left, :top, :bottom, :topright, :topleft, ...)
Julia로 시작하는 데이터 시각화

Ayo berlatih!

Julia로 시작하는 데이터 시각화

Preparing Video For Download...