Merge branch 'master' of https://github.com/JuliaPlots/Plots.jl into component-tests
This commit is contained in:
commit
2b376a0e4a
@ -94,6 +94,12 @@ function attr!(axis::Axis, args...; kw...)
|
|||||||
for vi in v
|
for vi in v
|
||||||
discrete_value!(axis, vi)
|
discrete_value!(axis, vi)
|
||||||
end
|
end
|
||||||
|
#could perhaps use TimeType here, as Date and DateTime are both subtypes of TimeType
|
||||||
|
# or could perhaps check if dateformatter or datetimeformatter is in use
|
||||||
|
elseif k == :lims && isa(v, Tuple{Date,Date})
|
||||||
|
plotattributes[k] = (v[1].instant.periods.value, v[2].instant.periods.value)
|
||||||
|
elseif k == :lims && isa(v, Tuple{DateTime,DateTime})
|
||||||
|
plotattributes[k] = (v[1].instant.periods.value, v[2].instant.periods.value)
|
||||||
else
|
else
|
||||||
plotattributes[k] = v
|
plotattributes[k] = v
|
||||||
end
|
end
|
||||||
|
|||||||
@ -799,6 +799,9 @@ function py_set_scale(ax, sp::Subplot, axis::Axis)
|
|||||||
letter = axis[:letter]
|
letter = axis[:letter]
|
||||||
scale in supported_scales() || return @warn("Unhandled scale value in pyplot: $scale")
|
scale in supported_scales() || return @warn("Unhandled scale value in pyplot: $scale")
|
||||||
func = getproperty(ax, Symbol("set_", letter, "scale"))
|
func = getproperty(ax, Symbol("set_", letter, "scale"))
|
||||||
|
if PyPlot.version ≥ v"3.3" # https://matplotlib.org/3.3.0/api/api_changes.html
|
||||||
|
letter = Symbol("")
|
||||||
|
end
|
||||||
kw = KW()
|
kw = KW()
|
||||||
arg = if scale == :identity
|
arg = if scale == :identity
|
||||||
"linear"
|
"linear"
|
||||||
|
|||||||
@ -54,9 +54,9 @@ function _ijulia_display_dict(plt::Plot)
|
|||||||
elseif output_type == :html
|
elseif output_type == :html
|
||||||
mime = "text/html"
|
mime = "text/html"
|
||||||
out[mime] = sprint(show, MIME(mime), plt)
|
out[mime] = sprint(show, MIME(mime), plt)
|
||||||
|
_ijulia__extra_mime_info!(plt, out)
|
||||||
else
|
else
|
||||||
error("Unsupported output type $output_type")
|
error("Unsupported output type $output_type")
|
||||||
end
|
end
|
||||||
_ijulia__extra_mime_info!(plt, out)
|
|
||||||
out
|
out
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,4 +13,48 @@ using Plots, Test, Dates
|
|||||||
ref_xlims = (x[1].instant.periods.value, x[end].instant.periods.value)
|
ref_xlims = (x[1].instant.periods.value, x[end].instant.periods.value)
|
||||||
@test Plots.ylims(p) == ref_ylims
|
@test Plots.ylims(p) == ref_ylims
|
||||||
@test Plots.xlims(p) == ref_xlims
|
@test Plots.xlims(p) == ref_xlims
|
||||||
|
#@static if (haskey(ENV, "APPVEYOR") || haskey(ENV, "CI"))
|
||||||
|
@static if haskey(ENV, "APPVEYOR")
|
||||||
|
@info "Skipping display tests on AppVeyor"
|
||||||
|
else
|
||||||
|
@test isa(display(p), Nothing) == true
|
||||||
|
closeall()
|
||||||
|
end
|
||||||
|
end # testset
|
||||||
|
|
||||||
|
@testset "Date xlims" begin
|
||||||
|
y=[1.0*i*i for i in 1:10]
|
||||||
|
x=[Date(2019,11,i) for i in 1:10]
|
||||||
|
span = (Date(2019,10,31), Date(2019,11,11))
|
||||||
|
|
||||||
|
ref_xlims = map(date->date.instant.periods.value, span)
|
||||||
|
|
||||||
|
p = plot(x,y, xlims=span, widen = false)
|
||||||
|
|
||||||
|
@test Plots.xlims(p) == ref_xlims
|
||||||
|
#@static if (haskey(ENV, "APPVEYOR") || haskey(ENV, "CI"))
|
||||||
|
@static if haskey(ENV, "APPVEYOR")
|
||||||
|
@info "Skipping display tests on AppVeyor"
|
||||||
|
else
|
||||||
|
@test isa(display(p), Nothing) == true
|
||||||
|
closeall()
|
||||||
|
end
|
||||||
|
end # testset
|
||||||
|
|
||||||
|
@testset "DateTime xlims" begin
|
||||||
|
y=[1.0*i*i for i in 1:10]
|
||||||
|
x=[DateTime(2019,11,i,11) for i in 1:10]
|
||||||
|
span = (DateTime(2019,10,31,11,59,59), DateTime(2019,11,11,12,01,15))
|
||||||
|
|
||||||
|
ref_xlims = map(date->date.instant.periods.value, span)
|
||||||
|
|
||||||
|
p = plot(x,y, xlims=span, widen = false)
|
||||||
|
@test Plots.xlims(p) == ref_xlims
|
||||||
|
#@static if (haskey(ENV, "APPVEYOR") || haskey(ENV, "CI"))
|
||||||
|
@static if haskey(ENV, "APPVEYOR")
|
||||||
|
@info "Skipping display tests on AppVeyor"
|
||||||
|
else
|
||||||
|
@test isa(display(p), Nothing) == true
|
||||||
|
closeall()
|
||||||
|
end
|
||||||
end # testset
|
end # testset
|
||||||
|
|||||||
@ -33,10 +33,10 @@ include("test_axes.jl")
|
|||||||
include("test_axis_letter.jl")
|
include("test_axis_letter.jl")
|
||||||
include("test_components.jl")
|
include("test_components.jl")
|
||||||
include("test_shorthands.jl")
|
include("test_shorthands.jl")
|
||||||
|
include("integration_dates.jl")
|
||||||
include("test_recipes.jl")
|
include("test_recipes.jl")
|
||||||
include("test_hdf5plots.jl")
|
include("test_hdf5plots.jl")
|
||||||
include("test_pgfplotsx.jl")
|
include("test_pgfplotsx.jl")
|
||||||
include("integration_dates.jl")
|
|
||||||
|
|
||||||
reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
|
reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user