From a7c629f775fb28edfc9d53c4fb3e950c36ae2bb5 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Thu, 1 Jul 2021 15:08:36 +0200 Subject: [PATCH 1/2] GR: expose surface(...) display options --- src/backends/gr.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index ca31f3d3a..d879c0067 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1841,22 +1841,23 @@ function gr_draw_contour(series, x, y, z, clims) end function gr_draw_surface(series, x, y, z, clims) - + e_kwargs = series[:extra_kwargs] if series[:seriestype] === :surface fillalpha = get_fillalpha(series) fillcolor = get_fillcolor(series) if length(x) == length(y) == length(z) x, y, z = GR.gridit(x, y, z, 200, 200) end + d_opt = get(e_kwargs, :display_option, GR.OPTION_COLORED_MESH) if (!isnothing(fillalpha) && fillalpha < 1) || alpha(first(fillcolor)) < 1 gr_set_transparency(fillcolor, fillalpha) - GR.surface(x, y, z, GR.OPTION_COLORED_MESH) + GR.surface(x, y, z, d_opt) else - GR.gr3.surface(x, y, z, GR.OPTION_COLORED_MESH) + GR.gr3.surface(x, y, z, d_opt) end - else # wireframe + else # wireframe GR.setfillcolorind(0) - GR.surface(x, y, z, GR.OPTION_FILLED_MESH) + GR.surface(x, y, z, get(e_kwargs, :display_option, GR.OPTION_FILLED_MESH)) end end From e42b4ad34da6384f056ca4d08febf280f8ea1766 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Thu, 1 Jul 2021 16:54:07 +0200 Subject: [PATCH 2/2] GR: surface, add the possibility to override the hardcoded nx and ny in GR.gridit(...) --- src/backends/gr.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index d879c0067..945915523 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1845,8 +1845,10 @@ function gr_draw_surface(series, x, y, z, clims) if series[:seriestype] === :surface fillalpha = get_fillalpha(series) fillcolor = get_fillcolor(series) - if length(x) == length(y) == length(z) - x, y, z = GR.gridit(x, y, z, 200, 200) + # NOTE: setting nx = 0 or ny = 0 disables GR.gridit interpolation + nx, ny = get(e_kwargs, :nx, 200), get(e_kwargs, :ny, 200) + if length(x) == length(y) == length(z) && nx > 0 && ny > 0 + x, y, z = GR.gridit(x, y, z, nx, ny) end d_opt = get(e_kwargs, :display_option, GR.OPTION_COLORED_MESH) if (!isnothing(fillalpha) && fillalpha < 1) || alpha(first(fillcolor)) < 1