3D wireframe diagrams?

Hello, I’m wanting a Julia package that will enable me to draw a wireframe diagram - just points in space joined by lines - and move it around to view it from different angles or perspectives. I do most of my work in Jupyter Lab, so something that works in that system would be best, but if necessary I could use another environment. I believe that Plotly might work, but that’s a commercial package (although with some free access), and I’d prefer something open source.

Thanks!

This is a little bit more elaborated example, but since we have it ready …

using GMT

gmtbegin("ex04.png")
	makecpt(cmap=(255,100), range=(-10,10,10), no_bg=true, H=true)
	grdcontour("@HI_geoid_04.nc", region=(195,210,18,25), view=(60,30), cont=1,
			annot=(int=5, labels=(rounded=true,)), labels=(dist=10,),
			x_off=3, y_off=3, proj=:merc, figscale=1.1)
	coast!(p=true, frame=(annot=2, axes=:NEsw), land=:black,
		rose=(inside=true, anchor=:BR, width=2.5, offset=0.25, label=true))
	grdview!("@HI_topo_04.nc", p=true, region=(195,210,18,25,-6,4),
			plane=(-6,:lightgray), surftype=(surf=true,mesh=true), Jz="0.9",
			frame=(axes=:wesnZ, annot=2), zaxis=(annot=2, label="Topo (km)"), y_off=5.6)
	text!(mat2ds([7.5 14.0], "H@#awaiian@# R@#idge@#"), region=(0,21,0,28),
		font=(60,"ZapfChancery-MediumItalic"), justify=:CB, proj=:linear,
		view=:none, figscale=1, savefig="ex04.png")
gmtend()

4 Likes

Gaston.jl can easily do 3-D wireframes (see an example here). I have never tested it with Jupyter Lab, though; only with Jupyter. Assuming they use the same machinism to display plots, then it should work.

To interactively change the view, you’d need to create a slider or two, and use them as arguments to view, like:

x = y = -15:0.4:15
f1 = (x,y) -> @. sin(sqrt(x*x+y*y))/sqrt(x*x+y*y)
surf(x, y, f1, lc = :turquoise,
     Axes(title    = :Sombrero_Wireframe,
          view = (slider1, slider2),
          hidden3d = :on))

PlotlyJS can do it. https://github.com/PetrKryslUCSD/FinEtoolsFlexBeams.jl/blob/203599470c3ef7f45ff2d6f2dbb204fd4d2e3d6d/src/VisUtilModule.jl#L118

WGLMakie should be able to do this.

1 Like

GR has a wireframe method. See an example here.

That’s amazing, I just saw this post

Can I use another map like Bali, Indonesia? How to upload a certain location’ map?

Yes, you can make plots like that for any place on Earth (and neighbors). In the script provided region=(195,210,18,25) specifies the region bounding box in geographical coordinates. It mean a box with longitudes between [195, 210] and latitudes [18,25]. Just change that for your area of interest. In grdview! cal you’ll find the same numbers plus 2 region=(195,210,18,25,-6,4). Here the -6,4 means the limits in z (in km). Picking a different area means that these numbers should be adjusted too. The data is downloaded automatically via the "@HI_topo_04.nc" argument. See the GMT docs, for explanations about the available datasets for automatic use.

2 Likes