From 4ed13644c4cfefef5a6ea725fd292402cb23ead1 Mon Sep 17 00:00:00 2001 From: t-bltg <13423344+t-bltg@users.noreply.github.com> Date: Sat, 31 Jul 2021 19:21:55 +0200 Subject: [PATCH] Gaston: minor fixes --- src/backends/gaston.jl | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/backends/gaston.jl b/src/backends/gaston.jl index 03913884..cd9f2856 100644 --- a/src/backends/gaston.jl +++ b/src/backends/gaston.jl @@ -237,11 +237,6 @@ function gaston_seriesconf!(sp, series::Series) st = series[:seriestype] clims = get_clims(sp, series) - label = if should_add_to_legend(series) - "title \"$(series[:label])\"" - else - "notitle" - end if st ∈ (:scatter, :scatter3d) pt, ps, lc = gaston_mk_ms_mc(series) push!(curveconf, "with points pt $pt ps $ps lc $lc") @@ -263,19 +258,15 @@ function gaston_seriesconf!(sp, series::Series) push!(curveconf, "with fsteps") # Not sure if not the other way elseif st ∈ (:contour, :contour3d) push!(curveconf, "with lines") - if st == :contour - gsp.axesconf *= "\nset view map\nunset surface" # 2D - end + st == :contour && (gsp.axesconf *= "\nset view map\nunset surface") # 2D gsp.axesconf *= "\nunset key" # FIXME: too many legend (key) entries levels = join(map(string, collect(contour_levels(series, clims))), ", ") gsp.axesconf *= "\nset contour base\nset cntrparam levels discrete $levels" elseif st ∈ (:surface, :heatmap) + push!(curveconf, "with pm3d") palette = gaston_palette(series[:seriescolor]) gsp.axesconf *= "\nset palette model RGB defined $palette" - if st == :heatmap - gsp.axesconf *= "\nset view map" - end - push!(curveconf, "with pm3d") + st == :heatmap && (gsp.axesconf *= "\nset view map") elseif st == :wireframe lc, dt, lw = gaston_lc_ls_lw(series) push!(curveconf, "with lines lc $lc dt $dt lw $lw") @@ -283,7 +274,7 @@ function gaston_seriesconf!(sp, series::Series) @warn "Gaston: $st is not implemented yet" end - push!(curveconf, label) + push!(curveconf, should_add_to_legend(series) ? "title \"$(series[:label])\"" : "notitle") return join(curveconf, " ") end @@ -456,11 +447,11 @@ function gaston_marker(marker, alpha) return 1 end -function gaston_color(color, alpha=0) - if isvector(color) - return gaston_color.(color) +function gaston_color(col, alpha=0) + if isvector(col) + return gaston_color.(col) else - col = single_color(color) # in case of gradients + col = single_color(col) # in case of gradients col = alphacolor(col, gaston_alpha(alpha)) # add a default alpha if non existent return "rgb \"#$(hex(col, :aarrggbb))\"" end