Merge pull request #3066 from daschw/gr-polar

Fix polar heatmap on GR
This commit is contained in:
Daniel Schwabeneder 2020-10-15 10:04:59 +02:00 committed by GitHub
commit 7fe6a69a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -1,7 +1,7 @@
name = "Plots" name = "Plots"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
author = ["Tom Breloff (@tbreloff)"] author = ["Tom Breloff (@tbreloff)"]
version = "1.6.11" version = "1.6.12"
[deps] [deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

View File

@ -1493,7 +1493,7 @@ function gr_add_series(sp, series)
frng = series[:fillrange] frng = series[:fillrange]
# recompute data # recompute data
if ispolar(sp) if ispolar(sp) && z === nothing
rmin, rmax = axis_limits(sp, :y) rmin, rmax = axis_limits(sp, :y)
if frng !== nothing if frng !== nothing
_, frng = convert_to_polar(x, frng, (rmin, rmax)) _, frng = convert_to_polar(x, frng, (rmin, rmax))
@ -1733,7 +1733,7 @@ function gr_draw_heatmap(series, x, y, z, clims)
else else
phimin, phimax = 0.0, 360.0 # nonuniform polar array is not yet supported in GR.jl phimin, phimax = 0.0, 360.0 # nonuniform polar array is not yet supported in GR.jl
nx, ny = length(series[:x]), length(series[:y]) nx, ny = length(series[:x]), length(series[:y])
xmin, xmax, ymin, ymax = gr_xy_axislims(sp) xmin, xmax, ymin, ymax = gr_xy_axislims(series[:subplot])
GR.setwindow(-ymax, ymax, -ymax, ymax) GR.setwindow(-ymax, ymax, -ymax, ymax)
if ymin > 0 if ymin > 0
@warn "'ymin[1] > 0' (rmin) is not yet supported." @warn "'ymin[1] > 0' (rmin) is not yet supported."

View File

@ -1040,15 +1040,23 @@ const _examples = PlotExample[
) )
end] end]
), ),
PlotExample( # 49
"Polar heatmaps",
"",
[quote
z = (1:4) .+ (1:8)'
heatmap(z, projection = :polar)
end]
),
] ]
# Some constants for PlotDocs and PlotReferenceImages # Some constants for PlotDocs and PlotReferenceImages
_animation_examples = [2, 31] _animation_examples = [2, 31]
_backend_skips = Dict( _backend_skips = Dict(
:gr => [25, 30, 47], :gr => [25, 30, 47],
:pyplot => [2, 25, 30, 31, 47], :pyplot => [2, 25, 30, 31, 47, 49],
:plotlyjs => [2, 21, 24, 25, 30, 31], :plotlyjs => [2, 21, 24, 25, 30, 31, 49],
:plotly => [2, 21, 24, 25, 30, 31], :plotly => [2, 21, 24, 25, 30, 31, 49],
:pgfplots => [2, 5, 6, 10, 16, 20, 22, 23, 25, 28, 30, 31, 34, 37, 38, 39, 47], :pgfplots => [2, 5, 6, 10, 16, 20, 22, 23, 25, 28, 30, 31, 34, 37, 38, 39, 47],
:pgfplotsx => [ :pgfplotsx => [
2, # animation 2, # animation
@ -1059,6 +1067,7 @@ _backend_skips = Dict(
31, # animation 31, # animation
32, # spy 32, # spy
47, # mesh3 47, # mesh3
49, # polar heatmap
], ],
) )