# Can Gnuplot Made by Lazarus Plot 3D surface along with its orthogonal line in Julia?

**URL:** <https://discourse.julialang.org/t/can-gnuplot-made-by-lazarus-plot-3d-surface-along-with-its-orthogonal-line-in-julia/91429>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [December 8, 2022, 2:50pm UTC](https://discourse.julialang.org/t/can-gnuplot-made-by-lazarus-plot-3d-surface-along-with-its-orthogonal-line-in-julia/91429 "2022-12-08T14:50:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 8, 2022, 9:12pm UTC](https://discourse.julialang.org/t/can-gnuplot-made-by-lazarus-plot-3d-surface-along-with-its-orthogonal-line-in-julia/91429/3 "2022-12-08T21:12:09Z")

</div>

With Plots.jl it is possible to draw such a transparent plane and the orthogonal arrows:

 ![Plots_plane3d_normal_arrows](https://global.discourse-cdn.com/julialang/original/3X/a/7/a77da817ad2dbb5cbc1beeece7412f1d6a5017a9.png)

However, there is no 3D annotation, only 2D, with which the text could be placed in the right places [after some trial and error](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473/4).

> **Plots.jl code**
>
> ```julia
> using Plots; pyplot(dpi=100)
> 
> function arrow3d!(P, V; lc=:black, lw=2, camera=(10,30))
> n = 7 # break arrowhead in n-parts
> ni = (0:n-1)/n 
> lwi = range(0.1, 4*lw, n) # arrowhead variable thickness                   
> d = V .* 1/10 # controls relative arrow length
> P1 = P + V
> P0 = P1 - d
> plot!([P[1], P1[1]], [P[2], P1[2]], [P[3], P1[3]], lw=lw, lc=lc, label=false, camera=camera)
> for (i,li) in zip(ni,lwi)
> di = d .* i
> plot!([P0[1], P1[1]-di[1]], [P0[2], P1[2]-di[2]], [P0[3], P1[3]-di[3]], lw=li, lc=lc, label=false)
> end
> return Plots.current()
> end
> 
> using LinearAlgebra
> p1, p2, p3 = [2,0,0], [0,2,0], [0,0,2]
> c = .+(p1, p2, p3) ./ 3
> n = cross(p1-p2, p1-p3) ./ (norm(p1-p2)*norm(p1-p3))
> surface(p1, p2, p3, c=:blues, alpha=0.3, aspect_ratio=:equal, cbar=false)
> scatter!([c[1]], [c[2]], [c[3]], ms=7, label=false)
> arrow3d!(c, n; lc=:blue, camera=(70,30))
> arrow3d!(c, (p3-c)*1/3; lc=:blue, camera=(70,30))
> 
> ```

---

_[View the full topic](https://discourse.julialang.org/t/can-gnuplot-made-by-lazarus-plot-3d-surface-along-with-its-orthogonal-line-in-julia/91429)._
