Skip to content

Commit

Permalink
Merge pull request #3591 from t-bltg/surf_opts
Browse files Browse the repository at this point in the history
GR: expose surface(...) display options, fix hardcoded constants
  • Loading branch information
t-bltg authored Jul 4, 2021
2 parents 0ca5bc9 + e42b4ad commit 3f110d6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/backends/gr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1841,22 +1841,25 @@ 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)
# 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
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

Expand Down

0 comments on commit 3f110d6

Please sign in to comment.