# How to make 3d interactive graphics in Julia?

**URL:** <https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [June 11, 2022, 11:01am UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597 "2022-06-11T11:01:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathliker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mathliker/32/36716_2.png) [@mathliker](https://discourse.julialang.org/u/mathliker)\
**Post date:** [June 11, 2022, 11:01am UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597/1 "2022-06-11T11:01:30Z")

</div>

I found a web page with a similar tutorial. But when I copy the code to run, it gives an error. Hope you all can help me.  
[https://plotly.com/julia/3d-surface-plots/](https://plotly.com/julia/3d-surface-plots/)

```julia
using PlotlyJS, CSV, HTTP, DataFrames
# Read data from a csv
df = CSV.File(
    HTTP.get("https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv").body
) |> DataFrame
z_data = Matrix{Float64}(df)
layout = Layout(
    title="Mt Bruno Elevation",
    autosize=false,
    width=500,
    height=500,
    margin=attr(l=65, r=50, b=65, t=90)
)
plot(surface(z=z_data), layout)

```

The error message is as follows

```julia
ERROR: IOError(Base.IOError("getaddrinfo: no such file or directory (ENOENT)", -4058) during request(https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv))

```

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [June 11, 2022, 11:25am UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597/2 "2022-06-11T11:25:13Z")

</div>

Hi @mathliker please read the official documentation of the corresponding Julia package to make sure that you are not hitting an outdated example:

[http://juliaplots.org/PlotlyJS.jl/stable/](http://juliaplots.org/PlotlyJS.jl/stable/)

Alternatively, consider this other package:

[https://makie.juliaplots.org/stable/](https://makie.juliaplots.org/stable/)

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [June 11, 2022, 11:35am UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597/3 "2022-06-11T11:35:09Z")

</div>

Welcome @mathliker

The code works well in Julia 1.7.2 (Windows).  
Try to download the URL with a browser and see what you get there. [https://raw.githubusercontent.com/plotly/datasets/master/api\_docs/mt\_bruno\_elevation.csv](https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv)

I get this:

```julia
,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
0,27.80985,49.61936,83.08067,116.6632,130.414,150.7206,220.1871,156.1536,148.6416,203.7845,206.0386,107.1618,68.36975,45.3359,49.96142,21.89279,17.02552,11.74317,14.75226,13.6671,5.677561,3.31234,1.156517,-0.147662
... snipped

```

---

<div class="post-metadata">

**Author:** ![mathliker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mathliker/32/36716_2.png) [@mathliker](https://discourse.julialang.org/u/mathliker)\
**Post date:** [June 11, 2022, 11:41am UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597/4 "2022-06-11T11:41:48Z")

</div>

I got the same results as you, I’m using Julia 1.8-rc1.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [June 11, 2022, 11:52am UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597/5 "2022-06-11T11:52:20Z")

</div>

You may download the file to some local location and open it directly using, e.g.:

```julia
df = CSV.File("c:\\Temp\\mt_bruno_elevation.csv") |> DataFrame

```

---

<div class="post-metadata">

**Author:** ![mathliker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mathliker/32/36716_2.png) [@mathliker](https://discourse.julialang.org/u/mathliker)\
**Post date:** [June 11, 2022, 12:02pm UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597/6 "2022-06-11T12:02:44Z")

</div>

OK, thanks. One last little question is how should I save the image?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [June 11, 2022, 12:07pm UTC](https://discourse.julialang.org/t/how-to-make-3d-interactive-graphics-in-julia/82597/7 "2022-06-11T12:07:38Z")

</div>

Check  
[http://juliaplots.org/PlotlyJS.jl/stable/api/#PlotlyBase.savefig-Tuple{Plot,AbstractString}](http://juliaplots.org/PlotlyJS.jl/stable/api/#PlotlyBase.savefig-Tuple%7BPlot,AbstractString%7D)

But for me it offers a save picture symbol (as png) in the plot window, so perhaps that’s fine for you too.
