Skip to content

Commit bcb6d2c

Browse files
committed
fix source code of grayscale
1 parent 82ab464 commit bcb6d2c

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RecurrenceAnalysis"
22
uuid = "639c3291-70d9-5ea2-8c5b-839eba1ee399"
33
repo = "https://github.com/JuliaDynamics/RecurrenceAnalysis.jl.git"
4-
version = "2.0.2"
4+
version = "2.0.3"
55

66
[deps]
77
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"

src/matrices/plot.jl

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -158,28 +158,23 @@ It is advised to use `width, height` arguments for large matrices otherwise
158158
plots using functions like e.g. `heatmap` could be misleading.
159159
"""
160160
function grayscale(R, bwcode::Tuple{TT,T}=(0.0,1.0);
161-
exactsize=false, kwargs...) where {TT<:Real, T<:Real}
161+
width = nothing, height = nothing, exactsize=false
162+
) where {TT<:Real, T<:Real}
162163

163164
dims = size(R)
164-
kwargs = Dict(kwargs)
165-
if haskey(kwargs, :width) && !haskey(kwargs, :height)
166-
width = Int(kwargs[:width])
165+
if !isnothing(width) && isnothing(height)
167166
height = round(Int, width*dims[2]/dims[1])
168167
return grayscale(R, bwcode; width=width, height=height)
169-
elseif haskey(kwargs, :height) && !haskey(kwargs, :width)
170-
height = Int(kwargs[:height])
168+
elseif isnothing(width) && !isnothing(height)
171169
width = round(Int, height*dims[1]/dims[2])
172-
return grayscale(R, bwcode; width=width, height=height)
173-
elseif !haskey(kwargs, :width) || !haskey(kwargs, :height)
174-
width, height = Int.(dims)
175-
return grayscale(R, bwcode; width=width, height=height)
170+
elseif isnothing(width) && isnothing(height)
171+
width, height = dims
176172
end
177-
if exactsize
178-
width, height = Int(kwargs[:width]), Int(kwargs[:height])
179-
else
180-
width, height = checkgridsize(Int(kwargs[:width]),
181-
Int(kwargs[:height]), dims)
173+
174+
if !exactsize
175+
width, height = checkgridsize(width, height, dims)
182176
end
177+
183178
# initial and final values of the horizontal and vertical blocks
184179
rows = overlapgrid(width, dims[1])
185180
cols = overlapgrid(height, dims[2])
@@ -194,5 +189,5 @@ function grayscale(R, bwcode::Tuple{TT,T}=(0.0,1.0);
194189
p .= bwcode[1].*p .+ bwcode[2].*(1 .- p)
195190
pt = (T<:Integer) ? round.(T, p) : T.(p)
196191
# need to flip `y` so that diagonal is in the correct way...
197-
return reverse(pt; dims = 2)
192+
return reverse(pt; dims = 1)
198193
end

0 commit comments

Comments
 (0)