Changeset 26473
- Timestamp:
- 10/05/21 18:44:52 (3 years ago)
- Location:
- issm/trunk-jpl/src/jl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/jl/exp.jl
r26472 r26473 1 #for exptool, look into this http://juliaplots.org/MakieReferenceImages/gallery//mouse_picking/index.html 1 2 2 3 #exp object definition, constructor, and disp -
issm/trunk-jpl/src/jl/plotmodel.jl
r26472 r26473 1 2 #import ColorSchemes.leonardo 3 #include("issm.jl") 1 import ColorSchemes.jet 4 2 5 3 using GLMakie 6 4 7 function plotmodel(md::model )5 function plotmodel(md::model,data) 8 6 9 elementcolor = :yellow10 7 vertexcolor = :black 11 8 facetcolor = :blue … … 13 10 showfacets = true 14 11 15 scene = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = false, color = elementcolor) 12 if data isa AbstractVector 13 14 if length(data)==md.mesh.numberofelements 15 # vector of polygons 16 x = md.mesh.x 17 y = md.mesh.y 18 index = md.mesh.elements 19 ps = [Makie.GeometryBasics.Polygon([Point2(x[index[i,1]], y[index[i,1]]), Point2(x[index[i,2]], y[index[i,2]]), Point2(x[index[i,3]], y[index[i,3]])]) 20 for i in 1:md.mesh.numberofelements] 21 22 fig, ax, h = Makie.poly(ps, color = data, colormap = jet) 23 24 #Add colorbar 25 Colorbar(fig[1, 2], limits = (minimum(data), maximum(data)), colormap = jet) 26 elseif length(data)==md.mesh.numberofvertices 27 fig, ax, h = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = false, color = data, colormap = jet) 28 29 #Add colorbar 30 Colorbar(fig[1, 2], h, width=25) 31 else 32 error("data of size "*string(length(data))*" not supported yet!") 33 end 34 else 35 # default to single color 36 @assert length(data)==1 37 fig, ax, h = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = false, color = data, colormap = jet) 38 end 16 39 17 40 if showvertices … … 19 42 end 20 43 21 22 return scene 44 return fig 23 45 end
Note:
See TracChangeset
for help on using the changeset viewer.