Plotly is free for unlimited public use. Sign up for free!

Sensitive data? Upgrade to a paid plan

Show Sidebar Hide Sidebar

Box Plots in Julia

How to make a box plot in julia. Seven examples of box plots in julia that are grouped, colored, and display the underlying data distribution.

# Learn about API authentication here: https://plot.ly/julia/getting-started
# Find your api_key here: https://plot.ly/settings/api

using Plotly

y0 = randn(50)
y1 = randn(50)+1


trace1 = [
  "y" => y0,
  "type" => "box"
]
trace2 = [
  "y" => y1,
  "type" => "box"
]
data = [trace1, trace2]
response = Plotly.plot(data, ["filename" => "basic-box-plot", "fileopt" => "overwrite"])
plot_url = response["url"]
# Learn about API authentication here: https://plot.ly/julia/getting-started
# Find your api_key here: https://plot.ly/settings/api

using Plotly


data = [
  [
    "y" => [0, 1, 1, 2, 3, 5, 8, 13, 21],
    "boxpoints" => "all",
    "jitter" => 0.3,
    "pointpos" => -1.8,
    "type" => "box"
  ]
]
response = Plotly.plot(data, ["filename" => "box-plot-jitter", "fileopt" => "overwrite"])
plot_url = response["url"]
# Learn about API authentication here: https://plot.ly/julia/getting-started
# Find your api_key here: https://plot.ly/settings/api

using Plotly

x = (["day 1", "day 1", "day 1", "day 1", "day 1", "day 1",
      "day 2", "day 2", "day 2", "day 2", "day 2", "day 2"])


trace1 = [
  "y" => [0.2, 0.2, 0.6, 1.0, 0.5, 0.4, 0.2, 0.7, 0.9, 0.1, 0.5, 0.3],
  "x" => x,
  "name" => "kale",
  "marker" => ["color" => "#3D9970"],
  "type" => "box"
]
trace2 = [
  "y" => [0.6, 0.7, 0.3, 0.6, 0.0, 0.5, 0.7, 0.9, 0.5, 0.8, 0.7, 0.2],
  "x" => x,
  "name" => "radishes",
  "marker" => ["color" => "#FF4136"],
  "type" => "box"
]
trace3 = [
  "y" => [0.1, 0.3, 0.1, 0.9, 0.6, 0.6, 0.9, 1.0, 0.3, 0.6, 0.8, 0.5],
  "x" => x,
  "name" => "carrots",
  "marker" => ["color" => "#FF851B"],
  "type" => "box"
]
data = [trace1, trace2, trace3]
layout = [
  "yaxis" => [
    "title" => "normalized moisture",
    "zeroline" => false
  ],
  "boxmode" => "group"
]
response = Plotly.plot(data, ["layout" => layout, "filename" => "box-grouped", "fileopt" => "overwrite"])
plot_url = response["url"]
Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to a Developer Support Plan.