Introduction to Data Visualization with Julia
Gustavo Vieira Suñe
Data Analyst
price_date | open | high | low | close | volume |
---|---|---|---|---|---|
2020-01-02 | 214.4 | 216.16 | 213.98 | 216.16 | 30969400 |
2020-01-03 | 213.3 | 215.47 | 213.28 | 214.18 | 27518900 |
2020-01-06 | 212.5 | 215.59 | 212.24 | 215.56 | 21655300 |
qqq[!, "volatility"] = 100 * (qqq.high - qqq.low) ./ qqq.open
# Plot volume versus volatility scatter( qqq.volatility, qqq.volume,
title="QQQ Daily Traded Volume", xlabel="Daily Range (%)", ylabel="Volume",
# Hide the legend label=false
# Change marker color markercolor=:ivory2 )
Commonly used colors: :blue
, :red
, :green
, :yellow
, :black
, :gray
, :white
# Plot volume versus volatility scatter(qqq.volatility, qqq.volume, label=false markercolor=:ivory2 )
# Add title and axis labels title!("QQQ Daily Traded Volume") xlabel!("Daily Range (%)") ylabel!("Volume")
# Plot volume versus volatility scatter(qqq.volatility, qqq.volume, title="QQQ Daily Traded Volume" xlabel="Daily Range (%)", ylabel="Volume", label=false markercolor=:ivory2,
# Add regression line smooth=true,
# Customize regression line linewidth=2.5, linecolor=:magenta3, )
# Plot high and low prices plot( qqq.price_date, # Pass both variables [qqq.high qqq.low],
# Assign both labels label=["High" "Low"],
# Assign widths linewidth=[4 2] ) title!("QQQ Daily Prices") xlabel!("Date") ylabel!("Price")
# Plot high price versus time plot(qqq.price_date, qqq.high, label="High", linewidth=4)
# Add low prices to the figure plot!(qqq50.price_date, qqq50.low, label="Low", linewidth=2) title!("QQQ Daily Prices") xlabel!("Date") ylabel!("Price")
label
to set or hide legend
Exclamation mark notation: modify current plot
Customize plot()
linewidth
linecolor
Customize scatter()
markercolor
smooth
to add regression line (linewidth
, linecolor
to customize regression line) → good way to display correlationIntroduction to Data Visualization with Julia