Plotting 3d surface based on data in julia (using plots)

Viewed 323

I am wondering how to plot a 3d surface based on data (not on equations) in Julia using plots (or alternative).

I have several tables with data for x, y, z. Here is an example of 3 tables:

Table 1:
|   x    |  y |  z  |
|  1.1   | 10 | 3.2 |
|  21.2  | 10 | 2.1 |
|  32.8  | 10 | 0.7 |

Table 2:
|   x    | y |  z  |
|  2.1   | 8 | 4.3 |
|  24.3  | 8 | 5.2 |
|  43.1  | 8 | 1.7 |

Table 3:
|   x    | y |  z  |
|  0.8   | 4 | 2.3 |
|  21.2  | 4 | 4.2 |
|  28.9  | 4 | 2.0 |

PS: other langs are also welcome if Julia is not capable

1 Answers

Here's how it can be done in Plots.jl:

julia> using Plots

julia> x = [1.1, 21.2, 32.8, 2.1, 24.3, 43.1, 0.8, 21.2, 28.9]; 

julia> y = [10, 10, 10, 8, 8, 8, 4, 4, 4]; 

julia> z = [3.2, 2.1, 0.7, 4.3, 5.2, 1.7, 2.3, 4.2, 2.0];

julia> surface(x, y, z)

Produces:

enter image description here

Related