@@ -142,29 +142,29 @@ for f in (:scatter, :lines, :scatterlines, :stairs, :stem, :barplot, :waterfall)
142142 @eval begin
143143 @doc $ docstring
144144 function Makie. $f (A:: AbstractDimVector ; axislegendkw= (;), attributes... )
145- args, merged_attributes = _pointbased1 (A, attributes)
145+ args, merged_attributes = _pointbased1 (A; attributes... )
146146 p = Makie.$ f (args... ; merged_attributes... )
147147 axislegend (p. axis; merge= false , unique= false , axislegendkw... )
148148 return p
149149 end
150150 function Makie. $f! (axis, A:: AbstractDimVector ; axislegendkw= (;), attributes... )
151- args, merged_attributes = _pointbased1 (A, attributes; set_axis_attributes = false )
151+ args, merged_attributes = _pointbased1 (A; attributes... , _set_axis_attributes = false )
152152 return Makie.$ f! (axis, args... ; merged_attributes... )
153153 end
154154 end
155155end
156156
157157
158158function Makie. linesegments (A:: AbstractDimVector ; axislegendkw= (;), attributes... )
159- args, merged_attributes = _pointbased1 (A, attributes)
159+ args, merged_attributes = _pointbased1 (A; attributes... )
160160 lines = _interval_lines (A)
161161 p = Makie. linesegments (lines; merged_attributes... )
162162 axislegend (p. axis; merge= false , unique= false , axislegendkw... )
163163 return p
164164end
165165
166166function Makie. linesegments! (x, A:: AbstractDimVector ; attributes... )
167- args, merged_attributes = _pointbased1 (A, attributes)
167+ args, merged_attributes = _pointbased1 (A; attributes... )
168168 lines = _interval_lines (A)
169169 return Makie. linesegments (x, lines; merged_attributes... )
170170end
@@ -183,15 +183,15 @@ function Makie.plot!(ax, A::AbstractDimVector; kw...)
183183 only (isintervals (A)) ? Makie. linesegments! (ax, A; kw... ) : Makie. scatter (axis, A; kw... )
184184end
185185
186- function _pointbased1 (A, attributes; set_axis_attributes = true )
186+ function _pointbased1 (A; _set_axis_attributes = true , attributes ... )
187187 # Array/Dimension manipulation
188188 A1 = _prepare_for_makie (A)
189189 lookup_attributes, newdims = _split_attributes (A1)
190190 A2 = _restore_dim_names (set (A1, newdims[1 ] => newdims[1 ]), A)
191191 args = Makie. convert_arguments (Makie. PointBased (), A2)
192192 # Plot attribute generation
193193 user_attributes = Makie. Attributes (; attributes... )
194- axis_attributes = if set_axis_attributes
194+ axis_attributes = if _set_axis_attributes
195195 Attributes (;
196196 axis= (;
197197 xlabel= string (name (dims (A, 1 ))),
@@ -206,7 +206,7 @@ function _pointbased1(A, attributes; set_axis_attributes=true)
206206 label= DD. label (A),
207207 )
208208 merged_attributes = merge (user_attributes, axis_attributes, plot_attributes, lookup_attributes)
209- if ! set_axis_attributes
209+ if ! _set_axis_attributes
210210 delete! (merged_attributes, :axis )
211211 end
212212 return args, merged_attributes
@@ -228,11 +228,8 @@ for f in (:heatmap, :image, :contour, :contourf, :spy, :surface)
228228 """
229229 @eval begin
230230 @doc $ docstring
231- function Makie. $f (A:: AbstractDimMatrix ;
232- x= nothing , y= nothing , colorbarkw= (;), attributes...
233- ) where T
234- replacements = _keywords2dimpairs (x, y)
235- A1, A2, args, merged_attributes = _surface2 (A, attributes, replacements)
231+ function Makie. $f (A:: AbstractDimMatrix{T} ; colorbarkw= (;), attributes... ) where T
232+ A1, A2, args, merged_attributes = _surface2 (A; attributes... )
236233 p = if $ (f == :surface )
237234 # surface is an LScene so we cant pass attributes
238235 p = Makie.$ f (args... ; attributes... )
@@ -250,11 +247,8 @@ for f in (:heatmap, :image, :contour, :contourf, :spy, :surface)
250247 end
251248 return p
252249 end
253- function Makie. $f! (axis, A:: AbstractDimMatrix ;
254- x= nothing , y= nothing , colorbarkw= (;), attributes...
255- )
256- replacements = _keywords2dimpairs (x, y)
257- _, _, args, _ = _surface2 (A, attributes, replacements)
250+ function Makie. $f! (axis, A:: AbstractDimMatrix ; colorbarkw= (;), attributes... )
251+ _, _, args, _ = _surface2 (A, attributes)
258252 # No ColourBar in the ! in-place versions
259253 return Makie.$ f! (axis, args... ; attributes... )
260254 end
@@ -280,23 +274,23 @@ function Makie.plot!(ax, A::AbstractDimMatrix; kw...)
280274 end
281275end
282276
283- function Makie. linesegments (A:: AbstractDimArray ; axislegendkw = (;), attributes... )
284- # args, merged_attributes = _pointbased1(A, attributes)
277+ function Makie. linesegments (A:: AbstractDimMatrix ; attributes... )
278+ A1, A2, args, merged_attributes = _surface2 (A; attributes... )
285279 lines = vec (collect (DimLines (A)))
286- p = Makie. linesegments (lines; color= vec (A))# , merged_attributes...)
287- # axislegend(p.axis; merge=false, unique=false, axislegendkw...)
280+ p = Makie. linesegments (lines; color= vec (A), merged_attributes... )
288281 return p
289282end
290283
291- function Makie. linesegments! (x, A:: AbstractDimArray ; attributes... )
292- # args, merged_attributes = _pointbased1(A, attributes)
284+ function Makie. linesegments! (x, A:: AbstractDimMatrix ; attributes... )
285+ A1, A2, args, merged_attributes = _surface2 (A; attributes... )
293286 lines = collect (vec (DimLines (A)))
294- return Makie. linesegments (x, lines; colors= vec (A)) # , merged_attributes...)
287+ return Makie. linesegments (x, lines; colors= vec (A), merged_attributes... )
295288end
296289
297- function _surface2 (A, attributes, replacements)
290+ function _surface2 (A; x= nothing , y= nothing , attributes... )
291+ replacements = _keywords2dimpairs (x, y)
298292 # Array/Dimension manipulation
299- A1 = _prepare_for_makie (A, replacements)
293+ A1 = _prepare_for_makie (A; replacements)
300294 lookup_attributes, newdims = _split_attributes (A1)
301295 A2 = _restore_dim_names (set (A1, map (Pair, newdims, newdims)... ), A, replacements)
302296 args = Makie. convert_arguments (Makie. ContinuousSurface (), A2)
@@ -331,16 +325,15 @@ for f in (:volume, :volumeslices)
331325 """
332326 @eval begin
333327 @doc $ docstring
334- function Makie. $f (A:: AbstractDimArray{<:Any,3} ; x = nothing , y = nothing , z = nothing , attributes... )
328+ function Makie. $f (A:: AbstractDimArray{<:Any,3} ; attributes... )
335329 replacements = _keywords2dimpairs (x, y, z)
336- A1, A2, args, merged_attributes = _volume3 (A, attributes, replacements )
330+ A1, A2, args, merged_attributes = _volume3 (A; attributes... )
337331 p = Makie.$ f (args... ; merged_attributes... )
338332 p. axis. scene[OldAxis][:names , :axisnames ] = map (DD. label, DD. dims (A2))
339333 return p
340334 end
341- function Makie. $f! (axis, A:: AbstractDimArray{<:Any,3} ; x= nothing , y= nothing , z= nothing , attributes... )
342- replacements = _keywords2dimpairs (x, y, z)
343- _, _, args, _ = _volume3 (A, attributes, replacements)
335+ function Makie. $f! (axis, A:: AbstractDimArray{<:Any,3} ; attributes... )
336+ _, _, args, _ = _volume3 (A; attributes... )
344337 return Makie.$ f! (axis, args... ; attributes... )
345338 end
346339 end
@@ -369,27 +362,47 @@ function Makie.plot!(ax, A::AbstractDimArray{<:Any,3}; kw...)
369362 end
370363end
371364
372- function Makie. poly (A:: AbstractDimArray ; axislegendkw = (;), attributes... )
373- # args, merged_attributes = _pointbased1(A, attributes)
365+ function Makie. poly (A:: AbstractDimArray{<:Any,3} ; attributes... )
366+ A1, A2, args, merged_attributes = _volume3 (A; attributes... )
374367 dps = DimPolygons (A)
375368 polys = vec (collect (dps))
376369 # TODO this doesn't plot properly?
377370 # All polygons plat on the same plane
378- p = Makie. poly (polys; color= vec (A))# , merged_attributes...)
379- axislegend (p. axis; merge= false , unique= false , axislegendkw... )
371+ p = Makie. poly (polys; color= vec (A2), merged_attributes... )
380372 return p
381373end
382374
383- function Makie. poly! (x, A:: AbstractDimArray ; attributes... )
384- # args, merged_attributes = _pointbased1(A, attributes)
385- polys = collect (vec (DimPolygons (A)))
386- return Makie. poly (x, polys; colors= vec (A))# , merged_attributes...)
375+ function Makie. poly! (ax, A:: AbstractDimArray{<:Any,3} ; attributes... )
376+ A1, A2, args, merged_attributes = _volume3 (A; attributes... )
377+ polys = vec (collect (DimPolygons (A2)))
378+ return Makie. poly (ax, polys; color= vec (A), merged_attributes... )
379+ end
380+
381+ function Makie. linesegments (A:: AbstractDimArray{<:Any,3} ; attributes... )
382+ A1, A2, args, merged_attributes = _volume3 (A; attributes... )
383+ lines = vec (collect (DimLines (A)))
384+ p = Makie. linesegments (lines; color= vec (A), merged_attributes... )
385+ return p
386+ end
387+
388+ function Makie. linesegments! (ax, A:: AbstractDimArray{<:Any,3} ; attributes... )
389+ A1, A2, args, merged_attributes = _surface2 (A; attributes... )
390+ lines = collect (vec (DimLines (A)))
391+ return Makie. linesegments! (ax, lines; colors= vec (A), merged_attributes... )
392+ end
393+
394+ function Makie. scatter (A:: AbstractDimArray{<:Any,3} ; attributes... )
395+ A1, A2, args, merged_attributes = _volume3 (A; attributes... )
396+ points = vec (collect (DimPoints (A2)))
397+ p = Makie. scatter (points; color= vec (A), merged_attributes... )
398+ return p
387399end
388400
389401
390- function _volume3 (A, attributes, replacements)
402+ function _volume3 (A; x= nothing , y= nothing , z= nothing , attributes... )
403+ replacements = _keywords2dimpairs (x, y, z)
391404 # Array/Dimension manipulation
392- A1 = _prepare_for_makie (A, replacements)
405+ A1 = _prepare_for_makie (A; replacements)
393406 _, newdims = _split_attributes (A1)
394407 A2 = _restore_dim_names (set (A1, map (Pair, newdims, newdims)... ), A, replacements)
395408 args = Makie. convert_arguments (Makie. VolumeLike (), A2)
@@ -608,7 +621,7 @@ function _split_attributes(dim::Dimension)
608621 return attributes, dims[1 ]
609622end
610623
611- function _prepare_for_makie (A, replacements= ())
624+ function _prepare_for_makie (A; replacements= ())
612625 _permute_xyz (maybeshiftlocus (Center (), A; dims= (XDim, YDim)), replacements) |> _reorder
613626end
614627
0 commit comments