Skip to content
This repository was archived by the owner on Jul 13, 2021. It is now read-only.

Commit 91d4eb0

Browse files
committed
fixes
2 parents 2f71923 + 841223c commit 91d4eb0

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

src/basic_recipes/axis.jl

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,24 @@ isaxis(x::Union{Axis2D, Axis3D}) = true
164164

165165
const Limits{N} = NTuple{N, Tuple{Number, Number}}
166166

167-
default_ticks(limits::Limits, ticks, scale_func::Function) = default_ticks.(limits, (ticks,), scale_func)
167+
function default_ticks(limits::Limits, ticks, scale_func::Function)
168+
default_ticks.(limits, (ticks,), scale_func)
169+
end
170+
171+
# function default_ticks(limits::Limits, ticks::Tuple, scale_func::Function)
172+
# default_ticks.(limits, ticks, scale_func)
173+
# end
168174
default_ticks(limits::Tuple{Number, Number}, ticks, scale_func::Function) = default_ticks(limits..., ticks, scale_func)
169175

170-
function default_ticks(lmin::Number, lmax::Number, ticks::AbstractVector{<: Number}, scale_func::Function)
176+
function default_ticks(
177+
lmin::Number, lmax::Number,
178+
ticks::AbstractVector{<: Number}, scale_func::Function
179+
)
171180
scale_func.((filter(t -> lmin <= t <= lmax, ticks)))
172181
end
173-
function default_ticks(lmin::Number, lmax::Number, ::Automatic, scale_func::Function)
182+
function default_ticks(
183+
lmin::Number, lmax::Number, ::Automatic, scale_func::Function
184+
)
174185
# scale the limits
175186
scaled_ticks, mini, maxi = optimize_ticks(
176187
scale_func(lmin),
@@ -182,7 +193,9 @@ function default_ticks(lmin::Number, lmax::Number, ::Automatic, scale_func::Func
182193
scaled_ticks
183194
end
184195

185-
function default_ticks(lmin::Number, lmax::Number, n::Integer, scale_func = identity)
196+
function default_ticks(
197+
lmin::Number, lmax::Number, ticks::Integer, scale_func = identity
198+
)
186199
scaled_ticks, mini, maxi = optimize_ticks(
187200
scale_func(lmin),
188201
scale_func(lmax);
@@ -196,7 +209,10 @@ function default_ticks(lmin::Number, lmax::Number, n::Integer, scale_func = iden
196209
scaled_ticks
197210
end
198211

199-
default_ticks(x::Automatic, limits::Tuple, n) = default_ticks(limits, n, identity)
212+
function default_ticks(x::Automatic, limits::Tuple, n)
213+
default_ticks(limits, n, identity)
214+
end
215+
200216
function default_ticks(ticks::Tuple, limits::Tuple, n::Tuple)
201217
default_ticks.(ticks, (limits,), n)
202218
end

src/conversions.jl

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function convert_arguments(T::PlotFunc, args...; kw...)
5353
convert_arguments(ct, args...; kw...)
5454
catch e
5555
if e isa MethodError
56+
@show e
5657
error("No overload for $T and also no overload for trait $ct found! Arguments: $(typeof.(args))")
5758
else
5859
rethrow(e)
@@ -134,6 +135,25 @@ function convert_arguments(::PointBased, positions::NTuple{N, AbstractVector}) w
134135
PlotSpec(points, tickranges = xyrange, ticklabels = labels)
135136
end
136137

138+
function convert_arguments(
139+
SL::SurfaceLike,
140+
x::AbstractVector, y::AbstractVector, z::AbstractMatrix{<: Number}
141+
)
142+
n, m = size(z)
143+
positions = (x, y)
144+
labels = categoric_labels.(positions)
145+
xyrange = categoric_range.(labels)
146+
args = convert_arguments(SL, 0..n, 0..m, z)
147+
xyranges = (
148+
to_linspace(0.5..(n-0.5), n),
149+
to_linspace(0.5..(m-0.5), m)
150+
)
151+
return PlotSpec(
152+
args...,
153+
tickranges = xyranges, ticklabels = labels
154+
)
155+
end
156+
137157
"""
138158
Accepts a Vector of Pair of Points (e.g. `[Point(0, 0) => Point(1, 1), ...]`)
139159
to encode e.g. linesegments or directions.
@@ -222,10 +242,12 @@ outputs them in a Tuple.
222242
223243
`P` is the plot Type (it is optional).
224244
"""
225-
function convert_arguments(::SurfaceLike, x::AbstractVecOrMat, y::AbstractVecOrMat, z::AbstractMatrix)
245+
function convert_arguments(::SurfaceLike, x::AbstractVecOrMat{<: Number}, y::AbstractVecOrMat{<: Number}, z::AbstractMatrix{<: Union{Number, Colorant}})
246+
return (el32convert(x), el32convert(y), el32convert(z))
247+
end
248+
function convert_arguments(::SurfaceLike, x::AbstractVecOrMat{<: Number}, y::AbstractVecOrMat{<: Number}, z::AbstractMatrix{<:Number})
226249
return (el32convert(x), el32convert(y), el32convert(z))
227250
end
228-
229251

230252
float32type(x::Type) = Float32
231253
float32type(::Type{<: RGB}) = RGB{Float32}

src/layouting/boundingbox.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ function boundingbox(
108108
end
109109

110110

111-
function boundingbox(text::String, position, textsize, font, align, rotation, model = Mat4f0(I))
111+
function boundingbox(
112+
text::String, position, textsize, font,
113+
align, rotation, model = Mat4f0(I)
114+
)
112115
atlas = get_texture_atlas()
113116
N = length(text)
114117
ctext_state = iterate(text)

0 commit comments

Comments
 (0)