add :mesh3d

This commit is contained in:
t-bltg 2022-02-03 17:33:20 +01:00
parent 8cdef406e0
commit a29ed28a0e
3 changed files with 12 additions and 6 deletions

View File

@ -948,7 +948,7 @@ const _unicodeplots_seriestype = [
:spy,
:surface,
:wireframe,
# :mesh3d,
:mesh3d,
]
const _unicodeplots_style = [:auto, :solid]
const _unicodeplots_marker = [

View File

@ -90,8 +90,10 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
ylim = ylim,
# 3d
projection = plot_3d ? :orthographic : nothing,
azimuth = -50,
up = sp[:zaxis][:flip] ? :mz : :pz,
# PyPlot: azimuth = -60 & elevation = 30
azimuth = -45,
elevation = 30,
)
o = UnicodePlots.Plot(x, y, plot_3d ? z : nothing, _canvas_map[canvas]; kw...)
@ -173,20 +175,25 @@ function addUnicodeSeries!(
elseif st === :heatmap
return UnicodePlots.heatmap(Array(series[:z]); fix_ar = fix_ar, kw...)
end
elseif st in (:wireframe, :surface) # 3D
elseif st in (:surface, :wireframe) # 3D
colormap = get(series[:extra_kwargs], :colormap, :none)
kw = (
kw...,
zlabel = sp[:colorbar_title],
colormap = colormap === :none ? up_cmap(series) : colormap,
colorbar = hascolorbar(sp),
color = st === :wireframe ? up_color(get_linecolor(series, 1)) : nothing
color = st === :wireframe ? up_color(get_linecolor(series, 1)) : nothing,
lines = st === :wireframe,
)
return UnicodePlots.surfaceplot(x, y, Array(series[:z]); kw...)
elseif st === :mesh3d
return UnicodePlots.lineplot!(
up, mesh3d_triangles(x, y, series[:z], series[:connections])...
)
end
# now use the ! functions to add to the plot
if st in (:path, :path3d, :straightline, :shape)
if st in (:path, :path3d, :straightline, :shape, :mesh3d)
func = UnicodePlots.lineplot!
series_kw = (; head_tail = series[:arrow] isa Arrow ? series[:arrow].side : nothing)
elseif st in (:scatter, :scatter3d) || series[:markershape] !== :none

View File

@ -1310,7 +1310,6 @@ _backend_skips = Dict(
37, # ribbons / filled unsupported
43, # heatmap with DateTime
45, # error bars
47, # mesh3D unsupported
49, # polar heatmap
51, # embedded images unsupported
55, # mirror unsupported, resolution too low