Skip to content

Commit 7b294fc

Browse files
committed
more tweaks
1 parent 232a9ba commit 7b294fc

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

ext/DimensionalDataMakie.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ for f in (:volume, :volumeslices)
326326
@eval begin
327327
@doc $docstring
328328
function Makie.$f(A::AbstractDimArray{<:Any,3}; attributes...)
329-
replacements = _keywords2dimpairs(x, y, z)
330329
A1, A2, args, merged_attributes = _volume3(A; attributes...)
331330
p = Makie.$f(args...; merged_attributes...)
332331
p.axis.scene[OldAxis][:names, :axisnames] = map(DD.label, DD.dims(A2))
@@ -341,7 +340,7 @@ end
341340

342341
function Makie.plot(A::AbstractDimArray{<:Any,3}; kw...)
343342
if all(isintervals(dims(A)))
344-
Makie.volume(A; kw...)
343+
Makie.volume(A; interpolate=false, kw...)
345344
elseif count(isintervals(A)) == 2
346345
Makie.poly(A; kw...)
347346
elseif count(isintervals(A)) == 1
@@ -352,7 +351,7 @@ function Makie.plot(A::AbstractDimArray{<:Any,3}; kw...)
352351
end
353352
function Makie.plot!(ax, A::AbstractDimArray{<:Any,3}; kw...)
354353
if all(isintervals(A))
355-
Makie.volume!(ax, A; kw...)
354+
Makie.volume!(ax, A; interpolate=false, kw...)
356355
elseif count(isintervals(A)) == 2
357356
Makie.poly!(ax, A; kw...)
358357
elseif count(isintervals(A)) == 1
@@ -369,6 +368,7 @@ function Makie.poly(A::AbstractDimArray{<:Any,3}; attributes...)
369368
# TODO this doesn't plot properly?
370369
# All polygons plat on the same plane
371370
p = Makie.poly(polys; color=vec(A2), merged_attributes...)
371+
p.axis.scene[OldAxis][:names, :axisnames] = map(DD.label, DD.dims(A2))
372372
return p
373373
end
374374

@@ -382,19 +382,23 @@ function Makie.linesegments(A::AbstractDimArray{<:Any,3}; attributes...)
382382
A1, A2, args, merged_attributes = _volume3(A; attributes...)
383383
lines = vec(collect(DimLines(A)))
384384
p = Makie.linesegments(lines; color=vec(A), merged_attributes...)
385+
p.axis.scene[OldAxis][:names, :axisnames] = map(DD.label, DD.dims(A2))
385386
return p
386387
end
387388

388389
function Makie.linesegments!(ax, A::AbstractDimArray{<:Any,3}; attributes...)
389390
A1, A2, args, merged_attributes = _surface2(A; attributes...)
390391
lines = collect(vec(DimLines(A)))
391-
return Makie.linesegments!(ax, lines; colors=vec(A), merged_attributes...)
392+
p = Makie.linesegments!(ax, lines; colors=vec(A), merged_attributes...)
393+
p.axis.scene[OldAxis][:names, :axisnames] = map(DD.label, DD.dims(A2))
394+
return p
392395
end
393396

394397
function Makie.scatter(A::AbstractDimArray{<:Any,3}; attributes...)
395398
A1, A2, args, merged_attributes = _volume3(A; attributes...)
396399
points = vec(collect(DimPoints(A2)))
397400
p = Makie.scatter(points; color=vec(A), merged_attributes...)
401+
p.axis.scene[OldAxis][:names, :axisnames] = map(DD.label, DD.dims(A2))
398402
return p
399403
end
400404

test/plotrecipes.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ using ColorTypes
257257
M.series!(ax, A2m)
258258
@test_throws ArgumentError M.plot(A2; y=:c)
259259
@test_throws ArgumentError M.plot!(ax, A2; y=:c)
260-
A2intervals1 = rand(X(10:10:100; sampling=Intervals(Start())), Y(1:3))
260+
A2intervals1 = rand(X(10:10:100; sampling=Intervals(Start())), Z(1:3))
261261
M.plot(A2intervals1)
262-
A2intervals2 = rand(X(10:10:100; sampling=Intervals(Start())), Y(1:3; sampling=Intervals(Start())))
262+
A2intervals2 = rand(X(10:10:100; sampling=Intervals(Start())), Z(1:3; sampling=Intervals(Start())))
263263
M.plot(A2intervals2)
264264

265265
# x/y can be specified
@@ -316,10 +316,10 @@ using ColorTypes
316316
fig, ax, _ = M.volumeslices(A3abc; z=:a)
317317
M.volumeslices!(ax, A3abc;z=:a)
318318

319-
A3intervals1 = rand(X(10:1:20; sampling=Intervals(Start())), Y(1:3), Z(10:20))
320-
M.plot(A3intervals1)
319+
A3intervals1 = rand(X(10:1:15; sampling=Intervals(Start())), Y(1:3), Dim{:C}(10:15))
320+
M.plot(A3intervals1; z=:C)
321321
# Broken from here
322-
A3intervals2 = rand(X(10:1:20; sampling=Intervals(Start())), Y(1:3), Z(10:20; sampling=Intervals(Start())))
322+
A3intervals2 = rand(X(10:1:15; sampling=Intervals(Start())), Y(1:3), Z(10:15; sampling=Intervals(Start())))
323323
M.plot(A3intervals2)
324324
A3intervals2a = rand(X(10:1:10; sampling=Intervals(Start())), Y(1:1; sampling=Intervals(Start())), Z(10:20))
325325
M.plot(A3intervals2a)

0 commit comments

Comments
 (0)