direct colormap access

This commit is contained in:
Simon Christ 2019-11-26 00:07:45 +01:00
parent f2af121661
commit 091ca327ba
2 changed files with 9 additions and 7 deletions

View File

@ -158,6 +158,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
push!(axis_opt,
"colorbar" => nothing,
"colormap name" => "plots$(sp.attr[:subplot_index])",
"colormap access" => "direct",
)
# goto is needed to break out of col and series for
@goto colorbar_end
@ -167,10 +168,10 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
@label colorbar_end
push!(axis_opt, "colorbar style" => PGFPlotsX.Options(
"title" => sp[:colorbar_title],
"point meta max" => get_clims(sp)[2],
"point meta min" => get_clims(sp)[1]
)
"title" => sp[:colorbar_title],
"point meta max" => get_clims(sp)[2],
"point meta min" => get_clims(sp)[1]
)
)
if is3d(sp)
azim, elev = sp[:camera]
@ -192,7 +193,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
series_opt = PGFPlotsX.Options(
"color" => single_color(opt[:linecolor]),
)
if is3d(series) || st == :heatmap #|| isfilledcontour(series)
if is3d(series) || st == :heatmap
series_func = PGFPlotsX.Plot3
else
series_func = PGFPlotsX.Plot
@ -336,7 +337,7 @@ function pgfx_series_coordinates!(st_val::Val{:heatmap}, segment_opt, opt, args)
push!(segment_opt,
"surf" => nothing,
"mesh/rows" => length(opt[:x]),
"mesh/cols" => length(opt[:y])
"mesh/cols" => length(opt[:y]),
)
return PGFPlotsX.Table(args...)
end

View File

@ -80,7 +80,8 @@ end
z = float((1:4) * reshape(1:10, 1, :))
pgfx_plot = heatmap(xs, ys, z, aspect_ratio=1)
Plots._update_plot_object(pgfx_plot)
if @test_nowarn(haskey(Plots.pgfx_axes(pgfx_plot.o)[1].options.dict, "colorbar") == true)
if
@test_nowarn(haskey(Plots.pgfx_axes(pgfx_plot.o)[1].options.dict, "colorbar") == true)
@test Plots.pgfx_axes(pgfx_plot.o)[1]["colorbar"] === nothing
@test Plots.pgfx_axes(pgfx_plot.o)[1]["colormap name"] == "plots1"
end