Optimal triangulation of data
table_5 = gmtread("@table_5.11", table=true) # The data used in this example
net_xy = triangulate(table_5, network=true);
plot(net_xy, region=(0,6.5,-0.2,6.5), frame=(axes=:WSNe, annot=2, ticks=1),
lw=:thinner, figsize=(7.8, 8), xshift=2.3, yshift=11.8)
plot!(table_5, marker=:circle, ms=0.3, fill=:white, MarkerLine=:thinnest)
text!(table_5, attrib=(font=(6,), rec_number=0))
# Then draw network and print the node values
plot!(net_xy, frame=(axes=:eSNw, annot=2, ticks=1), lw=:thinner, xshift=8.4)
plot!(table_5, marker=:circle, ms=0.08, fill=:black)
text!(table_5, attrib=(font=(6,), justify=:LM), fill=:white, pen="",
clearance=0.03, offset=(0.2,0), noclip=true)
# Then contour the data and draw triangles using dashed pen
# Use "gmtinfo" and "makecpt" to make a color palette,
# but since gmtinfo -T reports a leading "-T" we need to strip it
T = gmtinfo(table_5, nearest_multiple=(dz=25, col=2))
makecpt(color=:jet, range=T[1].text[1][3:end]) # Make it also the current cmap
contour!(table_5, frame=(axes=:WSne, annot=2, ticks=1), pen=:thin,
mesh=(:thinnest,:dashed), labels=(dist=2.5,), xshift=-8.4, yshift=-9.3)
contour!(table_5, frame=(axes=:eSnw, annot=2, ticks=1), colorize=true, xshift=8.4)
text!(text_record([8 20], "Delaunay Triangulation"), region=(0,20,0,28),
attrib=(font=(30,"Helvetica-Bold"), justify=:CB), proj=:linear,
figscale=1, xshift=-8.4, show=true)
See also GMT ex12