Gaston: minor fixes

This commit is contained in:
t-bltg 2021-07-31 19:21:55 +02:00 committed by GitHub
parent 34bf55c033
commit 4ed13644c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,11 +237,6 @@ function gaston_seriesconf!(sp, series::Series)
st = series[:seriestype] st = series[:seriestype]
clims = get_clims(sp, series) clims = get_clims(sp, series)
label = if should_add_to_legend(series)
"title \"$(series[:label])\""
else
"notitle"
end
if st (:scatter, :scatter3d) if st (:scatter, :scatter3d)
pt, ps, lc = gaston_mk_ms_mc(series) pt, ps, lc = gaston_mk_ms_mc(series)
push!(curveconf, "with points pt $pt ps $ps lc $lc") 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 push!(curveconf, "with fsteps") # Not sure if not the other way
elseif st (:contour, :contour3d) elseif st (:contour, :contour3d)
push!(curveconf, "with lines") push!(curveconf, "with lines")
if st == :contour st == :contour && (gsp.axesconf *= "\nset view map\nunset surface") # 2D
gsp.axesconf *= "\nset view map\nunset surface" # 2D
end
gsp.axesconf *= "\nunset key" # FIXME: too many legend (key) entries gsp.axesconf *= "\nunset key" # FIXME: too many legend (key) entries
levels = join(map(string, collect(contour_levels(series, clims))), ", ") levels = join(map(string, collect(contour_levels(series, clims))), ", ")
gsp.axesconf *= "\nset contour base\nset cntrparam levels discrete $levels" gsp.axesconf *= "\nset contour base\nset cntrparam levels discrete $levels"
elseif st (:surface, :heatmap) elseif st (:surface, :heatmap)
push!(curveconf, "with pm3d")
palette = gaston_palette(series[:seriescolor]) palette = gaston_palette(series[:seriescolor])
gsp.axesconf *= "\nset palette model RGB defined $palette" gsp.axesconf *= "\nset palette model RGB defined $palette"
if st == :heatmap st == :heatmap && (gsp.axesconf *= "\nset view map")
gsp.axesconf *= "\nset view map"
end
push!(curveconf, "with pm3d")
elseif st == :wireframe elseif st == :wireframe
lc, dt, lw = gaston_lc_ls_lw(series) lc, dt, lw = gaston_lc_ls_lw(series)
push!(curveconf, "with lines lc $lc dt $dt lw $lw") 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" @warn "Gaston: $st is not implemented yet"
end end
push!(curveconf, label) push!(curveconf, should_add_to_legend(series) ? "title \"$(series[:label])\"" : "notitle")
return join(curveconf, " ") return join(curveconf, " ")
end end
@ -456,11 +447,11 @@ function gaston_marker(marker, alpha)
return 1 return 1
end end
function gaston_color(color, alpha=0) function gaston_color(col, alpha=0)
if isvector(color) if isvector(col)
return gaston_color.(color) return gaston_color.(col)
else 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 col = alphacolor(col, gaston_alpha(alpha)) # add a default alpha if non existent
return "rgb \"#$(hex(col, :aarrggbb))\"" return "rgb \"#$(hex(col, :aarrggbb))\""
end end