Skip to content

Commit

Permalink
fix pcp test; fix legend-merge typo, fix single color valuepcp
Browse files Browse the repository at this point in the history
  • Loading branch information
behinger committed Nov 25, 2023
1 parent 4863f32 commit 620c155
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/plot_parallelcoordinates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,13 @@ function parallelplot(f::Union{<:Figure,<:GridPosition,<:GridLayout},
# categorical colors
un_c = unique(color)
color_ix = [findfirst(un_c .==c) for c in color]
color = cgrad(colormap,length(un_c))[color_ix]
#@assert length(un_c) == 1 "Only single color found, please don't specify color, "
if length(un_c) == 1
@warn "only a single unique value found in specified color-vec"
color = cgrad(colormap,2)[color_ix]
else
color = cgrad(colormap,length(un_c))[color_ix]
end
#crange = [1,length(unique(color))]
else
# continuous color
Expand Down
2 changes: 1 addition & 1 deletion src/plotconfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function PlotConfig(T::Val{:paracoord})
),
legend = (;
merge = true,
)
),
mapping = (; x = :channel),
)
return cfg
Expand Down
6 changes: 3 additions & 3 deletions test/test_pcp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@testset "Figure, 3 channels, 1 condition" begin
include("../docs/example_data.jl")
results_plot, positions = example_data();
plot_parallelcoordinates(results_plot, [5, 3, 2]; # this selects channel 5,3 & 2
plot_parallelcoordinates(results_plot; # this selects channel 5,3 & 2
mapping = (color = :coefname, y = :estimate))
end

Expand All @@ -12,7 +12,7 @@ end
d_singletrial, _ = UnfoldSim.predef_eeg(; return_epoched=true)

f = Figure()
plot_parallelcoordinates!(f[1, 1], uf_5chan, [1, 2, 3, 4, 5];
mapping=(; color=:coefname), layout=(; legend_position=:bottom))
plot_parallelcoordinates(f[1, 1], uf_5chan;
mapping=(; color=:coefname), layout=(; legend_position=:bottom));
f
end

0 comments on commit 620c155

Please sign in to comment.