fix tests for gr
This commit is contained in:
parent
66d2e4746a
commit
3152d4b4fe
@ -5,6 +5,7 @@ version = "1.0.14"
|
|||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
||||||
|
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
|
||||||
Contour = "d38c429a-6771-53c6-b99e-75d170b6e991"
|
Contour = "d38c429a-6771-53c6-b99e-75d170b6e991"
|
||||||
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
||||||
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
|
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
|
||||||
@ -32,6 +33,7 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
|
|||||||
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||||
|
|
||||||
[compat]
|
[compat]
|
||||||
|
ColorSchemes = "3.6"
|
||||||
Contour = "0.5"
|
Contour = "0.5"
|
||||||
FFMPEG = "0.2, 0.3"
|
FFMPEG = "0.2, 0.3"
|
||||||
FixedPointNumbers = "0.6, 0.7, 0.8"
|
FixedPointNumbers = "0.6, 0.7, 0.8"
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import RecipesBase: plot, plot!, animate, is_explicit
|
|||||||
using Base.Meta
|
using Base.Meta
|
||||||
@reexport using PlotUtils
|
@reexport using PlotUtils
|
||||||
@reexport using PlotThemes
|
@reexport using PlotThemes
|
||||||
|
@reexport using ColorSchemes
|
||||||
import Showoff
|
import Showoff
|
||||||
import StatsBase
|
import StatsBase
|
||||||
import JSON
|
import JSON
|
||||||
|
|||||||
@ -880,7 +880,8 @@ function _update_min_padding!(sp::Subplot{GRBackend})
|
|||||||
tickfont(zaxis),
|
tickfont(zaxis),
|
||||||
halign = (zaxis[:mirror] ? :left : :right),
|
halign = (zaxis[:mirror] ? :left : :right),
|
||||||
valign = (:top, :vcenter, :bottom)[sign(zaxis[:rotation]) + 2],
|
valign = (:top, :vcenter, :bottom)[sign(zaxis[:rotation]) + 2],
|
||||||
rotation = zaxis[:rotation]
|
rotation = zaxis[:rotation],
|
||||||
|
color = zaxis[:tickfontcolor],
|
||||||
)
|
)
|
||||||
l = 0.01 + first(gr_get_ticks_size(zticks, zaxis[:rotation]))
|
l = 0.01 + first(gr_get_ticks_size(zticks, zaxis[:rotation]))
|
||||||
w = 1mm + gr_plot_size[1] * l * px
|
w = 1mm + gr_plot_size[1] * l * px
|
||||||
@ -1238,7 +1239,8 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
tickfont(xaxis),
|
tickfont(xaxis),
|
||||||
halign = (:left, :hcenter, :right)[sign(xaxis[:rotation]) + 2],
|
halign = (:left, :hcenter, :right)[sign(xaxis[:rotation]) + 2],
|
||||||
valign = (xaxis[:mirror] ? :bottom : :top),
|
valign = (xaxis[:mirror] ? :bottom : :top),
|
||||||
rotation = xaxis[:rotation]
|
rotation = xaxis[:rotation],
|
||||||
|
color = xaxis[:tickfontcolor],
|
||||||
)
|
)
|
||||||
yt = if sp[:framestyle] == :origin
|
yt = if sp[:framestyle] == :origin
|
||||||
0
|
0
|
||||||
@ -1268,7 +1270,8 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
tickfont(yaxis),
|
tickfont(yaxis),
|
||||||
halign = (:left, :hcenter, :right)[sign(yaxis[:rotation]) + 2],
|
halign = (:left, :hcenter, :right)[sign(yaxis[:rotation]) + 2],
|
||||||
valign = (yaxis[:mirror] ? :bottom : :top),
|
valign = (yaxis[:mirror] ? :bottom : :top),
|
||||||
rotation = yaxis[:rotation]
|
rotation = yaxis[:rotation],
|
||||||
|
color = yaxis[:tickfontcolor],
|
||||||
)
|
)
|
||||||
xt = if sp[:framestyle] == :origin
|
xt = if sp[:framestyle] == :origin
|
||||||
0
|
0
|
||||||
@ -1298,7 +1301,8 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
tickfont(zaxis),
|
tickfont(zaxis),
|
||||||
halign = (zaxis[:mirror] ? :left : :right),
|
halign = (zaxis[:mirror] ? :left : :right),
|
||||||
valign = (:top, :vcenter, :bottom)[sign(zaxis[:rotation]) + 2],
|
valign = (:top, :vcenter, :bottom)[sign(zaxis[:rotation]) + 2],
|
||||||
rotation = zaxis[:rotation]
|
rotation = zaxis[:rotation],
|
||||||
|
color = zaxis[:tickfontcolor],
|
||||||
)
|
)
|
||||||
xt = if sp[:framestyle] == :origin
|
xt = if sp[:framestyle] == :origin
|
||||||
0
|
0
|
||||||
@ -1662,8 +1666,6 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
elseif st == :heatmap
|
elseif st == :heatmap
|
||||||
zmin, zmax = clims
|
zmin, zmax = clims
|
||||||
fillgrad = _as_gradient(series[:fillcolor])
|
fillgrad = _as_gradient(series[:fillcolor])
|
||||||
colors = plot_color.(nan_get(fillgrad, z, clims), series[:fillalpha])
|
|
||||||
rgba = gr_color.(colors)
|
|
||||||
if !ispolar(sp)
|
if !ispolar(sp)
|
||||||
GR.setspace(clims..., 0, 90)
|
GR.setspace(clims..., 0, 90)
|
||||||
x, y = heatmap_edges(series[:x], sp[:xaxis][:scale], series[:y], sp[:yaxis][:scale], size(series[:z]))
|
x, y = heatmap_edges(series[:x], sp[:xaxis][:scale], series[:y], sp[:yaxis][:scale], size(series[:z]))
|
||||||
@ -1674,11 +1676,16 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
# pdf output, and also supports alpha values.
|
# pdf output, and also supports alpha values.
|
||||||
# Note that drawimage draws uniformly spaced data correctly
|
# Note that drawimage draws uniformly spaced data correctly
|
||||||
# even on log scales, where it is visually non-uniform.
|
# even on log scales, where it is visually non-uniform.
|
||||||
|
colors = plot_color.(nan_get(fillgrad, z, clims), series[:fillalpha])
|
||||||
|
rgba = gr_color.(colors)
|
||||||
GR.drawimage(first(x), last(x), last(y), first(y), w, h, rgba)
|
GR.drawimage(first(x), last(x), last(y), first(y), w, h, rgba)
|
||||||
else
|
else
|
||||||
if something(series[:fillalpha],1) < 1 || any(_gr_gradient_alpha .< 1)
|
if something(series[:fillalpha],1) < 1 || any(_gr_gradient_alpha .< 1)
|
||||||
@warn "GR: transparency not supported in non-uniform heatmaps. Alpha values ignored."
|
@warn "GR: transparency not supported in non-uniform heatmaps. Alpha values ignored."
|
||||||
end
|
end
|
||||||
|
colors = nan_get(fillgrad, z, clims)
|
||||||
|
z_normalized = map(c -> c == invisible() ? 256/255 : getinverse(fillgrad, c), colors)
|
||||||
|
rgba = Int32[round(Int32, 1000 + _i * 255) for _i in z_normalized]
|
||||||
GR.nonuniformcellarray(x, y, w, h, rgba)
|
GR.nonuniformcellarray(x, y, w, h, rgba)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -1693,8 +1700,11 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
if series[:y][end] != ny
|
if series[:y][end] != ny
|
||||||
@warn "Right now only the maximum value of y (r) is taken into account."
|
@warn "Right now only the maximum value of y (r) is taken into account."
|
||||||
end
|
end
|
||||||
|
colors = nan_get(fillgrad, z, clims)
|
||||||
|
z_normalized = map(c -> c == invisible() ? 256/255 : getinverse(fillgrad.colors, c), colors)
|
||||||
|
rgba = Int32[round(Int32, 1000 + _i * 255) for _i in z_normalized]
|
||||||
# GR.polarcellarray(0, 0, phimin, phimax, ymin, ymax, nx, ny, colors)
|
# GR.polarcellarray(0, 0, phimin, phimax, ymin, ymax, nx, ny, colors)
|
||||||
GR.polarcellarray(0, 0, phimin, phimax, 0, ymax, nx, ny, colors)
|
GR.polarcellarray(0, 0, phimin, phimax, 0, ymax, nx, ny, rgba)
|
||||||
# Right now only the maximum value of y (r) is taken into account.
|
# Right now only the maximum value of y (r) is taken into account.
|
||||||
# This is certainly not perfect but nonuniform polar array is not yet supported in GR.jl
|
# This is certainly not perfect but nonuniform polar array is not yet supported in GR.jl
|
||||||
end
|
end
|
||||||
|
|||||||
@ -74,7 +74,7 @@ const _examples = PlotExample[
|
|||||||
rand(11, 4),
|
rand(11, 4),
|
||||||
lab = "lines",
|
lab = "lines",
|
||||||
w = 3,
|
w = 3,
|
||||||
palette = :grays,
|
palette = cgrad(:grays),
|
||||||
fill = 0,
|
fill = 0,
|
||||||
α = 0.6,
|
α = 0.6,
|
||||||
)
|
)
|
||||||
@ -322,7 +322,7 @@ const _examples = PlotExample[
|
|||||||
plot(
|
plot(
|
||||||
Plots.fakedata(100, 10),
|
Plots.fakedata(100, 10),
|
||||||
layout = 4,
|
layout = 4,
|
||||||
palette = [:grays :blues :heat :lightrainbow],
|
palette = cgrad.([:grays :blues :heat :lightrainbow]),
|
||||||
bg_inside = [:orange :pink :darkblue :black],
|
bg_inside = [:orange :pink :darkblue :black],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user