Center :image axes ticks (#4088)

This commit is contained in:
t-bltg 2022-02-16 22:05:50 +01:00 committed by GitHub
parent 88cd04b46a
commit a919fe59d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 16 deletions

View File

@ -677,7 +677,6 @@ end
# we return (continuous_value, discrete_index) # we return (continuous_value, discrete_index)
function discrete_value!(axis::Axis, dv) function discrete_value!(axis::Axis, dv)
cv_idx = get(axis[:discrete_map], dv, -1) cv_idx = get(axis[:discrete_map], dv, -1)
# @show axis[:discrete_map], axis[:discrete_values], dv
if cv_idx == -1 if cv_idx == -1
ex = axis[:extrema] ex = axis[:extrema]
cv = NaNMath.max(0.5, ex.emax + 1.0) cv = NaNMath.max(0.5, ex.emax + 1.0)

View File

@ -849,7 +849,6 @@ const _examples = PlotExample[
[ [
quote quote
begin begin
using Plots
default( default(
titlefont = (20, "times"), titlefont = (20, "times"),
legendfontsize = 18, legendfontsize = 18,
@ -1071,7 +1070,6 @@ const _examples = PlotExample[
"", "",
[ [
quote quote
using Plots
using TestImages using TestImages
img = testimage("lighthouse") img = testimage("lighthouse")
@ -1092,8 +1090,6 @@ const _examples = PlotExample[
"3d quiver", "3d quiver",
"", "",
[quote [quote
using Plots
ϕs = range(-π, π, length = 50) ϕs = range(-π, π, length = 50)
θs = range(0, π, length = 25) θs = range(0, π, length = 25)
θqs = range(1, π - 1, length = 25) θqs = range(1, π - 1, length = 25)

View File

@ -1380,7 +1380,8 @@ function clamp_greys!(mat::AMat{<:Gray})
end end
@recipe function f(mat::AMat{<:Gray}) @recipe function f(mat::AMat{<:Gray})
n, m = axes(mat) n, m = map(a -> range(0.5, stop = a.stop + 0.5), axes(mat))
if is_seriestype_supported(:image) if is_seriestype_supported(:image)
seriestype := :image seriestype := :image
yflip --> true yflip --> true
@ -1398,7 +1399,7 @@ end
# images - colors # images - colors
@recipe function f(mat::AMat{T}) where {T<:Colorant} @recipe function f(mat::AMat{T}) where {T<:Colorant}
n, m = axes(mat) n, m = map(a -> range(0.5, stop = a.stop + 0.5), axes(mat))
if is_seriestype_supported(:image) if is_seriestype_supported(:image)
seriestype := :image seriestype := :image

View File

@ -249,15 +249,6 @@ end
@test show(io, p) isa Nothing @test show(io, p) isa Nothing
end end
@testset "PlotlyJS" begin
@test plotlyjs() == Plots.PlotlyJSBackend()
@test backend() == Plots.PlotlyJSBackend()
p = plot(rand(10))
@test p isa Plots.Plot
@test_broken display(p) isa Nothing
end
@testset "GR" begin @testset "GR" begin
ENV["PLOTS_TEST"] = "true" ENV["PLOTS_TEST"] = "true"
ENV["GKSwstype"] = "100" ENV["GKSwstype"] = "100"
@ -274,4 +265,13 @@ end
) )
end end
end end
@testset "PlotlyJS" begin
@test plotlyjs() == Plots.PlotlyJSBackend()
@test backend() == Plots.PlotlyJSBackend()
p = plot(rand(10))
@test p isa Plots.Plot
@test_broken display(p) isa Nothing
end
end end