Skip to content

Commit

Permalink
complete rewrite of parallel plots
Browse files Browse the repository at this point in the history
  • Loading branch information
behinger committed Nov 25, 2023
1 parent 4f45c26 commit 4d367fb
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 195 deletions.
2 changes: 1 addition & 1 deletion docs/literate/tutorials/erp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ plot_erp(
res_effects;
mapping = (; y = :yhat, color = :continuous, group = :continuous),
legend = (; nbanks = 2),
layout = (; showLegend = true, legend_position = :right),
layout = (; show_legend = true, legend_position = :right),
categorical_color = false, categorical_group = true,
)

Expand Down
46 changes: 25 additions & 21 deletions docs/src/tutorials/parallelcoordinates.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,45 @@ using CairoMakie
```

## Data

We use the test data of `erpcore-N170.jld2`.

```@example main
include("../../example_data.jl")
results_plot, positions = example_data();
r1, positions = example_data();
r2 = deepcopy(r1)
r2.coefname .= "B" # we need a second category
r2.estimate .+= rand(length(r2.estimate))*0.1
results_plot = vcat(r1,r2);
nothing #hide
```

## Plot PCPs

```@example main
plot_parallelcoordinates(results_plot, [5,3,2]; # this selects channel 5,3 & 2
mapping = (color = :coefname, y = :estimate))
```
plot_parallelcoordinates(subset(results_plot,:channel=>x->x.<5);
mapping = (;color = :coefname))
```


!!! important
the following is still outdated...

## Column Mappings for PCPs
## Normalization
Typically, parallelplots are normalized per axis (if that makes sense for channel x estimate, we dont know)

Since PCPs use a `DataFrame` as an input, the library needs to know the names of the columns used for plotting.
```@example main
f = Figure()
plot_parallelcoordinates(f[1,1],subset(results_plot,:channel=>x->x.<10);
mapping = (;color = :coefname));
plot_parallelcoordinates(f[2,1],subset(results_plot,:channel=>x->x.<10);
mapping = (;color = :coefname),normalize=:minmax);
f
While there are multiple default values that are checked in that order if they exist in the `DataFrame`, a custom name might need to be choosen for:
### y
Default is `(:y, :estimate, :yhat)`.
```

### channel
Default is `:channel`.
## Labels
You can also provide labels for the axes

### color
XXX Default is `:coef`.
```@example main
plot_parallelcoordinates(subset(results_plot,:channel=>x->x.<5);
visual = (;color = :darkblue),ax_labels=["Fz","Cz","O1","O2"])
### time
Default is `:time`.
```

Loading

0 comments on commit 4d367fb

Please sign in to comment.