JuliaDynamics / Attractors.jl

Find attractors (and their basins) of dynamical systems. Perform global continuation. Study global stability (a.k.a. non-local, or resilience). Also tipping points functionality.
MIT License
32 stars 6 forks source link

Fix bug in heatmap plot #78

Closed awage closed 1 year ago

awage commented 1 year ago

There is a small bug in heatmap_basins_attractor. Please review, maybe it will not work for other cases.

Closes #77

codecov-commenter commented 1 year ago

Codecov Report

Merging #78 (c1f4bcd) into main (a2fe90b) will decrease coverage by 0.48%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
- Coverage   68.88%   68.41%   -0.48%     
==========================================
  Files          22       22              
  Lines        1125     1127       +2     
==========================================
- Hits          775      771       -4     
- Misses        350      356       +6     
Impacted Files Coverage Δ
ext/plotting.jl 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

awage commented 1 year ago

I understand now: -1 should be treated separately to fix the problem.

awage commented 1 year ago

I changed the color range for the -1 case. It should fix the problem.

Datseris commented 1 year ago

ok this finally works and is the solution. The colormap values are the positive integers. This is true for all categorical colormaps that are made by default in makie. you'd need to make a custom colormap if you want the values to not bee the positive integers.

The solution is to simply transform the basin array to also use the positive integers as keys. This will work now even for keys [-1, 32, 2, 85871779].