Compare commits

...

3 Commits

Author SHA1 Message Date
Simon Christ 317bfc918a 1.27.0 2022-03-11 20:52:22 +01:00
Simon Christ 4665f5caab fix compat check 2022-03-11 20:51:43 +01:00
Simon Christ 1520705fa7 add z_order (#4139)
* add z_order

* format

* add missing ,

* fix testss

* this time for real

* format [skip ci]
2022-03-11 15:57:06 +01:00
8 changed files with 26 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
name = "Plots"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
author = ["Tom Breloff (@tbreloff)"]
version = "1.26.1"
version = "1.27.0"
[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
+1 -1
View File
@@ -20,7 +20,7 @@ function _check_compat(sim::Module)
be_v = Pkg.Types.read_project(joinpath(Base.pkgdir(sim), "Project.toml")).version
be_c = _plots_compats[sim_str]
if be_c isa String # julia 1.6
if be_v in Pkg.Types.semver_spec(be_c)
if !(be_v in Pkg.Types.semver_spec(be_c))
@warn "$sim $be_v is not compatible with this version of Plots. The declared compatibility is $(be_c)."
end
else
+1
View File
@@ -52,6 +52,7 @@ const _arg_desc = KW(
:primary => "Bool. Does this count as a 'real series'? For example, you could have a path (primary), and a scatter (secondary) as 2 separate series, maybe with different data (see sticks recipe for an example). The secondary series will get the same color, etc as the primary.",
:hover => "nothing or vector of strings. Text to display when hovering over each data point.",
:colorbar_entry => "Bool. Include this series in the color bar? Set to `false` to exclude.",
:z_order => "Symbol or Integer. :front (default), :back or index of position where 1 is farest in the background.",
# plot args
:plot_title => "String. Title for the whole plot (not the subplots)",
+1
View File
@@ -399,6 +399,7 @@ const _series_defaults = KW(
:hover => nothing, # text to display when hovering over the data points
:stride => (1, 1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride.
:connections => nothing, # tuple of arrays to specifiy connectivity of a 3d mesh
:z_order => :front, # one of :front, :back or integer in 1:length(sp.series_list)
:extra_kwargs => Dict(),
)
+1
View File
@@ -240,6 +240,7 @@ const _base_supported_args = [
:discrete_values,
:projection,
:show_empty_bins,
:z_order,
]
function merge_with_base_supported(v::AVec)
+10 -1
View File
@@ -427,7 +427,16 @@ function _add_the_series(plt, sp, plotattributes)
warn_on_unsupported(plt.backend, plotattributes)
series = Series(plotattributes)
push!(plt.series_list, series)
push!(sp.series_list, series)
z_order = plotattributes[:z_order]
if z_order == :front
push!(sp.series_list, series)
elseif z_order == :back
pushfirst!(sp.series_list, series)
elseif z_order isa Integer
insert!(sp.series_list, z_order, series)
else
@error "Wrong type $(typeof(z_order)) for attribute z_order"
end
_series_added(plt, series)
_update_subplot_colorbars(sp)
end
+1
View File
@@ -38,6 +38,7 @@ end
end
for fn in (
"test_args.jl",
"test_defaults.jl",
"test_pipeline.jl",
"test_axes.jl",
+10
View File
@@ -0,0 +1,10 @@
using Plots, Test
@testset "Series Attributes" begin
pl = plot([[1, 2, 3], [2, 3, 4]], lw = 5)
@test hline!(deepcopy(pl), [1.75])[1].series_list[3][:label] ==
hline!(deepcopy(pl), [1.75], z_order = :front)[1].series_list[3][:label] ==
"y3"
@test hline!(deepcopy(pl), [1.75], z_order = :back)[1].series_list[1][:label] == "y3"
@test hline!(deepcopy(pl), [1.75], z_order = 2)[1].series_list[2][:label] == "y3"
end