Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow AoG.sorter( ) #232

Closed
ReneSkukies opened this issue Aug 19, 2024 · 3 comments
Closed

Allow AoG.sorter( ) #232

ReneSkukies opened this issue Aug 19, 2024 · 3 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@ReneSkukies
Copy link
Member

ReneSkukies commented Aug 19, 2024

In AoG I can use the sorter function in case variables won't get sorted in the way I want (e.g. into subplots or inside a plot). Here is an example:

using Unfold, AlgebraOfGraphics

sorting = ['S', 'R']
	
eff = effects(Dict(:duration => 75:20:300), m)

data(eff) * visual(Lines) * mapping(:yhat, col = :eventname => sorter(sorting), color = :duration, group = :duration => nonnumeric) |> draw()

This gives me the following plot:
image

However, in UnfoldMakie the following does not work:

using Unfold, UnfoldMakie

sorting = ['S', 'R']


eff = effects(Dict(:duration => 75:20:300), m)

plot_erp(eff;
	    mapping = (; col = :eventname => UnfoldMakie.AlgebraOfGraphics.sorter(sorting), color = :duration, group = :duration => nonnumeric)
	)

And without the sorting, the plot looks like this:
image

Is it possible to include sorting in UM? Or is there already a way for this?

@ReneSkukies ReneSkukies changed the title Allos AoG sorter Allow AoG sorter Aug 19, 2024
@ReneSkukies ReneSkukies changed the title Allow AoG sorter Allow AoG.sorter( ) Aug 19, 2024
@ReneSkukies ReneSkukies added bug Something isn't working enhancement New feature or request labels Aug 19, 2024
@ReneSkukies
Copy link
Member Author

In case anyone runs into this problem: AoG (which is used for the plots by UnfoldMakie) seems to plot subplots in alphabetical order of the subplot name. Thus you can get around the issue by renaming the stimuli in your model.

For the example above, renaming stimuli to 'A' and 'R' would result in correctly plotted subplots.

@vladdez
Copy link
Collaborator

vladdez commented Sep 17, 2024

we maybe accidentially fixed this 🤷

using Unfold, AlgebraOfGraphics

data,evts = UnfoldSim.predef_eeg()


evts
m = fit(UnfoldModel,["car"=>(@formula(0~1+continuous),firbasis((-0.1,1),100)),"face"=>(@formula(0~1+continuous),firbasis((-0.1,1),100))],evts,data;eventcolumn=:condition)	
eff = effects(Dict(:continuous => 75:20:300), m)
sorting = ["car","face"]

sorting = ["face","car"]

plot_erp(eff;
	    mapping = (; col = :eventname => sorter(sorting), 
        color = :continuous,group=:continuous)
	)

works now

image

and

image

@vladdez vladdez closed this as completed Sep 17, 2024
@vladdez
Copy link
Collaborator

vladdez commented Sep 17, 2024

fixed #237

vladdez added a commit that referenced this issue Sep 24, 2024
Splines and plot_erp

Fixed:
- #231 
- #235
- #225 - this parameter was deprecated at all
- #234 
- remove `legend.tellwidth = false` from the plotconfgs - better layout
- #55 and #238
- #216
- #56
- #232
- #172 
- #222
- #236 
- #205 
- partially #94 
- #106 
- #183 
- #141 
- #147 

Spline plot 
- #36 - here we added a new type of plot plot_splines
- knots with dashed line
- subplots for each spline term
- documentation page and config

Also
- system of supportive axis available for users to change
- opportunity to put them into docstrings via substitution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants