Compare commits
68 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c32dbeef8a | |||
| 06bc99ef68 | |||
| 9305cd41ab | |||
| 7427a85661 | |||
| 8abae0c575 | |||
| 3963957e70 | |||
| 58381822d9 | |||
| 2472ce164b | |||
| c94cf1855d | |||
| 6baa120245 | |||
| 7e5ba301fd | |||
| 138589bb61 | |||
| c2af71756e | |||
| c1e88d0360 | |||
| e0ea601239 | |||
| e471ce8d28 | |||
| 1bdec476c3 | |||
| b23c620d77 | |||
| 21c3ac4c45 | |||
| 861f537736 | |||
| e9ae75dfa4 | |||
| 07bcecd47c | |||
| af3ebe9936 | |||
| 9d3ce54c37 | |||
| 6df1f38492 | |||
| c4b7757e22 | |||
| d1309c6c7b | |||
| 58ed4a60de | |||
| 70dec42308 | |||
| fdbd2c397c | |||
| c337f15e18 | |||
| 1fe9a9f536 | |||
| 41cf64b400 | |||
| 19b70c06ff | |||
| 40fe8eed9a | |||
| 4b94384c7d | |||
| 35e96a5302 | |||
| e84905c2a0 | |||
| 1c621feacc | |||
| e8356965e9 | |||
| 72428000cc | |||
| d9116d577f | |||
| 96dbd07627 | |||
| 804fab45ad | |||
| 2e67e84361 | |||
| b298711379 | |||
| bacf2d2f06 | |||
| bb9cd718a5 | |||
| 0af22a8fe6 | |||
| 3b0950f915 | |||
| 31d3bf3e06 | |||
| c487a10f79 | |||
| ef3417617c | |||
| 0d2d516ca6 | |||
| 12a1d83595 | |||
| 9eba5964d9 | |||
| d74ee63710 | |||
| 9941563b0b | |||
| fb82722dd3 | |||
| 86a9b8bf6d | |||
| 5a19673eaf | |||
| c26561eab3 | |||
| f0ad66da36 | |||
| aca2aa49b8 | |||
| 9d56e72f6a | |||
| f06225655d | |||
| 4f0f84f400 | |||
| a65cda8b7e |
@@ -69,7 +69,11 @@ jobs:
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: CompileBot postprocess
|
||||
run: julia -e 'using Pkg; Pkg.add( PackageSpec(name = "CompileBot", version = "1") ); using CompileBot; CompileBot.postprocess();'
|
||||
run: |
|
||||
ls artifact
|
||||
ls
|
||||
if ! grep -m1 -q 'format' artifact/src/precompile_includer.jl; then sed -i '1 i\#! format: off' artifact/src/precompile_includer.jl; fi
|
||||
julia -e 'using Pkg; Pkg.add( PackageSpec(name = "CompileBot", version = "1") ); using CompileBot; CompileBot.postprocess();'
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
|
||||
# Codecov
|
||||
- uses: julia-actions/julia-processcoverage@v1
|
||||
- uses: codecov/codecov-action@v1
|
||||
- uses: codecov/codecov-action@v2
|
||||
with:
|
||||
file: lcov.info
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install JuliaFormatter and format
|
||||
run: |
|
||||
julia -e 'using Pkg; pkg"add JuliaFormatter CSTParser#master"'
|
||||
julia -e 'using Pkg; pkg"add JuliaFormatter"'
|
||||
julia -e 'using JuliaFormatter; [format(["src", "test"]) for _ in 1:2]'
|
||||
git diff --exit-code
|
||||
|
||||
|
||||
+7
-1
@@ -401,7 +401,7 @@
|
||||
"type": "Other"
|
||||
},
|
||||
{
|
||||
"name": "Moesè Giodano",
|
||||
"name": "Mosè Giodano",
|
||||
"type": "Other"
|
||||
},
|
||||
{
|
||||
@@ -696,6 +696,12 @@
|
||||
{
|
||||
"name": "Jan Thorben Schneider",
|
||||
"type": "Other"
|
||||
},
|
||||
{
|
||||
"orcid": "0000-0003-4102-2460",
|
||||
"affiliation": "Alogus Research Corporation",
|
||||
"name": "Lee Phillips",
|
||||
"type": "Other"
|
||||
}
|
||||
],
|
||||
"upload_type": "software"
|
||||
|
||||
+7
-4
@@ -1,7 +1,7 @@
|
||||
name = "Plots"
|
||||
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
|
||||
author = ["Tom Breloff (@tbreloff)"]
|
||||
version = "1.22.3"
|
||||
version = "1.24.3"
|
||||
|
||||
[deps]
|
||||
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
||||
@@ -31,13 +31,14 @@ Showoff = "992d4aef-0814-514b-bc4d-f2e9a6c4116f"
|
||||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
||||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
|
||||
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
|
||||
UnicodeFun = "1cfade01-22cf-5700-b092-accc4b62d6e1"
|
||||
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||
|
||||
[compat]
|
||||
Contour = "0.5"
|
||||
FFMPEG = "0.2 - 0.4"
|
||||
FixedPointNumbers = "0.6 - 0.8"
|
||||
GR = "0.53 - 0.59"
|
||||
GR = "0.62.1"
|
||||
GeometryBasics = "0.2, 0.3.1, 0.4"
|
||||
JSON = "0.21, 1"
|
||||
Latexify = "0.14 - 0.15"
|
||||
@@ -45,17 +46,19 @@ Measures = "0.3"
|
||||
NaNMath = "0.3"
|
||||
PlotThemes = "2"
|
||||
PlotUtils = "1"
|
||||
RecipesBase = "1"
|
||||
RecipesBase = "1.2"
|
||||
RecipesPipeline = "0.3.5, 0.4"
|
||||
Reexport = "0.2, 1.0"
|
||||
Requires = "1"
|
||||
Scratch = "1"
|
||||
Showoff = "0.3.1, 1.0"
|
||||
StatsBase = "0.32 - 0.33"
|
||||
UnicodeFun = "0.4"
|
||||
UnicodePlots = "2.4"
|
||||
julia = "1.5"
|
||||
|
||||
[extras]
|
||||
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
|
||||
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
|
||||
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
|
||||
Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
|
||||
@@ -76,4 +79,4 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
|
||||
VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"
|
||||
|
||||
[targets]
|
||||
test = ["Distributions", "FileIO", "Gtk", "ImageMagick", "Images", "LibGit2", "OffsetArrays", "PGFPlotsX", "PlotlyJS", "HDF5", "RDatasets", "StableRNGs", "StaticArrays", "StatsPlots", "Test", "TestImages", "UnicodePlots", "VisualRegressionTests"]
|
||||
test = ["Colors", "Distributions", "FileIO", "Gtk", "ImageMagick", "Images", "LibGit2", "OffsetArrays", "PGFPlotsX", "PlotlyJS", "HDF5", "RDatasets", "StableRNGs", "StaticArrays", "StatsPlots", "Test", "TestImages", "UnicodePlots", "VisualRegressionTests"]
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
[gitter-url]: https://gitter.im/tbreloff/Plots.jl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
||||
|
||||
[docs-img]: https://img.shields.io/badge/docs-stable-blue.svg
|
||||
[docs-url]: http://docs.juliaplots.org/latest/
|
||||
[docs-url]: https://docs.juliaplots.org/latest/
|
||||
|
||||
[![][gh-ci-img]][gh-ci-url]
|
||||
[![][pkgeval-img]][pkgeval-url]
|
||||
|
||||
+24
-47
@@ -66,8 +66,6 @@ end
|
||||
|
||||
function _precompile_()
|
||||
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(Type)),NamedTuple{(:label, :blank), Tuple{Symbol, Bool}},Type{EmptyLayout}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(Type)),NamedTuple{(:label, :width, :height), Tuple{Symbol, Symbol, Length{:pct, Float64}}},Type{EmptyLayout}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(Type)),NamedTuple{(:parent,), Tuple{GridLayout}},Type{Subplot},GRBackend})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(Type)),NamedTuple{(:parent,), Tuple{GridLayout}},Type{Subplot},PlotlyBackend})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(Type)),NamedTuple{(:parent,), Tuple{Subplot{GRBackend}}},Type{Subplot},GRBackend})
|
||||
@@ -76,15 +74,12 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(_make_hist)),NamedTuple{(:normed, :weights), Tuple{Bool, Nothing}},typeof(_make_hist),Tuple{Vector{Float64}, Vector{Float64}},Tuple{Int64, Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(_make_hist)),NamedTuple{(:normed, :weights), Tuple{Bool, Nothing}},typeof(_make_hist),Tuple{Vector{Float64}},Symbol})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(_make_hist)),NamedTuple{(:normed, :weights), Tuple{Bool, Vector{Int64}}},typeof(_make_hist),Tuple{Vector{Float64}},Symbol})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:flip,), Tuple{Bool}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:formatter,), Tuple{Symbol}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:formatter,), Tuple{typeof(datetimeformatter)}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :flip, :minorgrid, :guide), Tuple{Bool, Bool, Bool, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :lims), Tuple{Bool, Tuple{Float64, Float64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :lims, :flip), Tuple{Bool, Tuple{Float64, Float64}, Bool}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :minorgrid, :guide), Tuple{Bool, Bool, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :minorgrid, :mirror, :guide), Tuple{Bool, Bool, Bool, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid,), Tuple{Bool}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:gridlinewidth, :grid, :gridalpha, :gridstyle, :foreground_color_grid), Tuple{Int64, Bool, Float64, Symbol, RGBA{Float64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:guide,), Tuple{String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:guide_position, :guidefontvalign, :mirror, :guide), Tuple{Symbol, Symbol, Bool, String}},typeof(attr!),Axis})
|
||||
@@ -92,11 +87,7 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims, :flip, :ticks, :guide), Tuple{Tuple{Int64, Int64}, Bool, StepRange{Int64, Int64}, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims,), Tuple{Tuple{Float64, Float64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims,), Tuple{Tuple{Int64, Float64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims,), Tuple{Tuple{Int64, Int64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:minorgrid, :scale, :guide), Tuple{Bool, Symbol, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:minorgrid,), Tuple{Bool}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:rotation,), Tuple{Int64}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:ticks,), Tuple{Nothing}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:ticks,), Tuple{UnitRange{Int64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(default)),NamedTuple{(:shape,), Tuple{Symbol}},typeof(default)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(default)),NamedTuple{(:titlefont, :legendfontsize, :guidefont, :tickfont, :guide, :framestyle, :yminorgrid), Tuple{Tuple{Int64, String}, Int64, Tuple{Int64, Symbol}, Tuple{Int64, Symbol}, String, Symbol, Bool}},typeof(default)})
|
||||
@@ -107,12 +98,11 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(gr_polyline)),NamedTuple{(:arrowside, :arrowstyle), Tuple{Symbol, Symbol}},typeof(gr_polyline),UnitRange{Int64},UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(gr_polyline)),NamedTuple{(:arrowside, :arrowstyle), Tuple{Symbol, Symbol}},typeof(gr_polyline),UnitRange{Int64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(gr_polyline)),NamedTuple{(:arrowside, :arrowstyle), Tuple{Symbol, Symbol}},typeof(gr_polyline),Vector{Int64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(hline!)),Any,typeof(hline!),Any})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:alpha, :seriestype), Tuple{Float64, Symbol}},typeof(plot!),Plot{GRBackend},Vector{GeometryBasics.Point2{Float64}}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:alpha, :seriestype), Tuple{Float64, Symbol}},typeof(plot!),Plot{PlotlyBackend},Vector{GeometryBasics.Point2{Float64}}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:alpha, :seriestype), Tuple{Float64, Symbol}},typeof(plot!),Vector{GeometryBasics.Point2{Float64}}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:annotation,), Tuple{Vector{Tuple{Int64, Float64, Tuple{String, Any, Any, Any}}}}},typeof(plot!)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:layout, :margin), Tuple{GridLayout, AbsoluteLength}},typeof(plot!),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:layout, :margin), Tuple{Matrix{Any}, AbsoluteLength}},typeof(plot!),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:legend,), Tuple{Bool}},typeof(plot!),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:legend,), Tuple{Bool}},typeof(plot!),Plot{PlotlyBackend},Plot{PlotlyBackend},Plot{PlotlyBackend},Vararg{Plot{PlotlyBackend}, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:legend,), Tuple{Symbol}},typeof(plot!),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
@@ -125,8 +115,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:marker, :series_annotations, :seriestype), Tuple{Tuple{Int64, Float64, Symbol}, Vector{Any}, Symbol}},typeof(plot!),Plot{GRBackend},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:marker, :series_annotations, :seriestype), Tuple{Tuple{Int64, Float64, Symbol}, Vector{Any}, Symbol}},typeof(plot!),Plot{PlotlyBackend},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:marker, :series_annotations, :seriestype), Tuple{Tuple{Int64, Float64, Symbol}, Vector{Any}, Symbol}},typeof(plot!),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:markersize, :c, :seriestype), Tuple{Int64, Symbol, Symbol}},typeof(plot!),Plot{GRBackend},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:markersize, :c, :seriestype), Tuple{Int64, Symbol, Symbol}},typeof(plot!),Plot{PlotlyBackend},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:markersize, :c, :seriestype), Tuple{Int64, Symbol, Symbol}},typeof(plot!),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:seriestype, :inset), Tuple{Symbol, Tuple{Int64, BoundingBox{Tuple{Length{:w, Float64}, Length{:h, Float64}}, Tuple{Length{:w, Float64}, Length{:h, Float64}}}}}},typeof(plot!),Plot{GRBackend},Vector{Int64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:seriestype, :inset), Tuple{Symbol, Tuple{Int64, BoundingBox{Tuple{Length{:w, Float64}, Length{:h, Float64}}, Tuple{Length{:w, Float64}, Length{:h, Float64}}}}}},typeof(plot!),Plot{PlotlyBackend},Vector{Int64},Vector{Float64}})
|
||||
@@ -139,8 +127,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:title,), Tuple{String}},typeof(plot!)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:w,), Tuple{Int64}},typeof(plot!),Plot{GRBackend},Vector{Float64},Vector{Float64},Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:xgrid,), Tuple{Tuple{Symbol, Symbol, Int64, Symbol, Float64}}},typeof(plot!),Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:yaxis, :minorgrid), Tuple{Tuple{String, Symbol}, Bool}},typeof(plot!),Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:yaxis, :minorgrid), Tuple{Tuple{String, Symbol}, Bool}},typeof(plot!),Plot{PlotlyBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:yaxis, :minorgrid), Tuple{Tuple{String, Symbol}, Bool}},typeof(plot!)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:zcolor, :m, :ms, :lab, :seriestype), Tuple{Vector{Float64}, Tuple{Symbol, Float64, Stroke}, Vector{Float64}, String, Symbol}},typeof(plot!),Plot{GRBackend},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:zcolor, :m, :ms, :lab, :seriestype), Tuple{Vector{Float64}, Tuple{Symbol, Float64, Stroke}, Vector{Float64}, String, Symbol}},typeof(plot!),Plot{PlotlyBackend},Vector{Float64}})
|
||||
@@ -148,27 +134,28 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:annotations, :leg), Tuple{Tuple{Int64, Float64, PlotText}, Bool}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:arrow,), Tuple{Int64}},typeof(plot),Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:aspect_ratio, :seriestype), Tuple{Int64, Symbol}},typeof(plot),Vector{String},Vector{String},Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:bar_width, :alpha, :color, :fillto, :label, :seriestype), Tuple{Float64, Float64, Vector{Symbol}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, String, Symbol}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:bins, :weights, :seriestype), Tuple{Symbol, Vector{Int64}, Symbol}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:color, :line, :marker), Tuple{Matrix{Symbol}, Tuple{Symbol, Int64}, Tuple{Matrix{Symbol}, Int64, Float64, Stroke}}},typeof(plot),Vector{Vector{T} where T}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:connections, :title, :xlabel, :ylabel, :zlabel, :legend, :margin, :seriestype), Tuple{Tuple{Vector{Int64}, Vector{Int64}, Vector{Int64}}, String, String, String, String, Symbol, AbsoluteLength, Symbol}},typeof(plot),Vector{Int64},Vector{Int64},Vector{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:fill, :seriestype), Tuple{Bool, Symbol}},typeof(plot),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Function})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:fill_z, :alpha, :label, :bar_width, :seriestype), Tuple{StepRange{Int64, Int64}, Vector{Float64}, String, UnitRange{Int64}, Symbol}},typeof(plot),Vector{Int64},Vector{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:framestyle, :title, :color, :layout, :label, :markerstrokewidth, :ticks, :seriestype), Tuple{Matrix{Symbol}, Matrix{String}, Base.ReshapedArray{Int64, 2, UnitRange{Int64}, Tuple{}}, Int64, String, Int64, UnitRange{Int64}, Symbol}},typeof(plot),Vector{Vector{Float64}},Vector{Vector{Float64}}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:grid, :title), Tuple{Tuple{Symbol, Symbol, Symbol, Int64, Float64}, String}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:lab, :w, :palette, :fill, :α), Tuple{String, Int64, PlotUtils.ContinuousColorGradient, Int64, Float64}},typeof(plot),StepRange{Int64, Int64},Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:label, :title, :xlabel, :linewidth, :legend), Tuple{Matrix{String}, String, String, Int64, Symbol}},typeof(plot),Vector{Function},Float64,Float64})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:label,), Tuple{Matrix{String}}},typeof(plot),Vector{AbstractVector{Float64}}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:labels,), Tuple{Matrix{String}}},typeof(plot),PortfolioComposition})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :group, :linetype, :linecolor), Tuple{GridLayout, Vector{String}, Matrix{Symbol}, Symbol}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :group, :linetype, :linecolor), Tuple{Matrix{Any}, Vector{String}, Matrix{Symbol}, Symbol}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :label, :fillrange, :fillalpha), Tuple{Tuple{Int64, Int64}, String, Int64, Float64}},typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :label, :fillrange, :fillalpha), Tuple{Tuple{Int64, Int64}, String, Int64, Float64}},typeof(plot),Plot{PlotlyBackend},Plot{PlotlyBackend},Plot{PlotlyBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :link), Tuple{Int64, Symbol}},typeof(plot),Plot{GRBackend},Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :link), Tuple{Int64, Symbol}},typeof(plot),Plot{PlotlyBackend},Plot{PlotlyBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :margin), Tuple{GridLayout, AbsoluteLength}},typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :margin), Tuple{Matrix{Any}, AbsoluteLength}},typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :palette, :bg_inside), Tuple{Int64, Matrix{PlotUtils.ContinuousColorGradient}, Matrix{Symbol}}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :t, :leg, :ticks, :border), Tuple{GridLayout, Matrix{Symbol}, Bool, Nothing, Symbol}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :title, :titlelocation, :left_margin, :bottom_margin, :xrotation), Tuple{GridLayout, Matrix{String}, Symbol, Matrix{AbsoluteLength}, AbsoluteLength, Int64}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :t, :leg, :ticks, :border), Tuple{Matrix{Any}, Matrix{Symbol}, Bool, Nothing, Symbol}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :title, :titlelocation, :left_margin, :bottom_margin, :xrotation), Tuple{Matrix{Any}, Matrix{String}, Symbol, Matrix{AbsoluteLength}, AbsoluteLength, Int64}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :xguide, :yguide, :xguidefonthalign, :yguidefontvalign, :xguideposition, :yguideposition, :ymirror, :xmirror, :legend, :seriestype), Tuple{Int64, String, String, Matrix{Symbol}, Matrix{Symbol}, Symbol, Matrix{Symbol}, Matrix{Bool}, Matrix{Bool}, Bool, Matrix{Symbol}}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :xlims), Tuple{GridLayout, Tuple{Int64, Float64}}},typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout, :xlims), Tuple{Matrix{Any}, Tuple{Int64, Float64}}},typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout,), Tuple{Tuple{Int64, Int64}}},typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:layout,), Tuple{Tuple{Int64, Int64}}},typeof(plot),Plot{PlotlyBackend},Plot{PlotlyBackend},Plot{PlotlyBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:legend,), Tuple{Bool}},typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
@@ -192,14 +179,12 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:projection, :seriestype), Tuple{Symbol, Symbol}},typeof(plot),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},UnitRange{Int64},Matrix{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:quiver, :seriestype), Tuple{Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}, Symbol}},typeof(plot),Vector{Float64},Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:reg, :fill), Tuple{Bool, Tuple{Int64, Symbol}}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{Int64}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{Tuple{LinRange{Float64}, LinRange{Float64}}}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{typeof(sqrt)}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype, :markershape, :markersize, :color), Tuple{Matrix{Symbol}, Vector{Symbol}, Int64, Vector{Symbol}}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),Vector{DateTime},UnitRange{Int64},Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),Vector{OHLC}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:st, :xlabel, :ylabel, :zlabel), Tuple{Symbol, String, String, String}},typeof(plot),Vector{Float64},Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:title, :l, :seriestype), Tuple{String, Float64, Symbol}},typeof(plot),Vector{String},Vector{Float64}})
|
||||
@@ -213,7 +198,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:zcolor, :m, :leg, :cbar, :w), Tuple{StepRange{Int64, Int64}, Tuple{Int64, Float64, Symbol, Stroke}, Bool, Bool, Int64}},typeof(plot),Vector{Float64},Vector{Float64},UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(portfoliocomposition)),Any,typeof(portfoliocomposition),Any,Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(scatter!)),Any,typeof(scatter!),Any})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(test_examples)),NamedTuple{(:skip, :disp), Tuple{Vector{Int64}, Bool}},typeof(test_examples),Symbol})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(test_examples)),NamedTuple{(:skip,), Tuple{Vector{Int64}}},typeof(test_examples),Symbol})
|
||||
Base.precompile(Tuple{Type{GridLayout},Int64,Vararg{Int64, N} where N})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},AbstractVector{OHLC}})
|
||||
@@ -231,29 +215,24 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:sticks}},Any,Any,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:vline}},Any,Any,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:xerror}},Any,Any,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:zerror}},Any,Any,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Vector{ComplexF64}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.add_series!),Plot{GRBackend},DefaultsDict})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.add_series!),Plot{PlotlyBackend},DefaultsDict})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.plot_setup!),Plot{GRBackend},Dict{Symbol, Any},Vector{Dict{Symbol, Any}}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.plot_setup!),Plot{PlotlyBackend},Dict{Symbol, Any},Vector{Dict{Symbol, Any}}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.preprocess_attributes!),Plot{GRBackend},DefaultsDict})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.preprocess_axis_args!),Plot{PlotlyBackend},Dict{Symbol, Any},Symbol})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.process_userrecipe!),Plot{GRBackend},Vector{Dict{Symbol, Any}},Dict{Symbol, Any}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.process_userrecipe!),Plot{PlotlyBackend},Vector{Dict{Symbol, Any}},Dict{Symbol, Any}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.warn_on_recipe_aliases!),Plot{GRBackend},DefaultsDict,Symbol,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.warn_on_recipe_aliases!),Plot{GRBackend},Dict{Symbol, Any},Symbol,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.warn_on_recipe_aliases!),Plot{PlotlyBackend},DefaultsDict,Symbol,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.warn_on_recipe_aliases!),Plot{PlotlyBackend},Dict{Symbol, Any},Symbol,Any})
|
||||
Base.precompile(Tuple{typeof(_bin_centers),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{Float64},String})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{Int64},String})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{Nothing},String})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{PlotUtils.ContinuousColorGradient},String})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}},String})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{Symbol},String})
|
||||
Base.precompile(Tuple{typeof(_cycle),Base.OneTo{Int64},Vector{Int64}})
|
||||
Base.precompile(Tuple{typeof(_cycle),ColorPalette,Int64})
|
||||
Base.precompile(Tuple{typeof(_cycle),StepRange{Int64, Int64},Vector{Int64}})
|
||||
Base.precompile(Tuple{typeof(_cycle),Vector{Float64},StepRange{Int64, Int64}})
|
||||
Base.precompile(Tuple{typeof(_cycle),Vector{Float64},Vector{Int64}})
|
||||
Base.precompile(Tuple{typeof(_do_plot_show),Plot{GRBackend},Bool})
|
||||
Base.precompile(Tuple{typeof(_do_plot_show),Plot{PlotlyBackend},Bool})
|
||||
Base.precompile(Tuple{typeof(_heatmap_edges),Vector{Float64},Bool,Bool})
|
||||
@@ -263,6 +242,8 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(_update_min_padding!),GridLayout})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_args),Plot{GRBackend},Subplot{GRBackend},Dict{Symbol, Any},Int64,Bool})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_args),Plot{PlotlyBackend},Subplot{PlotlyBackend},Dict{Symbol, Any},Int64,Bool})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_legend),Subplot{GRBackend},Dict{Symbol, Any}})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_legend),Subplot{PlotlyBackend},Dict{Symbol, Any}})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_periphery),Subplot{GRBackend},Vector{Any}})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_periphery),Subplot{PlotlyBackend},Vector{Any}})
|
||||
Base.precompile(Tuple{typeof(axis_limits),Subplot{GRBackend},Symbol,Bool,Bool})
|
||||
@@ -272,14 +253,14 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(bbox),Float64,Float64,Float64,Float64})
|
||||
Base.precompile(Tuple{typeof(build_layout),GridLayout,Int64,Vector{Plot}})
|
||||
Base.precompile(Tuple{typeof(convert_to_polar),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64},Tuple{Int64, Float64}})
|
||||
Base.precompile(Tuple{typeof(create_grid),Expr})
|
||||
Base.precompile(Tuple{typeof(error_coords),Vector{Float64},Vector{Float64},Vector{Float64},Vararg{Vector{Float64}, N} where N})
|
||||
Base.precompile(Tuple{typeof(error_coords),Vector{Float64},Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{typeof(error_zipit),Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}})
|
||||
Base.precompile(Tuple{typeof(fakedata),Int64,Int64})
|
||||
Base.precompile(Tuple{typeof(get_clims),Subplot{GRBackend},Series,Function})
|
||||
Base.precompile(Tuple{typeof(get_minor_ticks),Subplot{GRBackend},Axis,Tuple{Vector{Float64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(get_minor_ticks),Subplot{GRBackend},Axis,Tuple{Vector{Int64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(get_series_color),SubArray{Symbol, 1, Vector{Symbol}, Tuple{UnitRange{Int64}}, true},Subplot{GRBackend},Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(get_series_color),SubArray{Symbol, 1, Vector{Symbol}, Tuple{UnitRange{Int64}}, true},Subplot{PlotlyBackend},Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(get_series_color),Vector{Symbol},Subplot{GRBackend},Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(get_series_color),Vector{Symbol},Subplot{PlotlyBackend},Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(get_ticks),StepRange{Int64, Int64},Vector{Float64},Vector{Any},Tuple{Int64, Int64},Vararg{Any, N} where N})
|
||||
@@ -304,12 +285,15 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(gr_draw_surface),Series,Vector{Float64},Vector{Float64},Matrix{Float64},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_draw_surface),Series,Vector{Float64},Vector{Float64},Vector{Float64},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_fill_viewport),Vector{Float64},RGBA{Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_get_3d_axis_angle),Vector{Float64},Float64,Float64,Symbol})
|
||||
Base.precompile(Tuple{typeof(gr_get_ticks_size),Tuple{Vector{Float64}, Vector{String}},Int64})
|
||||
Base.precompile(Tuple{typeof(gr_get_ticks_size),Tuple{Vector{Int64}, Vector{String}},Int64})
|
||||
Base.precompile(Tuple{typeof(gr_label_ticks),Subplot{GRBackend},Symbol,Tuple{Vector{Float64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(gr_label_ticks),Subplot{GRBackend},Symbol,Tuple{Vector{Int64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(gr_label_ticks_3d),Subplot{GRBackend},Symbol,Tuple{Vector{Float64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(gr_polaraxes),Int64,Float64,Subplot{GRBackend}})
|
||||
Base.precompile(Tuple{typeof(gr_set_gradient),PlotUtils.ContinuousColorGradient})
|
||||
Base.precompile(Tuple{typeof(gr_text),Float64,Float64,String})
|
||||
Base.precompile(Tuple{typeof(gr_update_viewport_legend!),Vector{Float64},Subplot{GRBackend},NamedTuple{(:w, :h, :dy, :leftw, :textw, :rightw, :xoffset, :yoffset, :width_factor), NTuple{9, Float64}}})
|
||||
Base.precompile(Tuple{typeof(gr_update_viewport_legend!),Vector{Float64},Subplot{GRBackend},NamedTuple{(:w, :h, :dy, :leftw, :textw, :rightw, :xoffset, :yoffset, :width_factor), Tuple{Int64, Int64, Int64, Float64, Int64, Float64, Float64, Float64, Float64}}})
|
||||
Base.precompile(Tuple{typeof(gr_viewport_from_bbox),Subplot{GRBackend},BoundingBox{Tuple{AbsoluteLength, AbsoluteLength}, Tuple{AbsoluteLength, AbsoluteLength}},AbsoluteLength,AbsoluteLength,Vector{Float64}})
|
||||
@@ -321,6 +305,8 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(heatmap_edges),Vector{Float64},Symbol,Vector{Float64},Symbol,Tuple{Int64, Int64},Bool})
|
||||
Base.precompile(Tuple{typeof(heatmap_edges),Vector{Float64},Symbol})
|
||||
Base.precompile(Tuple{typeof(ignorenan_minimum),Vector{Int64}})
|
||||
Base.precompile(Tuple{typeof(layout_args),NamedTuple{(:label, :blank), Tuple{Symbol, Bool}}})
|
||||
Base.precompile(Tuple{typeof(layout_args),NamedTuple{(:label, :width, :height), Tuple{Symbol, Symbol, Float64}}})
|
||||
Base.precompile(Tuple{typeof(make_fillrange_side),UnitRange{Int64},LinRange{Float64}})
|
||||
Base.precompile(Tuple{typeof(optimal_ticks_and_labels),Nothing,Tuple{Float64, Float64},Symbol,Function})
|
||||
Base.precompile(Tuple{typeof(optimal_ticks_and_labels),Nothing,Tuple{Float64, Float64},Symbol,Symbol})
|
||||
@@ -330,19 +316,16 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(optimal_ticks_and_labels),UnitRange{Int64},Tuple{Float64, Float64},Symbol,Symbol})
|
||||
Base.precompile(Tuple{typeof(partialcircle),Int64,Float64,Int64})
|
||||
Base.precompile(Tuple{typeof(plot),Any,Any})
|
||||
Base.precompile(Tuple{typeof(plot),Any})
|
||||
Base.precompile(Tuple{typeof(plot),Plot{GRBackend},Plot{GRBackend},Plot{GRBackend},Vararg{Plot{GRBackend}, N} where N})
|
||||
Base.precompile(Tuple{typeof(plot),Plot{GRBackend},Plot{GRBackend}})
|
||||
Base.precompile(Tuple{typeof(plot),Plot{PlotlyBackend},Plot{PlotlyBackend},Plot{PlotlyBackend},Vararg{Plot{PlotlyBackend}, N} where N})
|
||||
Base.precompile(Tuple{typeof(plot),Plot{PlotlyBackend},Plot{PlotlyBackend}})
|
||||
Base.precompile(Tuple{typeof(processGridArg!),Dict{Symbol, Any},Float64,Symbol})
|
||||
Base.precompile(Tuple{typeof(processGridArg!),Dict{Symbol, Any},Symbol,Symbol})
|
||||
Base.precompile(Tuple{typeof(processLineArg),Dict{Symbol, Any},Matrix{Symbol}})
|
||||
Base.precompile(Tuple{typeof(processLineArg),Dict{Symbol, Any},Symbol})
|
||||
Base.precompile(Tuple{typeof(processMarkerArg),Dict{Symbol, Any},Matrix{Symbol}})
|
||||
Base.precompile(Tuple{typeof(processMarkerArg),Dict{Symbol, Any},RGBA{Float64}})
|
||||
Base.precompile(Tuple{typeof(processMarkerArg),Dict{Symbol, Any},Shape{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(processMarkerArg),Dict{Symbol, Any},Stroke})
|
||||
Base.precompile(Tuple{typeof(processMarkerArg),Dict{Symbol, Any},Symbol})
|
||||
Base.precompile(Tuple{typeof(process_annotation),Subplot{GRBackend},Int64,Float64,PlotText})
|
||||
Base.precompile(Tuple{typeof(process_annotation),Subplot{GRBackend},Int64,Float64,Tuple{String, Int64, Symbol, Symbol}})
|
||||
@@ -356,14 +339,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(resetfontsizes)})
|
||||
Base.precompile(Tuple{typeof(scalefontsizes),Float64})
|
||||
Base.precompile(Tuple{typeof(series_annotations),Vector{Any}})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Base.ReshapedArray{Int64, 2, UnitRange{Int64}, Tuple{}},Int64})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Matrix{AbsoluteLength},Int64})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Matrix{Bool},Int64})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Matrix{Int64},Int64})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Matrix{PlotUtils.ContinuousColorGradient},Int64})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Matrix{RGBA{Float64}},Int64})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Matrix{String},Int64})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Matrix{Symbol},Int64})
|
||||
Base.precompile(Tuple{typeof(spy),Any})
|
||||
Base.precompile(Tuple{typeof(straightline_data),Tuple{Float64, Float64},Tuple{Float64, Float64},Vector{Float64},Vector{Float64},Int64})
|
||||
Base.precompile(Tuple{typeof(stroke),Int64,Vararg{Any, N} where N})
|
||||
@@ -374,10 +349,12 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Int64, Int64}}})
|
||||
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Vector{Float64}, Vector{Float64}}}})
|
||||
Base.precompile(Tuple{typeof(vline!),Any})
|
||||
Base.precompile(Tuple{typeof(warn_on_attr_dim_mismatch),Series,Vector{Float64},Vector{Float64},Nothing,Base.Iterators.Flatten{Vector{Tuple{SeriesSegment}}}})
|
||||
Base.precompile(Tuple{typeof(xgrid!),Plot{GRBackend},Symbol,Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(xlims),Subplot{PlotlyBackend}})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#120")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#120")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64}},Float64,Bool})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#121")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#121")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64, Float64}},Float64,Bool})
|
||||
isdefined(Plots, Symbol("#4#8")) && Base.precompile(Tuple{getfield(Plots, Symbol("#4#8")),UnitRange{Int64}})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#122")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#122")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64}},Float64,Bool})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#123")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#123")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64, Float64}},Float64,Bool})
|
||||
let fbody = try __lookup_kwbody__(which(font, (Font,Vararg{Any, N} where N,))) catch missing end
|
||||
if !ismissing(fbody)
|
||||
precompile(fbody, (Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}},typeof(font),Font,Vararg{Any, N} where N,))
|
||||
|
||||
+6
-3
@@ -25,13 +25,14 @@ using SparseArrays
|
||||
using FFMPEG
|
||||
|
||||
@reexport using RecipesBase
|
||||
import RecipesBase: plot, plot!, animate, is_explicit
|
||||
import RecipesBase: plot, plot!, animate, is_explicit, grid
|
||||
using Base.Meta
|
||||
@reexport using PlotUtils
|
||||
@reexport using PlotThemes
|
||||
import Showoff
|
||||
import UnicodeFun
|
||||
import StatsBase
|
||||
import Downloads
|
||||
import Showoff
|
||||
import JSON
|
||||
|
||||
using Requires
|
||||
@@ -41,7 +42,6 @@ export
|
||||
grid,
|
||||
bbox,
|
||||
plotarea,
|
||||
@layout,
|
||||
KW,
|
||||
|
||||
wrap,
|
||||
@@ -166,6 +166,8 @@ const BBox = Measures.Absolute2DBox
|
||||
const px = AbsoluteLength(0.254)
|
||||
const pct = Length{:pct,Float64}(1.0)
|
||||
|
||||
Base.convert(::Type{<:Measure}, x::Float64) = x * pct
|
||||
|
||||
Base.:*(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * m2.value)
|
||||
Base.:*(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * m1.value)
|
||||
Base.:/(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value / m2.value)
|
||||
@@ -209,6 +211,7 @@ include("colorbars.jl")
|
||||
include("axes.jl")
|
||||
include("args.jl")
|
||||
include("components.jl")
|
||||
include("consts.jl")
|
||||
include("themes.jl")
|
||||
include("plot.jl")
|
||||
include("pipeline.jl")
|
||||
|
||||
+58
-56
@@ -77,64 +77,66 @@ const _arg_desc = KW(
|
||||
:warn_on_unsupported => "Bool. Warn on unsupported attributes, series types and marker shapes",
|
||||
|
||||
# subplot args
|
||||
:title => "String. Subplot title.",
|
||||
:titlelocation => "Symbol. Position of subplot title. Values: `:left`, `:center`, `:right`",
|
||||
:titlefontfamily => "String or Symbol. Font family of subplot title.",
|
||||
:titlefontsize => "Integer. Font pointsize of subplot title.",
|
||||
:titlefonthalign => "Symbol. Font horizontal alignment of subplot title: :hcenter, :left, :right or :center",
|
||||
:titlefontvalign => "Symbol. Font vertical alignment of subplot title: :vcenter, :top, :bottom or :center",
|
||||
:titlefontrotation => "Real. Font rotation of subplot title",
|
||||
:titlefontcolor => "Color Type. Font color of subplot title",
|
||||
:title => "String. Subplot title.",
|
||||
:titlelocation => "Symbol. Position of subplot title. Values: `:left`, `:center`, `:right`",
|
||||
:titlefontfamily => "String or Symbol. Font family of subplot title.",
|
||||
:titlefontsize => "Integer. Font pointsize of subplot title.",
|
||||
:titlefonthalign => "Symbol. Font horizontal alignment of subplot title: :hcenter, :left, :right or :center",
|
||||
:titlefontvalign => "Symbol. Font vertical alignment of subplot title: :vcenter, :top, :bottom or :center",
|
||||
:titlefontrotation => "Real. Font rotation of subplot title",
|
||||
:titlefontcolor => "Color Type. Font color of subplot title",
|
||||
:background_color_subplot => "Color Type or `:match` (matches `:background_color`). Base background color of the subplot.",
|
||||
:background_color_legend => "Color Type or `:match` (matches `:background_color_subplot`). Background color of the legend.",
|
||||
:background_color_inside => "Color Type or `:match` (matches `:background_color_subplot`). Background color inside the plot area (under the grid).",
|
||||
:legend_background_color => "Color Type or `:match` (matches `:background_color_subplot`). Background color of the legend.",
|
||||
:background_color_inside => "Color Type or `:match` (matches `:background_color_subplot`). Background color inside the plot area (under the grid).",
|
||||
:foreground_color_subplot => "Color Type or `:match` (matches `:foreground_color`). Base foreground color of the subplot.",
|
||||
:foreground_color_legend => "Color Type or `:match` (matches `:foreground_color_subplot`). Foreground color of the legend.",
|
||||
:foreground_color_title => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of subplot title.",
|
||||
:color_palette => "Vector of colors (cycle through) or color gradient (generate list from gradient) or `:auto` (generate a color list using `Colors.distiguishable_colors` and custom seed colors chosen to contrast with the background). The color palette is a color list from which series colors are automatically chosen.",
|
||||
:legend => "Bool (show the legend?) or (x,y) tuple or Symbol (legend position) or angle or (angle,inout) tuple. Bottom left corner of legend is placed at (x,y). Symbol values: `:none`; `:best`; `:inline`; `:inside`; `:legend`; any valid combination of `:(outer ?)(top/bottom ?)(right/left ?)`, i.e.: `:top`, `:topright`, `:outerleft`, `:outerbottomright` ... (note: only some may be supported in each backend). Legend is positioned at (angle degrees) (so (90,:outer) is roughly equivalent to :outertop), close to the inside of the axes or the outside if inout=:outer.",
|
||||
:legendfontfamily => "String or Symbol. Font family of legend entries.",
|
||||
:legendfontsize => "Integer. Font pointsize of legend entries.",
|
||||
:legendfonthalign => "Symbol. Font horizontal alignment of legend entries: :hcenter, :left, :right or :center",
|
||||
:legendfontvalign => "Symbol. Font vertical alignment of legend entries: :vcenter, :top, :bottom or :center",
|
||||
:legendfontrotation => "Real. Font rotation of legend entries",
|
||||
:legendfontcolor => "Color Type. Font color of legend entries",
|
||||
:legendtitle => "String. Legend title.",
|
||||
:legendtitlefontfamily => "String or Symbol. Font family of the legend title.",
|
||||
:legendtitlefontsize => "Integer. Font pointsize the legend title.",
|
||||
:legendtitlefonthalign => "Symbol. Font horizontal alignment of the legend title: :hcenter, :left, :right or :center",
|
||||
:legendtitlefontvalign => "Symbol. Font vertical alignment of the legend title: :vcenter, :top, :bottom or :center",
|
||||
:legendtitlefontrotation => "Real. Font rotation of the legend title",
|
||||
:legendtitlefontcolor => "Color Type. Font color of the legend title",
|
||||
:colorbar => "Bool (show the colorbar?) or Symbol (colorbar position). Symbol values: `:none`, `:best`, `:right`, `:left`, `:top`, `:bottom`, `:legend` (matches legend value) (note: only some may be supported in each backend)",
|
||||
:clims => "`:auto`, NTuple{2,Number}, or a function that takes series data in and returns NTuple{2,Number}. Fixes the limits of the colorbar.",
|
||||
:colorbar_fontfamily => "String or Symbol. Font family of colobar entries.",
|
||||
:colorbar_ticks => "Vector of numbers (set the tick values), Tuple of (tickvalues, ticklabels), or `:auto`",
|
||||
:colorbar_tickfontfamily => "String or Symbol. Font family of colorbar tick labels.",
|
||||
:colorbar_tickfontsize => "Integer. Font pointsize of colorbar tick entries.",
|
||||
:colorbar_tickfontcolor => "Color Type. Font color of colorbar tick entries",
|
||||
:colorbar_scale => "Symbol. Scale of the colorbar axis: `:none`, `:ln`, `:log2`, `:log10`",
|
||||
:colorbar_formatter => "Function, :scientific, :plain or :auto. A method which converts a number to a string for tick labeling.",
|
||||
:legendfont => "Font. Font of legend items.",
|
||||
:legendtitlefont => "Font. Font of the legend title.",
|
||||
:annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String, PlotText (created with `text(args...)`), or a tuple of arguments to `text` (e.g., `(\"Label\", 8, :red, :top)`). Add one-off text annotations at the x,y coordinates.",
|
||||
:annotationfontfamily => "String or Symbol. Font family of annotations.",
|
||||
:annotationfontsize => "Integer. Font pointsize of annotations.",
|
||||
:annotationhalign => "Symbol. horizontal alignment of annotations, :hcenter, :left, :right or :center.",
|
||||
:annotationvalign => "Symbol. Vertical alignment of annotations, :vcenter, :top, :bottom or :center.",
|
||||
:annotationrotation => "Float. Rotation of annotations in degrees.",
|
||||
:annotationcolor => "Colorant or :match. Color of annotations.",
|
||||
:projection => "Symbol or String. '3d' or 'polar'",
|
||||
:aspect_ratio => "Symbol (:equal or :none) or Number. Plot area is resized so that 1 y-unit is the same size as `aspect_ratio` x-units. With `:none`, images inherit aspect ratio of the plot area.",
|
||||
:margin => "Measure (multiply by `mm`, `px`, etc). Base for individual margins... not directly used. Specifies the extra padding around subplots.",
|
||||
:left_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding to the left of the subplot.",
|
||||
:top_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the top of the subplot.",
|
||||
:right_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding to the right of the subplot.",
|
||||
:bottom_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the bottom of the subplot.",
|
||||
:subplot_index => "Integer. Internal (not set by user). Specifies the index of this subplot in the Plot's `plt.subplot` list.",
|
||||
:colorbar_title => "String. Title of colorbar.",
|
||||
:framestyle => "Symbol. Style of the axes frame. Choose from $(_allFramestyles)",
|
||||
:camera => "NTuple{2, Real}. Sets the view angle (azimuthal, elevation) for 3D plots",
|
||||
:legend_foreground_color => "Color Type or `:match` (matches `:foreground_color_subplot`). Foreground color of the legend.",
|
||||
:foreground_color_title => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of subplot title.",
|
||||
:color_palette => "Vector of colors (cycle through) or color gradient (generate list from gradient) or `:auto` (generate a color list using `Colors.distiguishable_colors` and custom seed colors chosen to contrast with the background). The color palette is a color list from which series colors are automatically chosen.",
|
||||
:legend_position => "Bool (show the legend?) or (x,y) tuple or Symbol (legend position) or angle or (angle,inout) tuple. Bottom left corner of legend is placed at (x,y). Symbol values: `:none`; `:best`; `:inline`; `:inside`; `:legend`; any valid combination of `:(outer ?)(top/bottom ?)(right/left ?)`, i.e.: `:top`, `:topright`, `:outerleft`, `:outerbottomright` ... (note: only some may be supported in each backend)",
|
||||
:legend_column => "Integer. Number of columns in the legend. `-1` stands for maximum number of colums (horizontal legend).",
|
||||
:legend_title_font => "Font. Font of the legend title.",
|
||||
:legend_font_family => "String or Symbol. Font family of legend entries.",
|
||||
:legend_font_pointsize => "Integer. Font pointsize of legend entries.",
|
||||
:legend_font_halign => "Symbol. Font horizontal alignment of legend entries: :hcenter, :left, :right or :center",
|
||||
:legend_font_valign => "Symbol. Font vertical alignment of legend entries: :vcenter, :top, :bottom or :center",
|
||||
:legend_font_rotation => "Real. Font rotation of legend entries",
|
||||
:legend_font_color => "Color Type. Font color of legend entries",
|
||||
:legend_title => "String. Legend title.",
|
||||
:legend_title_font_family => "String or Symbol. Font family of the legend title.",
|
||||
:legend_title_font_pointsize => "Integer. Font pointsize the legend title.",
|
||||
:legend_title_font_halign => "Symbol. Font horizontal alignment of the legend title: :hcenter, :left, :right or :center",
|
||||
:legend_title_font_valign => "Symbol. Font vertical alignment of the legend title: :vcenter, :top, :bottom or :center",
|
||||
:legend_title_font_rotation => "Real. Font rotation of the legend title",
|
||||
:legend_title_font_color => "Color Type. Font color of the legend title",
|
||||
:colorbar => "Bool (show the colorbar?) or Symbol (colorbar position). Symbol values: `:none`, `:best`, `:right`, `:left`, `:top`, `:bottom`, `:legend` (matches legend value) (note: only some may be supported in each backend)",
|
||||
:clims => "`:auto`, NTuple{2,Number}, or a function that takes series data in and returns NTuple{2,Number}. Fixes the limits of the colorbar.",
|
||||
:colorbar_fontfamily => "String or Symbol. Font family of colobar entries.",
|
||||
:colorbar_ticks => "Vector of numbers (set the tick values), Tuple of (tickvalues, ticklabels), or `:auto`",
|
||||
:colorbar_tickfontfamily => "String or Symbol. Font family of colorbar tick labels.",
|
||||
:colorbar_tickfontsize => "Integer. Font pointsize of colorbar tick entries.",
|
||||
:colorbar_tickfontcolor => "Color Type. Font color of colorbar tick entries",
|
||||
:colorbar_scale => "Symbol. Scale of the colorbar axis: `:none`, `:ln`, `:log2`, `:log10`",
|
||||
:colorbar_formatter => "Function, :scientific, :plain or :auto. A method which converts a number to a string for tick labeling.",
|
||||
:legend_font => "Font. Font of legend items.",
|
||||
:legend_titlefont => "Font. Font of the legend title.",
|
||||
:annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String, PlotText (created with `text(args...)`), or a tuple of arguments to `text` (e.g., `(\"Label\", 8, :red, :top)`). Add one-off text annotations at the x,y coordinates.",
|
||||
:annotationfontfamily => "String or Symbol. Font family of annotations.",
|
||||
:annotationfontsize => "Integer. Font pointsize of annotations.",
|
||||
:annotationhalign => "Symbol. horizontal alignment of annotations, :hcenter, :left, :right or :center.",
|
||||
:annotationvalign => "Symbol. Vertical alignment of annotations, :vcenter, :top, :bottom or :center.",
|
||||
:annotationrotation => "Float. Rotation of annotations in degrees.",
|
||||
:annotationcolor => "Colorant or :match. Color of annotations.",
|
||||
:projection => "Symbol or String. '3d' or 'polar'",
|
||||
:aspect_ratio => "Symbol (:equal or :none) or Number. Plot area is resized so that 1 y-unit is the same size as `aspect_ratio` x-units. With `:none`, images inherit aspect ratio of the plot area.",
|
||||
:margin => "Measure (multiply by `mm`, `px`, etc). Base for individual margins... not directly used. Specifies the extra padding around subplots.",
|
||||
:left_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding to the left of the subplot.",
|
||||
:top_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the top of the subplot.",
|
||||
:right_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding to the right of the subplot.",
|
||||
:bottom_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the bottom of the subplot.",
|
||||
:subplot_index => "Integer. Internal (not set by user). Specifies the index of this subplot in the Plot's `plt.subplot` list.",
|
||||
:colorbar_title => "String. Title of colorbar.",
|
||||
:framestyle => "Symbol. Style of the axes frame. Choose from $(_allFramestyles)",
|
||||
:camera => "NTuple{2, Real}. Sets the view angle (azimuthal, elevation) for 3D plots",
|
||||
|
||||
# axis args
|
||||
:guide => "String. Axis guide (label).",
|
||||
|
||||
+206
-150
@@ -89,6 +89,8 @@ const _allTypes = vcat(
|
||||
_3dTypes,
|
||||
)
|
||||
|
||||
const _z_colored_series = [:contour, :contour3d, :heatmap, :histogram2d, :surface, :hexbin]
|
||||
|
||||
const _typeAliases = Dict{Symbol,Symbol}(
|
||||
:n => :none,
|
||||
:no => :none,
|
||||
@@ -445,14 +447,10 @@ const _subplot_defaults = KW(
|
||||
:titlefontrotation => 0.0,
|
||||
:titlefontcolor => :match,
|
||||
:background_color_subplot => :match, # default for other bg colors... match takes plot default
|
||||
:background_color_legend => :match, # background of legend
|
||||
:background_color_inside => :match, # background inside grid
|
||||
:foreground_color_subplot => :match, # default for other fg colors... match takes plot default
|
||||
:foreground_color_legend => :match, # foreground of legend
|
||||
:foreground_color_title => :match, # title color
|
||||
:color_palette => :auto,
|
||||
:legend => :best,
|
||||
:legendtitle => nothing,
|
||||
:colorbar => :legend,
|
||||
:clims => :auto,
|
||||
:colorbar_fontfamily => :match,
|
||||
@@ -467,18 +465,6 @@ const _subplot_defaults = KW(
|
||||
:colorbar_formatter => :auto,
|
||||
:colorbar_discrete_values => [],
|
||||
:colorbar_continuous_values => zeros(0),
|
||||
:legendfontfamily => :match,
|
||||
:legendfontsize => 8,
|
||||
:legendfonthalign => :hcenter,
|
||||
:legendfontvalign => :vcenter,
|
||||
:legendfontrotation => 0.0,
|
||||
:legendfontcolor => :match,
|
||||
:legendtitlefontfamily => :match,
|
||||
:legendtitlefontsize => 11,
|
||||
:legendtitlefonthalign => :hcenter,
|
||||
:legendtitlefontvalign => :vcenter,
|
||||
:legendtitlefontrotation => 0.0,
|
||||
:legendtitlefontcolor => :match,
|
||||
:annotations => [], # annotation tuples... list of (x,y,annotation)
|
||||
:annotationfontfamily => :match,
|
||||
:annotationfontsize => 14,
|
||||
@@ -497,6 +483,7 @@ const _subplot_defaults = KW(
|
||||
:colorbar_title => "",
|
||||
:colorbar_titlefontsize => 10,
|
||||
:colorbar_title_location => :center, # also :left or :right
|
||||
:colorbar_fontfamily => :match,
|
||||
:colorbar_titlefontfamily => :match,
|
||||
:colorbar_titlefonthalign => :hcenter,
|
||||
:colorbar_titlefontvalign => :vcenter,
|
||||
@@ -566,80 +553,6 @@ const _suppress_warnings = Set{Symbol}([
|
||||
:relative_bbox,
|
||||
])
|
||||
|
||||
# add defaults for the letter versions
|
||||
const _axis_defaults_byletter = KW()
|
||||
|
||||
function reset_axis_defaults_byletter!()
|
||||
for letter in (:x, :y, :z)
|
||||
_axis_defaults_byletter[letter] = KW()
|
||||
for (k, v) in _axis_defaults
|
||||
_axis_defaults_byletter[letter][k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
reset_axis_defaults_byletter!()
|
||||
|
||||
const _all_defaults = KW[_series_defaults, _plot_defaults, _subplot_defaults]
|
||||
|
||||
const _initial_defaults = deepcopy(_all_defaults)
|
||||
const _initial_axis_defaults = deepcopy(_axis_defaults)
|
||||
|
||||
# to be able to reset font sizes to initial values
|
||||
const _initial_plt_fontsizes =
|
||||
Dict(:plot_titlefontsize => _plot_defaults[:plot_titlefontsize])
|
||||
|
||||
const _initial_sp_fontsizes = Dict(
|
||||
:titlefontsize => _subplot_defaults[:titlefontsize],
|
||||
:legendfontsize => _subplot_defaults[:legendfontsize],
|
||||
:legendtitlefontsize => _subplot_defaults[:legendtitlefontsize],
|
||||
:annotationfontsize => _subplot_defaults[:annotationfontsize],
|
||||
:colorbar_tickfontsize => _subplot_defaults[:colorbar_tickfontsize],
|
||||
:colorbar_titlefontsize => _subplot_defaults[:colorbar_titlefontsize],
|
||||
)
|
||||
|
||||
const _initial_ax_fontsizes = Dict(
|
||||
:tickfontsize => _axis_defaults[:tickfontsize],
|
||||
:guidefontsize => _axis_defaults[:guidefontsize],
|
||||
)
|
||||
|
||||
const _initial_fontsizes =
|
||||
merge(_initial_plt_fontsizes, _initial_sp_fontsizes, _initial_ax_fontsizes)
|
||||
|
||||
const _internal_args =
|
||||
[:plot_object, :series_plotindex, :markershape_to_add, :letter, :idxfilter]
|
||||
|
||||
const _axis_args = sort(union(collect(keys(_axis_defaults))))
|
||||
const _series_args = sort(union(collect(keys(_series_defaults))))
|
||||
const _subplot_args = sort(union(collect(keys(_subplot_defaults))))
|
||||
const _plot_args = sort(union(collect(keys(_plot_defaults))))
|
||||
|
||||
const _magic_axis_args = [:axis, :tickfont, :guidefont, :grid, :minorgrid]
|
||||
const _magic_subplot_args =
|
||||
[:titlefont, :legendfont, :legendtitlefont, :plot_titlefont, :colorbar_titlefont]
|
||||
const _magic_series_args = [:line, :marker, :fill]
|
||||
|
||||
const _all_axis_args = sort(union([_axis_args; _magic_axis_args]))
|
||||
const _all_subplot_args = sort(union([_subplot_args; _magic_subplot_args]))
|
||||
const _all_series_args = sort(union([_series_args; _magic_series_args]))
|
||||
const _all_plot_args = _plot_args
|
||||
|
||||
for letter in (:x, :y, :z)
|
||||
_attrsymbolcache[letter] = Dict{Symbol,Symbol}()
|
||||
for k in keys(_axis_defaults)
|
||||
# populate attribute cache
|
||||
lk = Symbol(letter, k)
|
||||
_attrsymbolcache[letter][k] = lk
|
||||
# allow the underscore version too: xguide or x_guide
|
||||
add_aliases(lk, Symbol(letter, "_", k))
|
||||
end
|
||||
for k in (_magic_axis_args..., :(_discrete_indices))
|
||||
_attrsymbolcache[letter][k] = Symbol(letter, k)
|
||||
end
|
||||
end
|
||||
|
||||
const _all_args =
|
||||
sort(union([_all_axis_args; _all_subplot_args; _all_series_args; _all_plot_args]))
|
||||
|
||||
is_subplot_attr(k) = k in _all_subplot_args
|
||||
is_series_attr(k) = k in _all_series_args
|
||||
is_axis_attr(k) = Symbol(chop(string(k); head = 1, tail = 0)) in _all_axis_args
|
||||
@@ -671,9 +584,46 @@ aliases(aliasMap::Dict{Symbol,Symbol}, val) =
|
||||
sortedkeys(filter((k, v) -> v == val, aliasMap))
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# legend
|
||||
add_aliases(:legend_position, :legend, :leg, :key, :legends)
|
||||
add_aliases(
|
||||
:legend_background_color,
|
||||
:bg_legend,
|
||||
:bglegend,
|
||||
:bgcolor_legend,
|
||||
:bg_color_legend,
|
||||
:background_legend,
|
||||
:background_colour_legend,
|
||||
:bgcolour_legend,
|
||||
:bg_colour_legend,
|
||||
:background_color_legend,
|
||||
)
|
||||
add_aliases(
|
||||
:legend_foreground_color,
|
||||
:fg_legend,
|
||||
:fglegend,
|
||||
:fgcolor_legend,
|
||||
:fg_color_legend,
|
||||
:foreground_legend,
|
||||
:foreground_colour_legend,
|
||||
:fgcolour_legend,
|
||||
:fg_colour_legend,
|
||||
:foreground_color_legend,
|
||||
)
|
||||
add_aliases(:legend_font_pointsize, :legendfontsize)
|
||||
add_aliases(
|
||||
:legend_title,
|
||||
:key_title,
|
||||
:keytitle,
|
||||
:label_title,
|
||||
:labeltitle,
|
||||
:leg_title,
|
||||
:legtitle,
|
||||
)
|
||||
add_aliases(:legend_title_font_pointsize, :legendtitlefontsize)
|
||||
# margin
|
||||
add_aliases(:left_margin, :leftmargin)
|
||||
|
||||
add_aliases(:top_margin, :topmargin)
|
||||
add_aliases(:bottom_margin, :bottommargin)
|
||||
add_aliases(:right_margin, :rightmargin)
|
||||
@@ -696,17 +646,6 @@ add_aliases(
|
||||
:bgcolour,
|
||||
:bg_colour,
|
||||
)
|
||||
add_aliases(
|
||||
:background_color_legend,
|
||||
:bg_legend,
|
||||
:bglegend,
|
||||
:bgcolor_legend,
|
||||
:bg_color_legend,
|
||||
:background_legend,
|
||||
:background_colour_legend,
|
||||
:bgcolour_legend,
|
||||
:bg_colour_legend,
|
||||
)
|
||||
add_aliases(
|
||||
:background_color_subplot,
|
||||
:bg_subplot,
|
||||
@@ -750,17 +689,7 @@ add_aliases(
|
||||
:fgcolour,
|
||||
:fg_colour,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_legend,
|
||||
:fg_legend,
|
||||
:fglegend,
|
||||
:fgcolor_legend,
|
||||
:fg_color_legend,
|
||||
:foreground_legend,
|
||||
:foreground_colour_legend,
|
||||
:fgcolour_legend,
|
||||
:fg_colour_legend,
|
||||
)
|
||||
|
||||
add_aliases(
|
||||
:foreground_color_subplot,
|
||||
:fg_subplot,
|
||||
@@ -772,6 +701,90 @@ add_aliases(
|
||||
:fgcolour_subplot,
|
||||
:fg_colour_subplot,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_grid,
|
||||
:fg_grid,
|
||||
:fggrid,
|
||||
:fgcolor_grid,
|
||||
:fg_color_grid,
|
||||
:foreground_grid,
|
||||
:foreground_colour_grid,
|
||||
:fgcolour_grid,
|
||||
:fg_colour_grid,
|
||||
:gridcolor,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_minor_grid,
|
||||
:fg_minor_grid,
|
||||
:fgminorgrid,
|
||||
:fgcolor_minorgrid,
|
||||
:fg_color_minorgrid,
|
||||
:foreground_minorgrid,
|
||||
:foreground_colour_minor_grid,
|
||||
:fgcolour_minorgrid,
|
||||
:fg_colour_minor_grid,
|
||||
:minorgridcolor,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_title,
|
||||
:fg_title,
|
||||
:fgtitle,
|
||||
:fgcolor_title,
|
||||
:fg_color_title,
|
||||
:foreground_title,
|
||||
:foreground_colour_title,
|
||||
:fgcolour_title,
|
||||
:fg_colour_title,
|
||||
:titlecolor,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_axis,
|
||||
:fg_axis,
|
||||
:fgaxis,
|
||||
:fgcolor_axis,
|
||||
:fg_color_axis,
|
||||
:foreground_axis,
|
||||
:foreground_colour_axis,
|
||||
:fgcolour_axis,
|
||||
:fg_colour_axis,
|
||||
:axiscolor,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_border,
|
||||
:fg_border,
|
||||
:fgborder,
|
||||
:fgcolor_border,
|
||||
:fg_color_border,
|
||||
:foreground_border,
|
||||
:foreground_colour_border,
|
||||
:fgcolour_border,
|
||||
:fg_colour_border,
|
||||
:bordercolor,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_text,
|
||||
:fg_text,
|
||||
:fgtext,
|
||||
:fgcolor_text,
|
||||
:fg_color_text,
|
||||
:foreground_text,
|
||||
:foreground_colour_text,
|
||||
:fgcolour_text,
|
||||
:fg_colour_text,
|
||||
:textcolor,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_guide,
|
||||
:fg_guide,
|
||||
:fgguide,
|
||||
:fgcolor_guide,
|
||||
:fg_color_guide,
|
||||
:foreground_guide,
|
||||
:foreground_colour_guide,
|
||||
:fgcolour_guide,
|
||||
:fg_colour_guide,
|
||||
:guidecolor,
|
||||
)
|
||||
|
||||
add_aliases(
|
||||
:foreground_color_title,
|
||||
@@ -932,7 +945,19 @@ add_aliases(:group, :g, :grouping)
|
||||
add_aliases(:bins, :bin, :nbin, :nbins, :nb)
|
||||
add_aliases(:ribbon, :rib)
|
||||
add_aliases(:annotations, :ann, :anns, :annotate, :annotation)
|
||||
|
||||
add_aliases(:xguide, :xlabel, :xlab, :xl)
|
||||
add_aliases(:xlims, :xlim, :xlimit, :xlimits, :xrange)
|
||||
add_aliases(:xticks, :xtick)
|
||||
add_aliases(:xrotation, :xrot, :xr)
|
||||
add_aliases(:yguide, :ylabel, :ylab, :yl)
|
||||
add_aliases(:ylims, :ylim, :ylimit, :ylimits, :yrange)
|
||||
add_aliases(:yticks, :ytick)
|
||||
add_aliases(:yrotation, :yrot, :yr)
|
||||
add_aliases(:zguide, :zlabel, :zlab, :zl)
|
||||
add_aliases(:zlims, :zlim, :zlimit, :zlimits)
|
||||
add_aliases(:zticks, :ztick)
|
||||
add_aliases(:zrotation, :zrot, :zr)
|
||||
add_aliases(:guidefontsize, :labelfontsize)
|
||||
add_aliases(
|
||||
:fill_z,
|
||||
:fillz,
|
||||
@@ -943,8 +968,6 @@ add_aliases(
|
||||
:surfcolor,
|
||||
:surfcolour,
|
||||
)
|
||||
add_aliases(:legend, :leg, :key)
|
||||
add_aliases(:legendtitle, :legend_title, :labeltitle, :label_title, :leg_title, :key_title)
|
||||
add_aliases(:colorbar, :cb, :cbar, :colorkey)
|
||||
add_aliases(
|
||||
:colorbar_title,
|
||||
@@ -1020,13 +1043,6 @@ add_aliases(:camera, :cam, :viewangle, :view_angle)
|
||||
add_aliases(:contour_labels, :contourlabels, :clabels, :clabs)
|
||||
add_aliases(:warn_on_unsupported, :warn)
|
||||
|
||||
# add all pluralized forms to the _keyAliases dict
|
||||
for arg in _all_args
|
||||
add_aliases(arg, makeplural(arg))
|
||||
end
|
||||
# add all non_underscored forms to the _keyAliases
|
||||
add_non_underscore_aliases!(_keyAliases)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
function parse_axis_kw(s::Symbol)
|
||||
@@ -1467,8 +1483,7 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
|
||||
end
|
||||
|
||||
# fonts
|
||||
for fontname in
|
||||
(:titlefont, :legendfont, :legendtitlefont, :plot_titlefont, :colorbar_titlefont)
|
||||
for fontname in (:titlefont, :legendtitlefont, :plot_titlefont, :colorbar_titlefont)
|
||||
args = RecipesPipeline.pop_kw!(plotattributes, fontname, ())
|
||||
for arg in wraptuple(args)
|
||||
processFontArg!(plotattributes, fontname, arg)
|
||||
@@ -1535,8 +1550,9 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
|
||||
# end
|
||||
|
||||
# legends
|
||||
if haskey(plotattributes, :legend)
|
||||
plotattributes[:legend] = convertLegendValue(plotattributes[:legend])
|
||||
if haskey(plotattributes, :legend_position)
|
||||
plotattributes[:legend_position] =
|
||||
convertLegendValue(plotattributes[:legend_position])
|
||||
end
|
||||
if haskey(plotattributes, :colorbar)
|
||||
plotattributes[:colorbar] = convertLegendValue(plotattributes[:colorbar])
|
||||
@@ -1667,15 +1683,18 @@ function convertLegendValue(val::Symbol)
|
||||
:inline,
|
||||
)
|
||||
val
|
||||
elseif val == :horizontal
|
||||
-1
|
||||
else
|
||||
error("Invalid symbol for legend: $val")
|
||||
end
|
||||
end
|
||||
convertLegendValue(val::Real) = val
|
||||
convertLegendValue(val::Bool) = val ? :best : :none
|
||||
convertLegendValue(val::Nothing) = :none
|
||||
convertLegendValue(v::Union{Tuple,NamedTuple}) = convertLegendValue.(v)
|
||||
convertLegendValue(v::Tuple{S,T}) where {S<:Real,T<:Real} = v
|
||||
convertLegendValue(v::Tuple{<:Real,Symbol}) = v
|
||||
convertLegendValue(v::Real) = v
|
||||
convertLegendValue(v::AbstractArray) = map(convertLegendValue, v)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -1724,7 +1743,10 @@ function slice_arg!(
|
||||
)
|
||||
v = get(plotattributes_in, k, plotattributes_out[k])
|
||||
plotattributes_out[k] =
|
||||
if haskey(plotattributes_in, k) && typeof(v) <: AMat && !isempty(v)
|
||||
if haskey(plotattributes_in, k) &&
|
||||
typeof(v) <: AMat &&
|
||||
!isempty(v) &&
|
||||
!(k in _plot_args)
|
||||
slice_arg(v, idx)
|
||||
else
|
||||
v
|
||||
@@ -1761,9 +1783,9 @@ end
|
||||
# when a value can be `:match`, this is the key that should be used instead for value retrieval
|
||||
const _match_map = KW(
|
||||
:background_color_outside => :background_color,
|
||||
:background_color_legend => :background_color_subplot,
|
||||
:legend_background_color => :background_color_subplot,
|
||||
:background_color_inside => :background_color_subplot,
|
||||
:foreground_color_legend => :foreground_color_subplot,
|
||||
:legend_foreground_color => :foreground_color_subplot,
|
||||
:foreground_color_title => :foreground_color_subplot,
|
||||
:left_margin => :margin,
|
||||
:top_margin => :margin,
|
||||
@@ -1771,10 +1793,10 @@ const _match_map = KW(
|
||||
:bottom_margin => :margin,
|
||||
:titlefontfamily => :fontfamily_subplot,
|
||||
:titlefontcolor => :foreground_color_subplot,
|
||||
:legendfontfamily => :fontfamily_subplot,
|
||||
:legendfontcolor => :foreground_color_subplot,
|
||||
:legendtitlefontfamily => :fontfamily_subplot,
|
||||
:legendtitlefontcolor => :foreground_color_subplot,
|
||||
:legend_font_family => :fontfamily_subplot,
|
||||
:legend_font_color => :foreground_color_subplot,
|
||||
:legend_title_font_family => :fontfamily_subplot,
|
||||
:legend_title_font_color => :foreground_color_subplot,
|
||||
:colorbar_fontfamily => :fontfamily_subplot,
|
||||
:colorbar_titlefontfamily => :fontfamily_subplot,
|
||||
:colorbar_titlefontcolor => :foreground_color_subplot,
|
||||
@@ -1905,10 +1927,10 @@ function _update_subplot_periphery(sp::Subplot, anns::AVec)
|
||||
sp.attr[:annotations] = newanns
|
||||
|
||||
# handle legend/colorbar
|
||||
sp.attr[:legend] = convertLegendValue(sp.attr[:legend])
|
||||
sp.attr[:legend_position] = convertLegendValue(sp.attr[:legend_position])
|
||||
sp.attr[:colorbar] = convertLegendValue(sp.attr[:colorbar])
|
||||
if sp.attr[:colorbar] == :legend
|
||||
sp.attr[:colorbar] = sp.attr[:legend]
|
||||
sp.attr[:colorbar] = sp.attr[:legend_position]
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -1917,16 +1939,35 @@ function _update_subplot_colors(sp::Subplot)
|
||||
# background colors
|
||||
color_or_nothing!(sp.attr, :background_color_subplot)
|
||||
sp.attr[:color_palette] = get_color_palette(sp.attr[:color_palette], 30)
|
||||
color_or_nothing!(sp.attr, :background_color_legend)
|
||||
color_or_nothing!(sp.attr, :legend_background_color)
|
||||
color_or_nothing!(sp.attr, :background_color_inside)
|
||||
|
||||
# foreground colors
|
||||
color_or_nothing!(sp.attr, :foreground_color_subplot)
|
||||
color_or_nothing!(sp.attr, :foreground_color_legend)
|
||||
color_or_nothing!(sp.attr, :legend_foreground_color)
|
||||
color_or_nothing!(sp.attr, :foreground_color_title)
|
||||
return
|
||||
end
|
||||
|
||||
function _update_subplot_legend(sp::Subplot, plotattributes_in)
|
||||
f_attr = NamedTuple(
|
||||
k => plotattributes_in[Symbol(:legend_font_, k)] for
|
||||
k in (:family, :pointsize, :valign, :halign, :rotation, :color) if
|
||||
haskey(plotattributes_in, Symbol(:legend_font_, k))
|
||||
)
|
||||
match_attr = NamedTuple(
|
||||
(
|
||||
lk = Symbol(:legend_font_, k);
|
||||
k =>
|
||||
haskey(_match_map, lk) ? sp[lk] :
|
||||
haskey(plotattributes_in, :legend_font) ?
|
||||
getproperty(plotattributes_in[:legend_font], k) :
|
||||
default(plotattributes_in, lk)
|
||||
) for k in (:family, :pointsize, :valign, :halign, :rotation, :color)
|
||||
)
|
||||
sp.attr[:legend_font] = font(; merge(match_attr, f_attr)...)
|
||||
end
|
||||
|
||||
function _update_axis(
|
||||
plt::Plot,
|
||||
sp::Subplot,
|
||||
@@ -2033,7 +2074,6 @@ function _update_subplot_args(
|
||||
lims_warned = true
|
||||
end
|
||||
end
|
||||
_update_subplot_colorbars(sp)
|
||||
end
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -2210,7 +2250,16 @@ end
|
||||
|
||||
#--------------------------------------------------
|
||||
## inspired by Base.@kwdef
|
||||
macro add_attributes(level, expr)
|
||||
"""
|
||||
add_attributes(level, expr, match_table)
|
||||
|
||||
Takes a `struct` definition and recurses into its fields to create keywords by chaining the field names with the structs' name with underscore.
|
||||
Also creates pluralized and non-underscore aliases for these keywords.
|
||||
- `level` indicates which group of `plot`, `subplot`, `series`, etc. the keywords belong to.
|
||||
- `expr` is the struct definition with default values like `Base.@kwdef`
|
||||
- `match_table` is an expression of the form `:match = (symbols)`, with symbols whose default value should be `:match`
|
||||
"""
|
||||
macro add_attributes(level, expr, match_table)
|
||||
expr = macroexpand(__module__, expr) # to expand @static
|
||||
expr isa Expr && expr.head === :struct || error("Invalid usage of @add_attributes")
|
||||
T = expr.args[2]
|
||||
@@ -2218,16 +2267,18 @@ macro add_attributes(level, expr)
|
||||
T = T.args[1]
|
||||
end
|
||||
|
||||
key_args = Any[]
|
||||
value_args = Any[]
|
||||
key_dict = KW()
|
||||
|
||||
_splitdef!(expr.args[3], value_args, key_args)
|
||||
_splitdef!(expr.args[3], key_dict)
|
||||
|
||||
insert_block = Expr(:block)
|
||||
for (key, value) in zip(key_args, value_args)
|
||||
for (key, value) in key_dict
|
||||
# e.g. _series_defualts[key] = value
|
||||
exp_key = Symbol(lowercase(string(T)), "_", key)
|
||||
pl_key = makeplural(exp_key)
|
||||
if QuoteNode(exp_key) in match_table.args[2].args
|
||||
value = QuoteNode(:match)
|
||||
end
|
||||
push!(
|
||||
insert_block.args,
|
||||
Expr(
|
||||
@@ -2261,7 +2312,7 @@ macro add_attributes(level, expr)
|
||||
end |> esc
|
||||
end
|
||||
|
||||
function _splitdef!(blk, value_args, key_args)
|
||||
function _splitdef!(blk, key_dict)
|
||||
for i in eachindex(blk.args)
|
||||
ei = blk.args[i]
|
||||
if ei isa Symbol
|
||||
@@ -2276,20 +2327,25 @@ function _splitdef!(blk, value_args, key_args)
|
||||
elseif lhs isa Expr && lhs.head === :(::) && lhs.args[1] isa Symbol
|
||||
# var::T = defexpr
|
||||
var = lhs.args[1]
|
||||
type = lhs.args[2]
|
||||
if @isdefined type
|
||||
for field in fieldnames(getproperty(Plots, type))
|
||||
key_dict[Symbol(var, "_", field)] =
|
||||
:(getfield($(ei.args[2]), $(QuoteNode(field))))
|
||||
end
|
||||
end
|
||||
else
|
||||
# something else, e.g. inline inner constructor
|
||||
# F(...) = ...
|
||||
continue
|
||||
end
|
||||
defexpr = ei.args[2] # defexpr
|
||||
push!(value_args, defexpr)
|
||||
push!(key_args, var)
|
||||
key_dict[var] = defexpr
|
||||
blk.args[i] = lhs
|
||||
elseif ei.head === :(::) && ei.args[1] isa Symbol
|
||||
# var::Typ
|
||||
var = ei.args[1]
|
||||
push!(value_args, var)
|
||||
push!(key_args, var)
|
||||
key_dict[var] = defexpr
|
||||
elseif ei.head === :block
|
||||
# can arise with use of @static inside type decl
|
||||
_kwdef!(ei, value_args, key_args)
|
||||
|
||||
+44
-48
@@ -310,10 +310,10 @@ _initialize_backend(pkg::GRBackend) = nothing
|
||||
|
||||
const _gr_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend,
|
||||
:legend_background_color,
|
||||
:background_color_inside,
|
||||
:background_color_outside,
|
||||
:foreground_color_legend,
|
||||
:legend_foreground_color,
|
||||
:foreground_color_grid,
|
||||
:foreground_color_axis,
|
||||
:foreground_color_text,
|
||||
@@ -350,12 +350,12 @@ const _gr_attr = merge_with_base_supported([
|
||||
:titlefontvalign,
|
||||
:titlefontrotation,
|
||||
:titlefontcolor,
|
||||
:legendfontfamily,
|
||||
:legendfontsize,
|
||||
:legendfonthalign,
|
||||
:legendfontvalign,
|
||||
:legendfontrotation,
|
||||
:legendfontcolor,
|
||||
:legend_font_family,
|
||||
:legend_font_pointsize,
|
||||
:legend_font_halign,
|
||||
:legend_font_valign,
|
||||
:legend_font_rotation,
|
||||
:legend_font_color,
|
||||
:tickfontfamily,
|
||||
:tickfontsize,
|
||||
:tickfonthalign,
|
||||
@@ -372,17 +372,13 @@ const _gr_attr = merge_with_base_supported([
|
||||
:gridalpha,
|
||||
:gridstyle,
|
||||
:gridlinewidth,
|
||||
:legend,
|
||||
:legendtitle,
|
||||
:legend_position,
|
||||
:legend_title,
|
||||
:colorbar,
|
||||
:colorbar_title,
|
||||
:colorbar_entry,
|
||||
:colorbar_titlefontfamily,
|
||||
:colorbar_titlefontsize,
|
||||
:colorbar_titlefontvalign,
|
||||
:colorbar_titlefonthalign,
|
||||
:colorbar_titlefontrotation,
|
||||
:colorbar_titlefontcolor,
|
||||
:colorbar_scale,
|
||||
:clims,
|
||||
:fill_z,
|
||||
:line_z,
|
||||
:marker_z,
|
||||
@@ -439,10 +435,10 @@ end
|
||||
|
||||
const _plotly_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend,
|
||||
:legend_background_color,
|
||||
:background_color_inside,
|
||||
:background_color_outside,
|
||||
:foreground_color_legend,
|
||||
:legend_foreground_color,
|
||||
:foreground_color_guide,
|
||||
:foreground_color_grid,
|
||||
:foreground_color_axis,
|
||||
@@ -475,9 +471,9 @@ const _plotly_attr = merge_with_base_supported([
|
||||
:titlefonthalign,
|
||||
:titlefontvalign,
|
||||
:titlefontcolor,
|
||||
:legendfontfamily,
|
||||
:legendfontsize,
|
||||
:legendfontcolor,
|
||||
:legend_font_family,
|
||||
:legend_font_pointsize,
|
||||
:legend_font_color,
|
||||
:tickfontfamily,
|
||||
:tickfontsize,
|
||||
:tickfontcolor,
|
||||
@@ -565,10 +561,10 @@ defaultOutputFormat(plt::Plot{Plots.PlotlyBackend}) = "html"
|
||||
|
||||
const _pgfplots_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend,
|
||||
:legend_background_color,
|
||||
:background_color_inside,
|
||||
# :background_color_outside,
|
||||
# :foreground_color_legend,
|
||||
# :legend_foreground_color,
|
||||
:foreground_color_grid,
|
||||
:foreground_color_axis,
|
||||
:foreground_color_text,
|
||||
@@ -688,11 +684,11 @@ end
|
||||
|
||||
const _pyplot_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend,
|
||||
:legend_background_color,
|
||||
:background_color_inside,
|
||||
:background_color_outside,
|
||||
:foreground_color_grid,
|
||||
:foreground_color_legend,
|
||||
:legend_foreground_color,
|
||||
:foreground_color_title,
|
||||
:foreground_color_axis,
|
||||
:foreground_color_border,
|
||||
@@ -731,9 +727,9 @@ const _pyplot_attr = merge_with_base_supported([
|
||||
:titlefontfamily,
|
||||
:titlefontsize,
|
||||
:titlefontcolor,
|
||||
:legendfontfamily,
|
||||
:legendfontsize,
|
||||
:legendfontcolor,
|
||||
:legend_font_family,
|
||||
:legend_font_pointsize,
|
||||
:legend_font_color,
|
||||
:tickfontfamily,
|
||||
:tickfontsize,
|
||||
:tickfontcolor,
|
||||
@@ -744,8 +740,8 @@ const _pyplot_attr = merge_with_base_supported([
|
||||
:gridalpha,
|
||||
:gridstyle,
|
||||
:gridlinewidth,
|
||||
:legend,
|
||||
:legendtitle,
|
||||
:legend_position,
|
||||
:legend_title,
|
||||
:colorbar,
|
||||
:colorbar_title,
|
||||
:colorbar_entry,
|
||||
@@ -981,11 +977,11 @@ const _canvas_type = Ref(:auto)
|
||||
|
||||
const _hdf5_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend,
|
||||
:legend_background_color,
|
||||
:background_color_inside,
|
||||
:background_color_outside,
|
||||
:foreground_color_grid,
|
||||
:foreground_color_legend,
|
||||
:legend_foreground_color,
|
||||
:foreground_color_title,
|
||||
:foreground_color_axis,
|
||||
:foreground_color_border,
|
||||
@@ -1083,11 +1079,11 @@ const HDF5PLOT_PLOTREF = HDF5Plot_PlotRef(nothing)
|
||||
|
||||
const _inspectdr_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend,
|
||||
:legend_background_color,
|
||||
:background_color_inside,
|
||||
:background_color_outside,
|
||||
# :foreground_color_grid,
|
||||
:foreground_color_legend,
|
||||
:legend_foreground_color,
|
||||
:foreground_color_title,
|
||||
:foreground_color_axis,
|
||||
:foreground_color_border,
|
||||
@@ -1120,9 +1116,9 @@ const _inspectdr_attr = merge_with_base_supported([
|
||||
:titlefontfamily,
|
||||
:titlefontsize,
|
||||
:titlefontcolor,
|
||||
:legendfontfamily,
|
||||
:legendfontsize,
|
||||
:legendfontcolor,
|
||||
:legend_font_family,
|
||||
:legend_font_pointsize,
|
||||
:legend_font_color,
|
||||
:tickfontfamily,
|
||||
:tickfontsize,
|
||||
:tickfontcolor,
|
||||
@@ -1130,7 +1126,7 @@ const _inspectdr_attr = merge_with_base_supported([
|
||||
:guidefontsize,
|
||||
:guidefontcolor,
|
||||
:grid,
|
||||
:legend, #:colorbar,
|
||||
:legend_position, #:colorbar,
|
||||
# :marker_z,
|
||||
# :line_z,
|
||||
# :levels,
|
||||
@@ -1186,10 +1182,10 @@ const _inspectdr_scale = [:identity, :ln, :log2, :log10]
|
||||
|
||||
const _pgfplotsx_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend,
|
||||
:legend_background_color,
|
||||
:background_color_inside,
|
||||
:background_color_outside,
|
||||
:foreground_color_legend,
|
||||
:legend_foreground_color,
|
||||
:foreground_color_grid,
|
||||
:foreground_color_axis,
|
||||
:foreground_color_text,
|
||||
@@ -1226,12 +1222,12 @@ const _pgfplotsx_attr = merge_with_base_supported([
|
||||
:titlefontvalign,
|
||||
:titlefontrotation,
|
||||
:titlefontcolor,
|
||||
:legendfontfamily,
|
||||
:legendfontsize,
|
||||
:legendfonthalign,
|
||||
:legendfontvalign,
|
||||
:legendfontrotation,
|
||||
:legendfontcolor,
|
||||
:legend_font_family,
|
||||
:legend_font_pointsize,
|
||||
:legend_font_halign,
|
||||
:legend_font_valign,
|
||||
:legend_font_rotation,
|
||||
:legend_font_color,
|
||||
:tickfontfamily,
|
||||
:tickfontsize,
|
||||
:tickfonthalign,
|
||||
@@ -1248,8 +1244,8 @@ const _pgfplotsx_attr = merge_with_base_supported([
|
||||
:gridalpha,
|
||||
:gridstyle,
|
||||
:gridlinewidth,
|
||||
:legend,
|
||||
:legendtitle,
|
||||
:legend_position,
|
||||
:legend_title,
|
||||
:colorbar,
|
||||
:colorbar_title,
|
||||
:colorbar_entry,
|
||||
|
||||
@@ -227,7 +227,7 @@ function pgf_series(sp::Subplot, series::Series)
|
||||
end
|
||||
|
||||
# add to legend?
|
||||
if i == 1 && sp[:legend] != :none && should_add_to_legend(series)
|
||||
if i == 1 && sp[:legend_position] != :none && should_add_to_legend(series)
|
||||
if plotattributes[:fillrange] !== nothing
|
||||
push!(style, "forget plot")
|
||||
push!(series_collection, pgf_fill_legend_hack(plotattributes, args))
|
||||
@@ -590,12 +590,12 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
|
||||
kw[:axisEqual] = "true"
|
||||
end
|
||||
|
||||
legpos = sp[:legend]
|
||||
legpos = sp[:legend_position]
|
||||
if haskey(_pgfplots_legend_pos, legpos)
|
||||
kw[:legendPos] = _pgfplots_legend_pos[legpos]
|
||||
end
|
||||
cstr, bg_alpha = pgf_color(plot_color(sp[:background_color_legend]))
|
||||
fg_alpha = alpha(plot_color(sp[:foreground_color_legend]))
|
||||
cstr, bg_alpha = pgf_color(plot_color(sp[:legend_background_color]))
|
||||
fg_alpha = alpha(plot_color(sp[:legend_foreground_color]))
|
||||
|
||||
push!(
|
||||
style,
|
||||
@@ -603,16 +603,16 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
|
||||
"legend style = {",
|
||||
pgf_linestyle(
|
||||
pgf_thickness_scaling(sp),
|
||||
sp[:foreground_color_legend],
|
||||
sp[:legend_foreground_color],
|
||||
fg_alpha,
|
||||
"solid",
|
||||
),
|
||||
",",
|
||||
"fill = $cstr,",
|
||||
"fill opacity = $bg_alpha,",
|
||||
"text opacity = $(alpha(plot_color(sp[:legendfontcolor]))),",
|
||||
"text opacity = $(alpha(plot_color(sp[:legend_font_color]))),",
|
||||
"font = ",
|
||||
pgf_font(sp[:legendfontsize], pgf_thickness_scaling(sp)),
|
||||
pgf_font(sp[:legend_font_pointsize], pgf_thickness_scaling(sp)),
|
||||
"}",
|
||||
),
|
||||
)
|
||||
|
||||
@@ -290,7 +290,7 @@ function gaston_seriesconf!(
|
||||
ps: pointscale
|
||||
pt: pointtype
|
||||
tc: textcolor
|
||||
w: with
|
||||
w: with
|
||||
=#
|
||||
gsp = sp.o
|
||||
st = series[:seriestype]
|
||||
@@ -307,7 +307,7 @@ function gaston_seriesconf!(
|
||||
fr = series[:fillrange]
|
||||
fc = gaston_color(get_fillcolor(series, i), get_fillalpha(series, i))
|
||||
lc, dt, lw = gaston_lc_ls_lw(series, clims, i)
|
||||
if fr !== nothing # filled curves, but not filled curves with markers
|
||||
if fr !== nothing # filled curves, but not filled curves with markers
|
||||
push!(
|
||||
curveconf,
|
||||
"w filledcurves fc $fc fs solid border lc $lc lw $lw dt $dt,'' w lines lc $lc lw $lw dt $dt",
|
||||
@@ -505,8 +505,8 @@ function gaston_set_ticks!(axesconf, ticks, letter, maj_min, add)
|
||||
end
|
||||
|
||||
function gaston_set_legend!(axesconf, sp, any_label)
|
||||
leg = sp[:legend]
|
||||
if sp[:legend] ∉ (:none, :inline) && any_label
|
||||
leg = sp[:legend_position]
|
||||
if sp[:legend_position] ∉ (:none, :inline) && any_label
|
||||
leg == :best && (leg = :topright)
|
||||
|
||||
push!(
|
||||
@@ -517,9 +517,9 @@ function gaston_set_legend!(axesconf, sp, any_label)
|
||||
occursin(position, string(leg)) && push!(axesconf, "set key $position")
|
||||
end
|
||||
push!(axesconf, "set key $(gaston_font(legendfont(sp), rot=false, align=false))")
|
||||
if sp[:legendtitle] !== nothing
|
||||
if sp[:legend_title] !== nothing
|
||||
# NOTE: cannot use legendtitlefont(sp) as it will override legendfont
|
||||
push!(axesconf, "set key title '$(sp[:legendtitle])'")
|
||||
push!(axesconf, "set key title '$(sp[:legend_title])'")
|
||||
end
|
||||
push!(axesconf, "set key box lw 1 opaque")
|
||||
push!(axesconf, "set border back")
|
||||
|
||||
+188
-71
@@ -104,6 +104,9 @@ function gr_color(c, ::Type{<:AbstractGray})
|
||||
end
|
||||
gr_color(c, ::Type) = gr_color(RGBA(c), RGB)
|
||||
|
||||
set_RGBA_alpha(alpha, c::RGBA) = RGBA(red(c), green(c), blue(c), alpha)
|
||||
set_RGBA_alpha(alpha::Nothing, c::RGBA) = c
|
||||
|
||||
function gr_getcolorind(c)
|
||||
gr_set_transparency(float(alpha(c)))
|
||||
convert(Int, GR.inqcolorfromrgb(red(c), green(c), blue(c)))
|
||||
@@ -225,9 +228,8 @@ end
|
||||
gr_inqtext(x, y, s) = gr_inqtext(x, y, string(s))
|
||||
|
||||
function gr_inqtext(x, y, s::AbstractString)
|
||||
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
|
||||
GR.inqmathtex(x, y, s[2:(end - 1)])
|
||||
elseif occursin('\\', s) || occursin("10^{", s)
|
||||
if (occursin('\\', s) || occursin("10^{", s)) &&
|
||||
match(r".*\$[^\$]+?\$.*", String(s)) == nothing
|
||||
GR.inqtextext(x, y, s)
|
||||
else
|
||||
GR.inqtext(x, y, s)
|
||||
@@ -237,9 +239,8 @@ end
|
||||
gr_text(x, y, s) = gr_text(x, y, string(s))
|
||||
|
||||
function gr_text(x, y, s::AbstractString)
|
||||
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
|
||||
GR.mathtex(x, y, s[2:(end - 1)])
|
||||
elseif occursin('\\', s) || occursin("10^{", s)
|
||||
if (occursin('\\', s) || occursin("10^{", s)) &&
|
||||
match(r".*\$[^\$]+?\$.*", String(s)) == nothing
|
||||
GR.textext(x, y, s)
|
||||
else
|
||||
GR.text(x, y, s)
|
||||
@@ -570,6 +571,9 @@ function gr_draw_colorbar(cbar::GRColorbar, sp::Subplot, clims, viewport_plotare
|
||||
|
||||
ztick = 0.5 * GR.tick(zmin, zmax)
|
||||
gr_set_line(1, :solid, plot_color(:black), sp)
|
||||
if sp[:colorbar_scale] == :log10
|
||||
GR.setscale(2)
|
||||
end
|
||||
GR.axes(0, ztick, xmax, zmin, 0, 1, 0.005)
|
||||
|
||||
title = if isa(sp[:colorbar_title], PlotText)
|
||||
@@ -671,31 +675,19 @@ end
|
||||
|
||||
function gr_set_tickfont(sp, letter)
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
|
||||
# invalidate alignment changes for small rotations (|θ| < 45°)
|
||||
trigger(rot) = abs(sind(rot)) < abs(cosd(rot)) ? 0 : sign(rot)
|
||||
|
||||
rot = axis[:rotation]
|
||||
if letter === :x || (RecipesPipeline.is3d(sp) && letter === :y)
|
||||
halign = (:left, :hcenter, :right)[trigger(rot) + 2]
|
||||
valign = (axis[:mirror] ? :bottom : :top, :vcenter)[trigger(abs(rot)) + 1]
|
||||
else
|
||||
halign = (axis[:mirror] ? :left : :right, :hcenter)[trigger(abs(rot)) + 1]
|
||||
valign = (:top, :vcenter, :bottom)[trigger(rot) + 2]
|
||||
end
|
||||
gr_set_font(
|
||||
tickfont(axis),
|
||||
sp,
|
||||
halign = halign,
|
||||
valign = valign,
|
||||
rotation = axis[:rotation],
|
||||
color = axis[:tickfontcolor],
|
||||
)
|
||||
end
|
||||
|
||||
# size of the text with no rotation
|
||||
function gr_text_size(str)
|
||||
GR.savestate()
|
||||
GR.selntran(0)
|
||||
GR.setcharup(0, 1)
|
||||
xs, ys = gr_inqtext(0, 0, string(str))
|
||||
l, r = extrema(xs)
|
||||
b, t = extrema(ys)
|
||||
@@ -705,9 +697,11 @@ function gr_text_size(str)
|
||||
return w, h
|
||||
end
|
||||
|
||||
# size of the text with rotation applied
|
||||
function gr_text_size(str, rot)
|
||||
GR.savestate()
|
||||
GR.selntran(0)
|
||||
GR.setcharup(0, 1)
|
||||
xs, ys = gr_inqtext(0, 0, string(str))
|
||||
l, r = extrema(xs)
|
||||
b, t = extrema(ys)
|
||||
@@ -720,6 +714,15 @@ end
|
||||
text_box_width(w, h, rot) = abs(cosd(rot)) * w + abs(cosd(rot + 90)) * h
|
||||
text_box_height(w, h, rot) = abs(sind(rot)) * w + abs(sind(rot + 90)) * h
|
||||
|
||||
function gr_get_3d_axis_angle(cvs, nt, ft, letter)
|
||||
length(cvs) < 2 && return 0
|
||||
tickpoints = [gr_w3tondc(sort_3d_axes(cv, nt, ft, letter)...) for cv in cvs]
|
||||
|
||||
dx = tickpoints[2][1] - tickpoints[1][1]
|
||||
dy = tickpoints[2][2] - tickpoints[1][2]
|
||||
return atand(dy, dx)
|
||||
end
|
||||
|
||||
function gr_get_ticks_size(ticks, rot)
|
||||
w, h = 0.0, 0.0
|
||||
for (cv, dv) in zip(ticks...)
|
||||
@@ -951,6 +954,9 @@ function get_z_normalized(z, clims...)
|
||||
end
|
||||
|
||||
function gr_clims(args...)
|
||||
if args[1][:clims] != :auto
|
||||
return get_clims(args[1])
|
||||
end
|
||||
lo, hi = get_clims(args...)
|
||||
if lo == hi
|
||||
if lo == 0
|
||||
@@ -1022,7 +1028,7 @@ end
|
||||
## Legend
|
||||
|
||||
function gr_add_legend(sp, leg, viewport_plotarea)
|
||||
if sp[:legend] ∉ (:none, :inline)
|
||||
if !(sp[:legend_position] in (:none, :inline))
|
||||
GR.savestate()
|
||||
GR.selntran(0)
|
||||
GR.setscale(0)
|
||||
@@ -1030,14 +1036,14 @@ function gr_add_legend(sp, leg, viewport_plotarea)
|
||||
if leg.w > 0
|
||||
xpos, ypos = gr_legend_pos(sp, leg, viewport_plotarea)
|
||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||
gr_set_fillcolor(sp[:background_color_legend])
|
||||
gr_set_fillcolor(sp[:legend_background_color])
|
||||
GR.fillrect(
|
||||
xpos - leg.leftw,
|
||||
xpos + leg.textw + leg.rightw,
|
||||
ypos + leg.dy,
|
||||
ypos - leg.h,
|
||||
) # Allocating white space for actual legend width here
|
||||
gr_set_line(1, :solid, sp[:foreground_color_legend], sp)
|
||||
gr_set_line(1, :solid, sp[:legend_foreground_color], sp)
|
||||
GR.drawrect(
|
||||
xpos - leg.leftw,
|
||||
xpos + leg.textw + leg.rightw,
|
||||
@@ -1045,10 +1051,10 @@ function gr_add_legend(sp, leg, viewport_plotarea)
|
||||
ypos - leg.h,
|
||||
) # Drawing actual legend width here
|
||||
i = 0
|
||||
if sp[:legendtitle] !== nothing
|
||||
if sp[:legend_title] !== nothing
|
||||
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_HALF)
|
||||
gr_set_font(legendtitlefont(sp), sp)
|
||||
gr_text(xpos - 0.03 + 0.5 * leg.w, ypos, string(sp[:legendtitle]))
|
||||
gr_text(xpos - 0.03 + 0.5 * leg.w, ypos, string(sp[:legend_title]))
|
||||
ypos -= leg.dy
|
||||
gr_set_font(legendfont(sp), sp)
|
||||
end
|
||||
@@ -1057,7 +1063,7 @@ function gr_add_legend(sp, leg, viewport_plotarea)
|
||||
should_add_to_legend(series) || continue
|
||||
st = series[:seriestype]
|
||||
lc = get_linecolor(series, clims)
|
||||
gr_set_line(sp[:legendfontsize] / 8, get_linestyle(series), lc, sp)
|
||||
gr_set_line(sp[:legend_font_pointsize] / 8, get_linestyle(series), lc, sp)
|
||||
|
||||
if (
|
||||
(st == :shape || series[:fillrange] !== nothing) &&
|
||||
@@ -1098,16 +1104,17 @@ function gr_add_legend(sp, leg, viewport_plotarea)
|
||||
ms = first(series[:markersize])
|
||||
msw = first(series[:markerstrokewidth])
|
||||
s, sw = if ms > 0
|
||||
0.8 * sp[:legendfontsize], 0.8 * sp[:legendfontsize] * msw / ms
|
||||
0.8 * sp[:legend_font_pointsize],
|
||||
0.8 * sp[:legend_font_pointsize] * msw / ms
|
||||
else
|
||||
0, 0.8 * sp[:legendfontsize] * msw / 8
|
||||
0, 0.8 * sp[:legend_font_pointsize] * msw / 8
|
||||
end
|
||||
gr_draw_markers(series, xpos - leg.width_factor * 2, ypos, clims, s, sw)
|
||||
end
|
||||
|
||||
lab = series[:label]
|
||||
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
|
||||
gr_set_textcolor(plot_color(sp[:legendfontcolor]))
|
||||
gr_set_textcolor(plot_color(sp[:legend_font_color]))
|
||||
gr_text(xpos, ypos, string(lab))
|
||||
ypos -= leg.dy
|
||||
end
|
||||
@@ -1118,7 +1125,7 @@ function gr_add_legend(sp, leg, viewport_plotarea)
|
||||
end
|
||||
|
||||
function gr_legend_pos(sp::Subplot, leg, viewport_plotarea)
|
||||
s = sp[:legend]
|
||||
s = sp[:legend_position]
|
||||
s isa Real && return gr_legend_pos(s, leg, viewport_plotarea)
|
||||
if s isa Tuple{<:Real,Symbol}
|
||||
if s[2] !== :outer
|
||||
@@ -1235,24 +1242,29 @@ end
|
||||
|
||||
function gr_get_legend_geometry(viewport_plotarea, sp)
|
||||
legendn = legendw = dy = 0
|
||||
if sp[:legend] != :none
|
||||
if sp[:legend_position] != :none
|
||||
GR.savestate()
|
||||
GR.selntran(0)
|
||||
GR.setcharup(0, 1)
|
||||
GR.setscale(0)
|
||||
if sp[:legendtitle] !== nothing
|
||||
if sp[:legend_title] !== nothing
|
||||
gr_set_font(legendtitlefont(sp), sp)
|
||||
legendn += 1
|
||||
tbx, tby = gr_inqtext(0, 0, string(sp[:legendtitle]))
|
||||
legendw = tbx[3] - tbx[1]
|
||||
dy = tby[3] - tby[1]
|
||||
tbx, tby = gr_inqtext(0, 0, string(sp[:legend_title]))
|
||||
l, r = extrema(tbx)
|
||||
b, t = extrema(tby)
|
||||
legendw = r - l
|
||||
dy = t - b
|
||||
end
|
||||
gr_set_font(legendfont(sp), sp)
|
||||
for series in series_list(sp)
|
||||
should_add_to_legend(series) || continue
|
||||
legendn += 1
|
||||
tbx, tby = gr_inqtext(0, 0, string(series[:label]))
|
||||
legendw = max(legendw, tbx[3] - tbx[1]) # Holds text width right now
|
||||
dy = max(dy, tby[3] - tby[1])
|
||||
l, r = extrema(tbx)
|
||||
b, t = extrema(tby)
|
||||
legendw = max(legendw, r - l) # Holds text width right now
|
||||
dy = max(dy, t - b)
|
||||
end
|
||||
|
||||
GR.setscale(1)
|
||||
@@ -1270,7 +1282,6 @@ function gr_get_legend_geometry(viewport_plotarea, sp)
|
||||
y_legend_offset = (viewport_plotarea[4] - viewport_plotarea[3]) / 30
|
||||
|
||||
dy *= get(sp[:extra_kwargs], :legend_hfactor, 1)
|
||||
|
||||
legendh = dy * legendn
|
||||
|
||||
return (
|
||||
@@ -1289,7 +1300,7 @@ end
|
||||
## Viewport, window and scale
|
||||
|
||||
function gr_update_viewport_legend!(viewport_plotarea, sp, leg)
|
||||
s = sp[:legend]
|
||||
s = sp[:legend_position]
|
||||
|
||||
xaxis, yaxis = sp[:xaxis], sp[:yaxis]
|
||||
xmirror =
|
||||
@@ -1338,7 +1349,7 @@ function gr_update_viewport_legend!(viewport_plotarea, sp, leg)
|
||||
leg.h + leg.dy + leg.yoffset + !xmirror * gr_axis_height(sp, sp[:xaxis])
|
||||
end
|
||||
end
|
||||
if s === :inline
|
||||
if s == :inline
|
||||
if sp[:yaxis][:mirror]
|
||||
viewport_plotarea[1] += leg.w
|
||||
else
|
||||
@@ -1560,13 +1571,35 @@ function gr_label_ticks(sp, letter, ticks)
|
||||
oamin, oamax = axis_limits(sp, oletter)
|
||||
gr_set_tickfont(sp, letter)
|
||||
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
||||
x_offset = isy ? -1.5e-2 * out_factor : 0
|
||||
y_offset = isy ? 0 : -8e-3 * out_factor
|
||||
x_base_offset = isy ? -1.5e-2 * out_factor : 0
|
||||
y_base_offset = isy ? 0 : -8e-3 * out_factor
|
||||
|
||||
rot = axis[:rotation] % 360
|
||||
ov = sp[:framestyle] == :origin ? 0 : xor(oaxis[:flip], axis[:mirror]) ? oamax : oamin
|
||||
sgn = axis[:mirror] ? -1 : 1
|
||||
sgn2 = iseven(Int(floor(rot / 90))) ? -1 : 1
|
||||
sgn3 = if isy
|
||||
-360 < rot < -180 || 0 < rot < 180 ? 1 : -1
|
||||
else
|
||||
rot < -270 || -90 < rot < 90 || rot > 270 ? 1 : -1
|
||||
end
|
||||
for (cv, dv) in zip(ticks...)
|
||||
x, y = GR.wctondc(reverse_if((cv, ov), isy)...)
|
||||
sz_rot = gr_text_size(dv, rot)
|
||||
sz = gr_text_size(dv)
|
||||
x_offset = x_base_offset
|
||||
y_offset = y_base_offset
|
||||
if isy
|
||||
x_offset += -first(sz_rot) / 2
|
||||
if rot % 90 != 0
|
||||
y_offset += sgn2 * last(sz_rot) / 2 + sgn3 * last(sz) * cosd(rot) / 2
|
||||
end
|
||||
else
|
||||
if rot % 90 != 0
|
||||
x_offset += sgn2 * first(sz_rot) / 2 + sgn3 * last(sz) * sind(rot) / 2
|
||||
end
|
||||
y_offset += -last(sz_rot) / 2
|
||||
end
|
||||
gr_text(x + sgn * x_offset, y + sgn * y_offset, dv)
|
||||
end
|
||||
end
|
||||
@@ -1577,6 +1610,9 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
||||
near_letter = letter in (:x, :z) ? :y : :x
|
||||
far_letter = letter in (:x, :y) ? :z : :x
|
||||
|
||||
isy = letter === :y
|
||||
isz = letter === :z
|
||||
|
||||
ax = sp[get_attr_symbol(letter, :axis)]
|
||||
nax = sp[get_attr_symbol(near_letter, :axis)]
|
||||
fax = sp[get_attr_symbol(far_letter, :axis)]
|
||||
@@ -1584,7 +1620,7 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
||||
amin, amax = axis_limits(sp, letter)
|
||||
namin, namax = axis_limits(sp, near_letter)
|
||||
famin, famax = axis_limits(sp, far_letter)
|
||||
n0, n1 = letter === :y ? (namax, namin) : (namin, namax)
|
||||
n0, n1 = isy ? (namax, namin) : (namin, namax)
|
||||
|
||||
# find out which axes we are dealing with
|
||||
i = findfirst(==(letter), (:x, :y, :z))
|
||||
@@ -1601,27 +1637,57 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
||||
nt = sp[:framestyle] == :origin ? 0 : ax[:mirror] ? n1 : n0
|
||||
ft = sp[:framestyle] == :origin ? 0 : ax[:mirror] ? famax : famin
|
||||
|
||||
xoffset = if letter === :x
|
||||
(sp[:yaxis][:mirror] ? 1 : -1) * 1e-2 * (sp[:xaxis][:tick_direction] == :out ? 1.5 : 1)
|
||||
elseif letter === :y
|
||||
(sp[:yaxis][:mirror] ? -1 : 1) * 1e-2 * (sp[:yaxis][:tick_direction] == :out ? 1.5 : 1)
|
||||
else
|
||||
(sp[:zaxis][:mirror] ? 1 : -1) * 1e-2 * (sp[:zaxis][:tick_direction] == :out ? 1.5 : 1)
|
||||
end
|
||||
yoffset = if letter === :x
|
||||
(sp[:xaxis][:mirror] ? 1 : -1) * 1e-2 * (sp[:xaxis][:tick_direction] == :out ? 1.5 : 1)
|
||||
elseif letter === :y
|
||||
(sp[:yaxis][:mirror] ? 1 : -1) * 1e-2 * (sp[:yaxis][:tick_direction] == :out ? 1.5 : 1)
|
||||
else
|
||||
0
|
||||
end
|
||||
rot = mod(ax[:rotation], 360)
|
||||
sgn = ax[:mirror] ? -1 : 1
|
||||
|
||||
cvs, dvs = ticks
|
||||
ax[:flip] && reverse!(cvs)
|
||||
|
||||
axisθ = isz ? 270 : mod(gr_get_3d_axis_angle(cvs, nt, ft, letter), 360) # issue: doesn't work with 1 tick
|
||||
axisϕ = mod(axisθ - 90, 360)
|
||||
|
||||
out_factor = ifelse(ax[:tick_direction] === :out, 1.5, 1)
|
||||
axisoffset = out_factor * 1.2e-2
|
||||
x_base_offset = axisoffset * cosd(axisϕ)
|
||||
y_base_offset = axisoffset * sind(axisϕ)
|
||||
|
||||
sgn2a = sgn2b = sgn3 = 0
|
||||
if axisθ != 0 || rot % 90 != 0
|
||||
sgn2a =
|
||||
(axisθ != 90) && (axisθ == 0 && (rot < 90 || 180 ≤ rot < 270)) ||
|
||||
(axisθ == 270) ||
|
||||
(axisθ < 90 && (axisθ < rot < 90 || axisθ + 180 < rot < 270)) ||
|
||||
(axisθ > 270 && (rot < 90 || axisθ - 180 < rot < 270 || rot > axisθ)) ? -1 : 1
|
||||
end
|
||||
|
||||
if (axisθ - 90) % 180 != 0 || (rot - 90) % 180 != 0
|
||||
sgn2b =
|
||||
axisθ == 0 ||
|
||||
(axisθ == 90 && (90 ≤ rot < 180 || 270 ≤ rot < 360)) ||
|
||||
(axisθ == 270 && (rot < 90 || 180 ≤ rot < 270)) ||
|
||||
(axisθ < 90 && (axisθ < rot < 180 || axisθ + 180 < rot)) ||
|
||||
(axisθ > 270 && (rot < axisθ - 180 || 180 ≤ rot < axisθ)) ? -1 : 1
|
||||
end
|
||||
|
||||
if !(axisθ == 0 && rot % 180 == 0) && ((rot - 90) % 180 != 0)
|
||||
sgn3 =
|
||||
(axisθ == 0 && 90 < rot < 270) ||
|
||||
(axisθ == 90 && rot < 180) ||
|
||||
(axisθ == 270 && rot > 180) ||
|
||||
(axisθ < 90 && (rot < axisθ || 90 ≤ rot < 180 || axisθ + 180 < rot < 270)) ||
|
||||
(axisθ > 270 && (90 ≤ rot < axisθ - 180 || 180 ≤ rot < 270 || rot > axisθ)) ?
|
||||
-1 : 1
|
||||
end
|
||||
|
||||
for (cv, dv) in zip((cvs, dvs)...)
|
||||
xi, yi = gr_w3tondc(sort_3d_axes(cv, nt, ft, letter)...)
|
||||
gr_text(xi + xoffset, yi + yoffset, dv)
|
||||
sz_rot = gr_text_size(dv, rot)
|
||||
sz = gr_text_size(dv)
|
||||
x_offset =
|
||||
x_base_offset + sgn2a * first(sz_rot) / 2 + sgn3 * last(sz) * sind(rot) / 2
|
||||
y_offset =
|
||||
y_base_offset + sgn2b * last(sz_rot) / 2 + sgn3 * last(sz) * cosd(rot) / 2
|
||||
gr_text(xi + sgn * x_offset, yi + sgn * y_offset, dv)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1784,7 +1850,7 @@ function gr_add_series(sp, series)
|
||||
elseif st in (:surface, :wireframe, :mesh3d)
|
||||
gr_draw_surface(series, x, y, z, clims)
|
||||
elseif st === :volume
|
||||
sp[:legend] = :none
|
||||
sp[:legend_position] = :none
|
||||
GR.gr3.clear()
|
||||
dmin, dmax = GR.gr3.volume(y.v, 0)
|
||||
elseif st === :heatmap
|
||||
@@ -1802,9 +1868,9 @@ function gr_add_series(sp, series)
|
||||
gr_text(GR.wctondc(xi, yi)..., str)
|
||||
end
|
||||
|
||||
if sp[:legend] == :inline && should_add_to_legend(series)
|
||||
if sp[:legend_position] == :inline && should_add_to_legend(series)
|
||||
gr_set_font(legendfont(sp), sp)
|
||||
gr_set_textcolor(plot_color(sp[:legendfontcolor]))
|
||||
gr_set_textcolor(plot_color(sp[:legend_font_color]))
|
||||
if sp[:yaxis][:mirror]
|
||||
(_, i) = sp[:xaxis][:flip] ? findmax(x) : findmin(x)
|
||||
GR.settextalign(GR.TEXT_HALIGN_RIGHT, GR.TEXT_VALIGN_HALF)
|
||||
@@ -1981,14 +2047,42 @@ function gr_draw_surface(series, x, y, z, clims)
|
||||
GR.setfillcolorind(0)
|
||||
GR.surface(x, y, z, get(e_kwargs, :display_option, GR.OPTION_FILLED_MESH))
|
||||
elseif st === :mesh3d
|
||||
@warn "GR: mesh3d is experimental (no face colors)"
|
||||
gr_set_line(
|
||||
get_linewidth(series),
|
||||
get_linestyle(series),
|
||||
get_linecolor(series),
|
||||
series,
|
||||
)
|
||||
GR.polyline3d(mesh3d_triangles(x, y, z, series[:connections])...)
|
||||
if series[:connections] isa AbstractVector{<:AbstractVector{Int}}
|
||||
# Combination of any polygon types
|
||||
cns = [[length(polyinds), polyinds...] for polyinds in series[:connections]]
|
||||
elseif series[:connections] isa AbstractVector{NTuple{N,Int}} where {N}
|
||||
# Only N-gons - connections have to be 1-based (indexing)
|
||||
N = length(series[:connections][1])
|
||||
cns = [[N, polyinds...] for polyinds in series[:connections]]
|
||||
elseif series[:connections] isa NTuple{3,<:AbstractVector{Int}}
|
||||
# Only triangles - connections have to be 0-based (indexing)
|
||||
ci, cj, ck = series[:connections]
|
||||
if !(length(ci) == length(cj) == length(ck))
|
||||
throw(
|
||||
ArgumentError(
|
||||
"Argument connections must consist of equally sized arrays.",
|
||||
),
|
||||
)
|
||||
end
|
||||
cns = [([3, ci[i] + 1, cj[i] + 1, ck[i] + 1]) for i in eachindex(ci)]
|
||||
else
|
||||
throw(
|
||||
ArgumentError(
|
||||
"Unsupported `:connections` type $(typeof(series[:connections])) for seriestype=$st",
|
||||
),
|
||||
)
|
||||
end
|
||||
fillalpha = get_fillalpha(series)
|
||||
n_polygons = length(cns)
|
||||
facecolor = if series[:fillcolor] isa AbstractArray
|
||||
series[:fillcolor]
|
||||
else
|
||||
fill(series[:fillcolor], n_polygons)
|
||||
end
|
||||
facecolor = map(fc -> set_RGBA_alpha(fillalpha, fc), facecolor)
|
||||
GR.setborderwidth(get_linewidth(series))
|
||||
GR.setbordercolorind(gr_getcolorind(get_linecolor(series)))
|
||||
GR.polygonmesh3d(x, y, z, vcat(cns...), signed.(gr_color.(facecolor)))
|
||||
else
|
||||
throw(ArgumentError("Not handled !"))
|
||||
end
|
||||
@@ -2004,15 +2098,38 @@ function gr_draw_heatmap(series, x, y, z, clims)
|
||||
# pdf output, and also supports alpha values.
|
||||
# Note that drawimage draws uniformly spaced data correctly
|
||||
# even on log scales, where it is visually non-uniform.
|
||||
colors = plot_color.(get(fillgrad, z, clims), series[:fillalpha])
|
||||
colors, _z = if series[:subplot][:colorbar_scale] == :identity
|
||||
plot_color.(get(fillgrad, z, clims), series[:fillalpha]), z
|
||||
elseif series[:subplot][:colorbar_scale] == :log10
|
||||
z_log = replace(x -> isinf(x) ? NaN : x, log10.(z))
|
||||
z_normalized = get_z_normalized.(z_log, log10.(clims)...)
|
||||
plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:fillalpha]), z_log
|
||||
end
|
||||
for i in eachindex(colors)
|
||||
if isnan(_z[i])
|
||||
colors[i] = set_RGBA_alpha(0, colors[i])
|
||||
end
|
||||
end
|
||||
rgba = gr_color.(colors)
|
||||
GR.drawimage(first(x), last(x), last(y), first(y), w, h, rgba)
|
||||
else
|
||||
if something(series[:fillalpha], 1) < 1
|
||||
@warn "GR: transparency not supported in non-uniform heatmaps. Alpha values ignored."
|
||||
end
|
||||
z_normalized = get_z_normalized.(z, clims...)
|
||||
z_normalized, _z = if series[:subplot][:colorbar_scale] == :identity
|
||||
get_z_normalized.(z, clims...), z
|
||||
elseif series[:subplot][:colorbar_scale] == :log10
|
||||
z_log = replace(x -> isinf(x) ? NaN : x, log10.(z))
|
||||
get_z_normalized.(z_log, log10.(clims)...), z_log
|
||||
end
|
||||
rgba = Int32[round(Int32, 1000 + _i * 255) for _i in z_normalized]
|
||||
background_color_ind =
|
||||
gr_getcolorind(plot_color(series[:subplot][:background_color_inside]))
|
||||
for i in eachindex(rgba)
|
||||
if isnan(_z[i])
|
||||
rgba[i] = background_color_ind
|
||||
end
|
||||
end
|
||||
if !ispolar(series)
|
||||
GR.nonuniformcellarray(x, y, w, h, rgba)
|
||||
else
|
||||
|
||||
@@ -70,7 +70,7 @@ function _inspectdr_add_annotations(plot, x, y, val::PlotText)
|
||||
color = _inspectdr_mapcolor(val.font.color),
|
||||
)
|
||||
ann = InspectDR.atext(
|
||||
val.str,
|
||||
texmath2unicode(val.str),
|
||||
x = x,
|
||||
y = y,
|
||||
font = fnt,
|
||||
@@ -384,9 +384,9 @@ function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend})
|
||||
_inspectdr_setticks(sp, plot, strip, xaxis, yaxis)
|
||||
|
||||
a = plot.annotation
|
||||
a.title = sp[:title]
|
||||
a.xlabel = xaxis[:guide]
|
||||
a.ylabels = [yaxis[:guide]]
|
||||
a.title = texmath2unicode(sp[:title])
|
||||
a.xlabel = texmath2unicode(xaxis[:guide])
|
||||
a.ylabels = [texmath2unicode(yaxis[:guide])]
|
||||
|
||||
#Modify base layout of new object:
|
||||
l = plot.layout.defaults = deepcopy(InspectDR.defaults.plotlayout)
|
||||
@@ -411,15 +411,14 @@ function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend})
|
||||
_inspectdr_mapptsize(xaxis[:tickfontsize]),
|
||||
color = _inspectdr_mapcolor(xaxis[:tickfontcolor]),
|
||||
)
|
||||
l.enable_legend = (sp[:legend] != :none)
|
||||
l.enable_legend = (sp[:legend_position] != :none)
|
||||
#l.halloc_legend = 150 #TODO: compute???
|
||||
l.font_legend = InspectDR.Font(
|
||||
sp[:legendfontfamily],
|
||||
_inspectdr_mapptsize(sp[:legendfontsize]),
|
||||
color = _inspectdr_mapcolor(sp[:legendfontcolor]),
|
||||
sp[:legend_font_family],
|
||||
_inspectdr_mapptsize(sp[:legend_font_pointsize]),
|
||||
color = _inspectdr_mapcolor(sp[:legend_font_color]),
|
||||
)
|
||||
l.frame_legend.fillcolor = _inspectdr_mapcolor(sp[:background_color_legend])
|
||||
|
||||
l.frame_legend.fillcolor = _inspectdr_mapcolor(sp[:legend_background_color])
|
||||
#_round!() ensures values use integer spacings (looks better on screen):
|
||||
InspectDR._round!(InspectDR.autofit2font!(l, legend_width = 10.0)) #10 "em"s wide
|
||||
return
|
||||
|
||||
+66
-48
@@ -141,9 +141,12 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
title_loc = sp[:titlelocation]
|
||||
bgc_inside = plot_color(sp[:background_color_inside])
|
||||
bgc_inside_a = alpha(bgc_inside)
|
||||
update_clims(sp)
|
||||
axis_opt = PGFPlotsX.Options(
|
||||
"point meta max" => get_clims(sp)[2],
|
||||
"point meta min" => get_clims(sp)[1],
|
||||
"legend cell align" => "left",
|
||||
"legend columns" => pgfx_legend_col(sp[:legend_position]),
|
||||
"title" => sp[:title],
|
||||
"title style" => PGFPlotsX.Options(
|
||||
pgfx_get_title_pos(title_loc)...,
|
||||
@@ -159,6 +162,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
"anchor" => "north west",
|
||||
"xshift" => string(dx),
|
||||
"yshift" => string(-dy),
|
||||
"clip mode" => "individual",
|
||||
)
|
||||
sp_width > 0 * mm ? push!(axis_opt, "width" => string(axis_width)) : nothing
|
||||
sp_height > 0 * mm ? push!(axis_opt, "height" => string(axis_height)) : nothing
|
||||
@@ -245,12 +249,18 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
extra_sp = wraptuple(extra_sp)
|
||||
push!(axis, extra_sp...)
|
||||
end
|
||||
if sp[:legendtitle] !== nothing
|
||||
if sp[:legend_title] !== nothing
|
||||
legtfont = legendtitlefont(sp)
|
||||
push!(axis, PGFPlotsX.Options("\\addlegendimage{empty legend}" => nothing))
|
||||
push!(
|
||||
axis,
|
||||
PGFPlotsX.LegendEntry(
|
||||
string("\\hspace{-.6cm}{\\textbf{", sp[:legendtitle], "}}"),
|
||||
PGFPlotsX.Options(
|
||||
"font" =>
|
||||
pgfx_font(legtfont.pointsize, pgfx_thickness_scaling(sp)),
|
||||
"text" => legtfont.color,
|
||||
),
|
||||
string("\\hspace{-.6cm}{\\textbf{", sp[:legend_title], "}}"),
|
||||
false,
|
||||
),
|
||||
)
|
||||
@@ -375,11 +385,9 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o
|
||||
)
|
||||
end
|
||||
end
|
||||
if (
|
||||
k == 1 &&
|
||||
series[:subplot][:legend] != :none &&
|
||||
pgfx_should_add_to_legend(series)
|
||||
)
|
||||
if i == 1 &&
|
||||
series[:subplot][:legend_position] != :none &&
|
||||
pgfx_should_add_to_legend(series)
|
||||
pgfx_filllegend!(series_opt, opt)
|
||||
end
|
||||
end
|
||||
@@ -652,7 +660,7 @@ function pgfx_add_series!(::Val{:xsticks}, axis, series_opt, series, series_func
|
||||
end
|
||||
|
||||
function pgfx_add_legend!(axis, series, opt, i = 1)
|
||||
if series[:subplot][:legend] != :none
|
||||
if series[:subplot][:legend_position] != :none
|
||||
leg_entry = if opt[:label] isa AVec
|
||||
get(opt[:label], i, "")
|
||||
elseif opt[:label] isa AbstractString
|
||||
@@ -799,22 +807,22 @@ function pgfx_get_legend_pos(v::Tuple{S,Symbol}) where {S<:Real}
|
||||
end
|
||||
|
||||
function pgfx_get_legend_style(sp)
|
||||
cstr = plot_color(sp[:background_color_legend])
|
||||
cstr = plot_color(sp[:legend_background_color])
|
||||
a = alpha(cstr)
|
||||
fg_alpha = alpha(plot_color(sp[:foreground_color_legend]))
|
||||
fg_alpha = alpha(plot_color(sp[:legend_foreground_color]))
|
||||
legfont = legendfont(sp)
|
||||
PGFPlotsX.Options(
|
||||
pgfx_linestyle(
|
||||
pgfx_thickness_scaling(sp),
|
||||
sp[:foreground_color_legend],
|
||||
sp[:legend_foreground_color],
|
||||
fg_alpha,
|
||||
"solid",
|
||||
) => nothing,
|
||||
"fill" => cstr,
|
||||
"fill opacity" => a,
|
||||
"text opacity" => alpha(plot_color(sp[:legendfontcolor])),
|
||||
"font" => pgfx_font(sp[:legendfontsize], pgfx_thickness_scaling(sp)),
|
||||
"text" => plot_color(sp[:legendfontcolor]),
|
||||
"text opacity" => alpha(plot_color(sp[:legend_font_color])),
|
||||
"font" => pgfx_font(sp[:legend_font_pointsize], pgfx_thickness_scaling(sp)),
|
||||
"text" => plot_color(sp[:legend_font_color]),
|
||||
"cells" => PGFPlotsX.Options(
|
||||
"anchor" => get(
|
||||
(left = "west", right = "east", hcenter = "center"),
|
||||
@@ -822,7 +830,7 @@ function pgfx_get_legend_style(sp)
|
||||
"west",
|
||||
),
|
||||
),
|
||||
pgfx_get_legend_pos(sp[:legend])...,
|
||||
pgfx_get_legend_pos(sp[:legend_position])...,
|
||||
)
|
||||
end
|
||||
|
||||
@@ -948,6 +956,9 @@ function pgfx_linestyle(linewidth::Real, color, α = 1, linestyle = :solid)
|
||||
)
|
||||
end
|
||||
|
||||
pgfx_legend_col(s::Symbol) = s == :horizontal ? -1 : 1
|
||||
pgfx_legend_col(n) = n
|
||||
|
||||
function pgfx_linestyle(plotattributes, i = 1)
|
||||
lw = pgfx_thickness_scaling(plotattributes) * get_linewidth(plotattributes, i)
|
||||
lc = single_color(get_linecolor(plotattributes, i))
|
||||
@@ -969,21 +980,20 @@ function pgfx_font(fontsize::Nothing, thickness_scaling = 1, font = "\\selectfon
|
||||
end
|
||||
|
||||
function pgfx_should_add_to_legend(series::Series)
|
||||
series.plotattributes[:primary] &&
|
||||
!(
|
||||
series.plotattributes[:seriestype] in (
|
||||
:hexbin,
|
||||
:bins2d,
|
||||
:histogram2d,
|
||||
:hline,
|
||||
:vline,
|
||||
:contour,
|
||||
:contourf,
|
||||
:contour3d,
|
||||
:heatmap,
|
||||
:image,
|
||||
)
|
||||
series.plotattributes[:primary] && !(
|
||||
series.plotattributes[:seriestype] in (
|
||||
:hexbin,
|
||||
:bins2d,
|
||||
:histogram2d,
|
||||
:hline,
|
||||
:vline,
|
||||
:contour,
|
||||
:contourf,
|
||||
:contour3d,
|
||||
:heatmap,
|
||||
:image,
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
function pgfx_marker(plotattributes, i = 1)
|
||||
@@ -1046,7 +1056,11 @@ function pgfx_add_annotation!(
|
||||
push!(
|
||||
o,
|
||||
join([
|
||||
"\\node",
|
||||
raw"""
|
||||
\begin{scope}
|
||||
\clip \pgfextra{\pgfplotspathaxisoutline};
|
||||
\node
|
||||
""",
|
||||
sprint(
|
||||
PGFPlotsX.print_tex,
|
||||
merge(
|
||||
@@ -1065,6 +1079,7 @@ function pgfx_add_annotation!(
|
||||
),
|
||||
),
|
||||
string(" at (", cs, x, ",", y, ") {", val.str, "};"),
|
||||
"\\end{scope}",
|
||||
]),
|
||||
)
|
||||
end
|
||||
@@ -1217,6 +1232,18 @@ function pgfx_sanitize_plot!(plt)
|
||||
end
|
||||
##
|
||||
end
|
||||
|
||||
function wrap_power_labels(ticks)
|
||||
# wrap the power part of label with }
|
||||
tick_labels = similar(ticks)
|
||||
for (i, label) in enumerate(ticks)
|
||||
base, power = split(label, "^")
|
||||
power = string("{", power, "}")
|
||||
tick_labels[i] = string(base, "^", power)
|
||||
end
|
||||
tick_labels
|
||||
end
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
@@ -1275,7 +1302,8 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
|
||||
# scale
|
||||
scale = axis[:scale]
|
||||
if scale in (:log2, :ln, :log10)
|
||||
is_log_scale = scale in (:ln, :log2, :log10)
|
||||
if is_log_scale
|
||||
push!(opt, string(letter, :mode) => "log")
|
||||
scale == :ln || push!(opt, "log basis $letter" => "$(scale == :log2 ? 2 : 10)")
|
||||
end
|
||||
@@ -1288,11 +1316,7 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
end
|
||||
|
||||
# grid on or off
|
||||
if axis[:grid] && framestyle != :none
|
||||
push!(opt, "$(letter)majorgrids" => "true")
|
||||
else
|
||||
push!(opt, "$(letter)majorgrids" => "false")
|
||||
end
|
||||
push!(opt, "$(letter)majorgrids" => axis[:grid] && framestyle != :none ? "true" : "false")
|
||||
|
||||
# limits
|
||||
lims =
|
||||
@@ -1303,19 +1327,13 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
if !(axis[:ticks] in (nothing, false, :none, :native)) && framestyle != :none
|
||||
# ticks
|
||||
ticks = get_ticks(sp, axis)
|
||||
#pgf plot ignores ticks with angle below 90 when xmin = 90 so shift values
|
||||
# pgf plot ignores ticks with angle below 90 when xmin = 90 so shift values
|
||||
tick_values =
|
||||
ispolar(sp) && letter == :x ? [rad2deg.(ticks[1])[3:end]..., 360, 405] :
|
||||
ticks[1]
|
||||
push!(opt, string(letter, "tick") => string("{", join(tick_values, ","), "}"))
|
||||
if axis[:showaxis] && axis[:scale] in (:ln, :log2, :log10) && axis[:ticks] == :auto
|
||||
# wrap the power part of label with }
|
||||
tick_labels = similar(ticks[2])
|
||||
for (i, label) in enumerate(ticks[2])
|
||||
base, power = split(label, "^")
|
||||
power = string("{", power, "}")
|
||||
tick_labels[i] = string(base, "^", power)
|
||||
end
|
||||
if axis[:showaxis] && is_log_scale && axis[:ticks] == :auto
|
||||
tick_labels = wrap_power_labels(ticks[2])
|
||||
if tick_labels isa Vector{String}
|
||||
push!(
|
||||
opt,
|
||||
@@ -1326,8 +1344,8 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
push!(opt, string(letter, "ticklabels") => join(tick_labels))
|
||||
end
|
||||
elseif axis[:showaxis]
|
||||
tick_labels =
|
||||
ispolar(sp) && letter == :x ? [ticks[2][3:end]..., "0", "45"] : ticks[2]
|
||||
tick_labels = ispolar(sp) && letter == :x ? [ticks[2][3:end]..., "0", "45"] : ticks[2]
|
||||
is_log_scale && (tick_labels = wrap_power_labels(tick_labels))
|
||||
if axis[:formatter] in (:scientific, :auto) && tick_labels isa Vector{String}
|
||||
tick_labels = string.("\$", convert_sci_unicode.(tick_labels), "\$")
|
||||
tick_labels = replace.(tick_labels, Ref("×" => "\\times"))
|
||||
@@ -1444,7 +1462,7 @@ end
|
||||
# Set the (left, top, right, bottom) minimum padding around the plot area
|
||||
# to fit ticks, tick labels, guides, colorbars, etc.
|
||||
function _update_min_padding!(sp::Subplot{PGFPlotsXBackend})
|
||||
leg = sp[:legend]
|
||||
leg = sp[:legend_position]
|
||||
if leg in (:best, :outertopright, :outerright, :outerbottomright) ||
|
||||
(leg isa Tuple && leg[1] >= 1)
|
||||
sp.minpad = (0mm, 0mm, 5mm, 0mm)
|
||||
|
||||
+9
-16
@@ -338,12 +338,12 @@ function plotly_layout(plt::Plot)
|
||||
end
|
||||
|
||||
function plotly_add_legend!(plotattributes_out::KW, sp::Subplot)
|
||||
plotattributes_out[:showlegend] = sp[:legend] != :none
|
||||
legend_position = plotly_legend_pos(sp[:legend])
|
||||
if sp[:legend] != :none
|
||||
plotattributes_out[:legend] = KW(
|
||||
:bgcolor => rgba_string(sp[:background_color_legend]),
|
||||
:bordercolor => rgba_string(sp[:foreground_color_legend]),
|
||||
plotattributes_out[:showlegend] = sp[:legend_position] != :none
|
||||
legend_position = plotly_legend_pos(sp[:legend_position])
|
||||
if sp[:legend_position] != :none
|
||||
plotattributes_out[:legend_position] = KW(
|
||||
:bgcolor => rgba_string(sp[:legend_background_color]),
|
||||
:bordercolor => rgba_string(sp[:legend_foreground_color]),
|
||||
:borderwidth => 1,
|
||||
:traceorder => "normal",
|
||||
:xanchor => legend_position.xanchor,
|
||||
@@ -353,7 +353,7 @@ function plotly_add_legend!(plotattributes_out::KW, sp::Subplot)
|
||||
:x => legend_position.coords[1],
|
||||
:y => legend_position.coords[2],
|
||||
:title => KW(
|
||||
:text => sp[:legendtitle] === nothing ? "" : string(sp[:legendtitle]),
|
||||
:text => sp[:legend_title] === nothing ? "" : string(sp[:legend_title]),
|
||||
:font => plotly_font(legendtitlefont(sp)),
|
||||
),
|
||||
)
|
||||
@@ -1030,11 +1030,7 @@ end
|
||||
|
||||
# get a list of dictionaries, each representing the series params
|
||||
function plotly_series(plt::Plot)
|
||||
slist = []
|
||||
for series in plt.series_list
|
||||
append!(slist, plotly_series(plt, series))
|
||||
end
|
||||
slist
|
||||
reduce(vcat, plotly_series(plt, series) for series in plt.series_list)
|
||||
end
|
||||
|
||||
# get json string for a list of dictionaries, each representing the series params
|
||||
@@ -1110,10 +1106,7 @@ function js_body(plt::Plot, uuid)
|
||||
end
|
||||
|
||||
function plotly_show_js(io::IO, plot::Plot)
|
||||
data = []
|
||||
for series in plot.series_list
|
||||
append!(data, plotly_series(plot, series))
|
||||
end
|
||||
data = plotly_series(plot)
|
||||
layout = plotly_layout(plot)
|
||||
JSON.print(io, Dict(:data => data, :layout => layout))
|
||||
end
|
||||
|
||||
@@ -8,6 +8,7 @@ function plotlyjs_syncplot(plt::Plot{PlotlyJSBackend})
|
||||
traces = PlotlyJS.GenericTrace[]
|
||||
for series_dict in plotly_series(plt)
|
||||
plotly_type = pop!(series_dict, :type)
|
||||
series_dict[:transpose] = false
|
||||
push!(traces, PlotlyJS.GenericTrace(plotly_type; series_dict...))
|
||||
end
|
||||
PlotlyJS.addtraces!(plt.o, traces...)
|
||||
|
||||
+41
-35
@@ -981,7 +981,7 @@ end
|
||||
|
||||
function py_set_spine_color(spines, color)
|
||||
for loc in spines
|
||||
spines[loc]."set_color"(color)
|
||||
getproperty(spines, loc)."set_color"(color)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1206,7 +1206,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
if !ispolar(sp) && !RecipesPipeline.is3d(sp)
|
||||
for pos in ("left", "right", "top", "bottom")
|
||||
# Scale all axes by default first
|
||||
ax.spines[pos]."set_linewidth"(py_thickness_scale(plt, 1))
|
||||
getproperty(ax.spines, pos)."set_linewidth"(py_thickness_scale(plt, 1))
|
||||
end
|
||||
|
||||
# Then set visible some of them
|
||||
@@ -1214,28 +1214,32 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
intensity = 0.5
|
||||
|
||||
spine = sp[:yaxis][:mirror] ? "left" : "right"
|
||||
ax.spines[spine]."set_alpha"(intensity)
|
||||
ax.spines[spine]."set_linewidth"(py_thickness_scale(plt, intensity))
|
||||
getproperty(ax.spines, spine)."set_alpha"(intensity)
|
||||
getproperty(ax.spines, spine)."set_linewidth"(
|
||||
py_thickness_scale(plt, intensity),
|
||||
)
|
||||
|
||||
spine = sp[:xaxis][:mirror] ? "bottom" : "top"
|
||||
ax.spines[spine]."set_linewidth"(py_thickness_scale(plt, intensity))
|
||||
ax.spines[spine]."set_alpha"(intensity)
|
||||
getproperty(ax.spines, spine)."set_linewidth"(
|
||||
py_thickness_scale(plt, intensity),
|
||||
)
|
||||
getproperty(ax.spines, spine)."set_alpha"(intensity)
|
||||
elseif sp[:framestyle] == :box
|
||||
ax.tick_params(top = true) # Add ticks too
|
||||
ax.tick_params(right = true) # Add ticks too
|
||||
elseif sp[:framestyle] in (:axes, :origin)
|
||||
sp[:xaxis][:mirror] ? ax.spines["bottom"]."set_visible"(false) :
|
||||
ax.spines["top"]."set_visible"(false)
|
||||
sp[:yaxis][:mirror] ? ax.spines["left"]."set_visible"(false) :
|
||||
ax.spines["right"]."set_visible"(false)
|
||||
sp[:xaxis][:mirror] ? ax.spines."bottom"."set_visible"(false) :
|
||||
ax.spines."top"."set_visible"(false)
|
||||
sp[:yaxis][:mirror] ? ax.spines."left"."set_visible"(false) :
|
||||
ax.spines."right"."set_visible"(false)
|
||||
if sp[:framestyle] == :origin
|
||||
ax.spines["bottom"]."set_position"("zero")
|
||||
ax.spines["left"]."set_position"("zero")
|
||||
ax.spines."bottom"."set_position"("zero")
|
||||
ax.spines."left"."set_position"("zero")
|
||||
end
|
||||
elseif sp[:framestyle] in (:grid, :none, :zerolines)
|
||||
if PyPlot.version >= v"3.4.1" # that is one where it worked, the API change may have some other value
|
||||
for spine in ax.spines
|
||||
ax.spines[string(spine)]."set_visible"(false)
|
||||
getproperty(ax.spines, string(spine))."set_visible"(false)
|
||||
end
|
||||
else
|
||||
for (loc, spine) in ax.spines
|
||||
@@ -1406,11 +1410,11 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
if !sp[:xaxis][:showaxis]
|
||||
kw = KW()
|
||||
if ispolar(sp)
|
||||
ax.spines["polar"].set_visible(false)
|
||||
ax.spines."polar".set_visible(false)
|
||||
end
|
||||
for dir in (:top, :bottom)
|
||||
if !ispolar(sp)
|
||||
ax.spines[string(dir)].set_visible(false)
|
||||
getproperty(ax.spines, string(dir)).set_visible(false)
|
||||
end
|
||||
kw[dir] = kw[get_attr_symbol(:label, dir)] = false
|
||||
end
|
||||
@@ -1420,7 +1424,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
kw = KW()
|
||||
for dir in (:left, :right)
|
||||
if !ispolar(sp)
|
||||
ax.spines[string(dir)].set_visible(false)
|
||||
getproperty(ax.spines, string(dir)).set_visible(false)
|
||||
end
|
||||
kw[dir] = kw[get_attr_symbol(:label, dir)] = false
|
||||
end
|
||||
@@ -1562,7 +1566,7 @@ end
|
||||
py_legend_bbox(pos) = pos
|
||||
|
||||
function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
leg = sp[:legend]
|
||||
leg = sp[:legend_position]
|
||||
if leg != :none
|
||||
# gotta do this to ensure both axes are included
|
||||
labels = []
|
||||
@@ -1623,7 +1627,7 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
),
|
||||
linewidth = py_thickness_scale(
|
||||
plt,
|
||||
hasline * sp[:legendfontsize] / 8,
|
||||
hasline * sp[:legend_font_pointsize] / 8,
|
||||
),
|
||||
linestyle = py_linestyle(:path, get_linestyle(series)),
|
||||
solid_capstyle = "butt",
|
||||
@@ -1631,7 +1635,10 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
dash_capstyle = "butt",
|
||||
dash_joinstyle = "miter",
|
||||
marker = py_marker(_cycle(series[:markershape], 1)),
|
||||
markersize = py_thickness_scale(plt, 0.8 * sp[:legendfontsize]),
|
||||
markersize = py_thickness_scale(
|
||||
plt,
|
||||
0.8 * sp[:legend_font_pointsize],
|
||||
),
|
||||
markeredgecolor = py_color(
|
||||
single_color(get_markerstrokecolor(series)),
|
||||
get_markerstrokealpha(series),
|
||||
@@ -1642,8 +1649,9 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
),
|
||||
markeredgewidth = py_thickness_scale(
|
||||
plt,
|
||||
0.8 * get_markerstrokewidth(series) * sp[:legendfontsize] /
|
||||
first(series[:markersize]),
|
||||
0.8 *
|
||||
get_markerstrokewidth(series) *
|
||||
sp[:legend_font_pointsize] / first(series[:markersize]),
|
||||
), # retain the markersize/markerstroke ratio from the markers on the plot
|
||||
)
|
||||
push!(handles, handle)
|
||||
@@ -1663,34 +1671,32 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
loc = py_legend_pos(leg),
|
||||
bbox_to_anchor = py_legend_bbox(leg),
|
||||
scatterpoints = 1,
|
||||
fontsize = py_thickness_scale(plt, sp[:legendfontsize]),
|
||||
facecolor = py_color(sp[:background_color_legend]),
|
||||
edgecolor = py_color(sp[:foreground_color_legend]),
|
||||
framealpha = alpha(plot_color(sp[:background_color_legend])),
|
||||
fontsize = py_thickness_scale(plt, sp[:legend_font_pointsize]),
|
||||
facecolor = py_color(sp[:legend_background_color]),
|
||||
edgecolor = py_color(sp[:legend_foreground_color]),
|
||||
framealpha = alpha(plot_color(sp[:legend_background_color])),
|
||||
fancybox = false, # makes the legend box square
|
||||
borderpad = 0.8, # to match GR legendbox
|
||||
)
|
||||
frame = leg."get_frame"()
|
||||
frame."set_linewidth"(py_thickness_scale(plt, 1))
|
||||
leg."set_zorder"(1000)
|
||||
if sp[:legendtitle] !== nothing
|
||||
leg."set_title"(sp[:legendtitle])
|
||||
if sp[:legend_title] !== nothing
|
||||
leg."set_title"(sp[:legend_title])
|
||||
PyPlot.plt."setp"(
|
||||
leg."get_title"(),
|
||||
color = py_color(sp[:legendtitlefontcolor]),
|
||||
family = sp[:legendtitlefontfamily],
|
||||
math_fontfamily = py_get_matching_math_font(sp[:legendtitlefontfamily]),
|
||||
fontsize = py_thickness_scale(plt, sp[:legendtitlefontsize]),
|
||||
color = py_color(sp[:legend_title_font_color]),
|
||||
family = sp[:legend_title_font_family],
|
||||
fontsize = py_thickness_scale(plt, sp[:legend_title_font_pointsize]),
|
||||
)
|
||||
end
|
||||
|
||||
for txt in leg."get_texts"()
|
||||
PyPlot.plt."setp"(
|
||||
txt,
|
||||
color = py_color(sp[:legendfontcolor]),
|
||||
family = sp[:legendfontfamily],
|
||||
math_fontfamily = py_get_matching_math_font(sp[:legendtitlefontfamily]),
|
||||
fontsize = py_thickness_scale(plt, sp[:legendfontsize]),
|
||||
color = py_color(sp[:legend_font_color]),
|
||||
family = sp[:legend_font_family],
|
||||
fontsize = py_thickness_scale(plt, sp[:legend_font_pointsize]),
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,9 +42,9 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||
|
||||
kw = (
|
||||
compact = true,
|
||||
title = sp[:title],
|
||||
xlabel = xaxis[:guide],
|
||||
ylabel = yaxis[:guide],
|
||||
title = texmath2unicode(sp[:title]),
|
||||
xlabel = texmath2unicode(xaxis[:guide]),
|
||||
ylabel = texmath2unicode(yaxis[:guide]),
|
||||
xscale = xaxis[:scale],
|
||||
yscale = yaxis[:scale],
|
||||
border = isijulia() ? :ascii : :solid,
|
||||
@@ -54,7 +54,7 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||
|
||||
o = UnicodePlots.Plot(x, y, _canvas_map[canvas_type]; kw...)
|
||||
for series in series_list(sp)
|
||||
o = addUnicodeSeries!(sp, o, kw, series, sp[:legend] != :none)
|
||||
o = addUnicodeSeries!(sp, o, kw, series, sp[:legend_position] != :none)
|
||||
end
|
||||
|
||||
for ann in sp[:annotations]
|
||||
@@ -63,7 +63,7 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||
o,
|
||||
x,
|
||||
y,
|
||||
val.str;
|
||||
texmath2unicode(val.str);
|
||||
color = up_color(val.font.color),
|
||||
halign = val.font.halign,
|
||||
valign = val.font.valign,
|
||||
|
||||
+32
-27
@@ -5,52 +5,57 @@ process_clims(s::Union{Symbol,Nothing,Missing}) = ignorenan_extrema
|
||||
# don't specialize on ::Function otherwise python functions won't work
|
||||
process_clims(f) = f
|
||||
|
||||
get_clims(sp::Subplot)::Tuple{Float64, Float64} = sp[:crange]
|
||||
get_clims(series::Series)::Tuple{Float64, Float64} = series[:crange]
|
||||
|
||||
get_clims(sp::Subplot, series::Series)::Tuple{Float64, Float64} =
|
||||
series[:colorbar_entry] ?
|
||||
sp[:crange] :
|
||||
series[:crange]
|
||||
|
||||
function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64}
|
||||
get_clims(sp::Subplot)::Tuple{Float64,Float64} =
|
||||
haskey(sp.attr, :clims_calculated) ? sp[:clims_calculated] : update_clims(sp)
|
||||
get_clims(series::Series)::Tuple{Float64,Float64} =
|
||||
haskey(series.plotattributes, :clims_calculated) ?
|
||||
series[:clims_calculated]::Tuple{Float64,Float64} : update_clims(series)
|
||||
get_clims(sp::Subplot, series::Series)::Tuple{Float64,Float64} =
|
||||
series[:colorbar_entry] ? get_clims(sp) : get_clims(series)
|
||||
|
||||
function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64,Float64}
|
||||
zmin, zmax = Inf, -Inf
|
||||
for series in series_list(sp)
|
||||
if series[:colorbar_entry]
|
||||
if series[:colorbar_entry]::Bool
|
||||
zmin, zmax = _update_clims(zmin, zmax, update_clims(series, op)...)
|
||||
else
|
||||
update_clims(series, op)
|
||||
update_clims(series, op)
|
||||
end
|
||||
end
|
||||
return sp[:crange] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN)
|
||||
return sp[:clims_calculated] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN)
|
||||
end
|
||||
|
||||
"""
|
||||
update_clims(::Series, op=Plots.ignorenan_extrema)
|
||||
|
||||
Finds the limits for the colorbar by taking the "z-values" for the series and passing them into `op`,
|
||||
which must return the tuple `(zmin, zmax)`. The default op is the extrema of the finite
|
||||
values of the input. The value is stored as a series property, which is retrieved by `get_clims`.
|
||||
"""
|
||||
function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float64}
|
||||
function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64,Float64}
|
||||
zmin, zmax = Inf, -Inf
|
||||
z_colored_series = (:contour, :contour3d, :heatmap, :histogram2d, :surface, :hexbin)
|
||||
for vals in (
|
||||
series[:seriestype] in z_colored_series ? series[:z] : nothing,
|
||||
series[:line_z],
|
||||
series[:marker_z],
|
||||
series[:fill_z],
|
||||
)
|
||||
if (typeof(vals) <: AbstractSurface) && (eltype(vals.surf) <: Union{Missing,Real})
|
||||
zmin, zmax = _update_clims(zmin, zmax, op(vals.surf)...)
|
||||
elseif (vals !== nothing) && (eltype(vals) <: Union{Missing,Real})
|
||||
zmin, zmax = _update_clims(zmin, zmax, op(vals)...)
|
||||
end
|
||||
|
||||
# keeping this unrolled has higher performance
|
||||
if series[:seriestype] ∈ _z_colored_series && series[:z] !== nothing
|
||||
zmin, zmax = update_clims(zmin, zmax, series[:z], op)
|
||||
end
|
||||
return series[:crange] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN)
|
||||
if series[:line_z] !== nothing
|
||||
zmin, zmax = update_clims(zmin, zmax, series[:line_z], op)
|
||||
end
|
||||
if series[:marker_z] !== nothing
|
||||
zmin, zmax = update_clims(zmin, zmax, series[:marker_z], op)
|
||||
end
|
||||
if series[:fill_z] !== nothing
|
||||
zmin, zmax = update_clims(zmin, zmax, series[:fill_z], op)
|
||||
end
|
||||
return series[:clims_calculated] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN)
|
||||
end
|
||||
|
||||
update_clims(zmin, zmax, vals::AbstractSurface, op)::Tuple{Float64,Float64} =
|
||||
update_clims(zmin, zmax, vals.surf, op)
|
||||
update_clims(zmin, zmax, vals::Any, op)::Tuple{Float64,Float64} =
|
||||
_update_clims(zmin, zmax, op(vals)...)
|
||||
update_clims(zmin, zmax, ::Nothing, ::Any)::Tuple{Float64,Float64} = zmin, zmax
|
||||
|
||||
_update_clims(zmin, zmax, emin, emax) = NaNMath.min(zmin, emin), NaNMath.max(zmax, emax)
|
||||
|
||||
@enum ColorbarStyle cbar_gradient cbar_fill cbar_lines
|
||||
|
||||
+21
-3
@@ -246,6 +246,7 @@ function font(args...; kw...)
|
||||
|
||||
for arg in args
|
||||
T = typeof(arg)
|
||||
@assert arg !== :match
|
||||
|
||||
if T == Font
|
||||
family = arg.family
|
||||
@@ -269,12 +270,12 @@ function font(args...; kw...)
|
||||
catch
|
||||
family = string(arg)
|
||||
end
|
||||
elseif typeof(arg) <: Integer
|
||||
elseif T <: Integer
|
||||
pointsize = arg
|
||||
elseif typeof(arg) <: Real
|
||||
elseif T <: Real
|
||||
rotation = convert(Float64, arg)
|
||||
else
|
||||
@warn "Unused font arg: $arg ($(typeof(arg)))"
|
||||
@warn "Unused font arg: $arg ($T)"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -772,3 +773,20 @@ function extrema_plus_buffer(v, buffmult = 0.2)
|
||||
buffer = vdiff * buffmult
|
||||
vmin - buffer, vmax + buffer
|
||||
end
|
||||
|
||||
### Legend
|
||||
|
||||
@add_attributes subplot struct Legend
|
||||
background_color = :match
|
||||
foreground_color = :match
|
||||
position = :best
|
||||
title = nothing
|
||||
font::Font = font(8)
|
||||
title_font::Font = font(11)
|
||||
column = 1
|
||||
end :match = (
|
||||
:legend_font_family,
|
||||
:legend_font_color,
|
||||
:legend_title_font_family,
|
||||
:legend_title_font_color,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
const _all_defaults = KW[_series_defaults, _plot_defaults, _subplot_defaults]
|
||||
|
||||
const _initial_defaults = deepcopy(_all_defaults)
|
||||
const _initial_axis_defaults = deepcopy(_axis_defaults)
|
||||
|
||||
# add defaults for the letter versions
|
||||
const _axis_defaults_byletter = KW()
|
||||
|
||||
function reset_axis_defaults_byletter!()
|
||||
for letter in (:x, :y, :z)
|
||||
_axis_defaults_byletter[letter] = KW()
|
||||
for (k, v) in _axis_defaults
|
||||
_axis_defaults_byletter[letter][k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
reset_axis_defaults_byletter!()
|
||||
|
||||
# to be able to reset font sizes to initial values
|
||||
const _initial_plt_fontsizes =
|
||||
Dict(:plot_titlefontsize => _plot_defaults[:plot_titlefontsize])
|
||||
|
||||
const _initial_sp_fontsizes = Dict(
|
||||
:titlefontsize => _subplot_defaults[:titlefontsize],
|
||||
:legend_font_pointsize => _subplot_defaults[:legend_font_pointsize],
|
||||
:legend_title_font_pointsize => _subplot_defaults[:legend_title_font_pointsize],
|
||||
:annotationfontsize => _subplot_defaults[:annotationfontsize],
|
||||
:colorbar_tickfontsize => _subplot_defaults[:colorbar_tickfontsize],
|
||||
:colorbar_titlefontsize => _subplot_defaults[:colorbar_titlefontsize],
|
||||
)
|
||||
|
||||
const _initial_ax_fontsizes = Dict(
|
||||
:tickfontsize => _axis_defaults[:tickfontsize],
|
||||
:guidefontsize => _axis_defaults[:guidefontsize],
|
||||
)
|
||||
|
||||
const _initial_fontsizes =
|
||||
merge(_initial_plt_fontsizes, _initial_sp_fontsizes, _initial_ax_fontsizes)
|
||||
|
||||
const _internal_args =
|
||||
[:plot_object, :series_plotindex, :markershape_to_add, :letter, :idxfilter]
|
||||
|
||||
const _axis_args = sort(union(collect(keys(_axis_defaults))))
|
||||
const _series_args = sort(union(collect(keys(_series_defaults))))
|
||||
const _subplot_args = sort(union(collect(keys(_subplot_defaults))))
|
||||
const _plot_args = sort(union(collect(keys(_plot_defaults))))
|
||||
|
||||
const _magic_axis_args = [:axis, :tickfont, :guidefont, :grid, :minorgrid]
|
||||
const _magic_subplot_args =
|
||||
[:title_font, :legend_font, :legend_title_font, :plot_title_font, :colorbar_titlefont]
|
||||
const _magic_series_args = [:line, :marker, :fill]
|
||||
|
||||
const _all_axis_args = sort(union([_axis_args; _magic_axis_args]))
|
||||
const _all_subplot_args = sort(union([_subplot_args; _magic_subplot_args]))
|
||||
const _all_series_args = sort(union([_series_args; _magic_series_args]))
|
||||
const _all_plot_args = _plot_args
|
||||
|
||||
const _all_args = sort(union([
|
||||
_all_axis_args
|
||||
_all_subplot_args
|
||||
_all_series_args
|
||||
_all_plot_args
|
||||
]))
|
||||
|
||||
# add all pluralized forms to the _keyAliases dict
|
||||
for arg in _all_args
|
||||
add_aliases(arg, makeplural(arg))
|
||||
end
|
||||
|
||||
# fill symbol cache
|
||||
for letter in (:x, :y, :z)
|
||||
_attrsymbolcache[letter] = Dict{Symbol,Symbol}()
|
||||
for k in _axis_args
|
||||
# populate attribute cache
|
||||
lk = Symbol(letter, k)
|
||||
_attrsymbolcache[letter][k] = lk
|
||||
# allow the underscore version too: xguide or x_guide
|
||||
add_aliases(lk, Symbol(letter, "_", k))
|
||||
end
|
||||
for k in (_magic_axis_args..., :(_discrete_indices))
|
||||
_attrsymbolcache[letter][k] = Symbol(letter, k)
|
||||
end
|
||||
end
|
||||
|
||||
# add all non_underscored forms to the _keyAliases
|
||||
add_non_underscore_aliases!(_keyAliases)
|
||||
@@ -1232,6 +1232,38 @@ const _examples = PlotExample[
|
||||
),
|
||||
],
|
||||
),
|
||||
PlotExample( # 56
|
||||
"Bar plot customizations",
|
||||
"""
|
||||
Width of bars may be specified as `bar_width`.
|
||||
The bars' baseline may be specified as `fillto`.
|
||||
Each may be scalar, or a vector spcifying one value per bar.
|
||||
""",
|
||||
[
|
||||
:(
|
||||
begin
|
||||
plot(
|
||||
bar(
|
||||
[-1, 0, 2, 3],
|
||||
[1, 3, 6, 2],
|
||||
fill_z = 4:-1:1,
|
||||
alpha = [1, 0.2, 0.8, 0.5],
|
||||
label = "",
|
||||
bar_width = 1:4,
|
||||
),
|
||||
bar(
|
||||
rand(5),
|
||||
bar_width = 1.2,
|
||||
alpha = 0.8,
|
||||
color = [:lightsalmon, :tomato, :crimson, :firebrick, :darkred],
|
||||
fillto = 0:-0.1:-0.4,
|
||||
label = "reds",
|
||||
),
|
||||
)
|
||||
end
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
# Some constants for PlotDocs and PlotReferenceImages
|
||||
|
||||
+18
-133
@@ -269,6 +269,9 @@ Base.getindex(layout::GridLayout, r::Int, c::Int) = layout.grid[r, c]
|
||||
function Base.setindex!(layout::GridLayout, v, r::Int, c::Int)
|
||||
layout.grid[r, c] = v
|
||||
end
|
||||
function Base.setindex!(layout::GridLayout, v, ci::CartesianIndex)
|
||||
layout.grid[ci] = v
|
||||
end
|
||||
|
||||
leftpad(layout::GridLayout) = layout.minpad[1]
|
||||
toppad(layout::GridLayout) = layout.minpad[2]
|
||||
@@ -491,6 +494,19 @@ function layout_args(sztup::NTuple{3,Integer})
|
||||
GridLayout(nr, nc), n
|
||||
end
|
||||
|
||||
layout_args(nt::NamedTuple) = EmptyLayout(; nt...), 1
|
||||
|
||||
function layout_args(m::AbstractVecOrMat)
|
||||
sz = size(m)
|
||||
nr = sz[1]
|
||||
nc = get(sz, 2, 1)
|
||||
gl = GridLayout(nr, nc)
|
||||
for ci in CartesianIndices(m)
|
||||
gl[ci] = layout_args(m[ci])[1]
|
||||
end
|
||||
layout_args(gl)
|
||||
end
|
||||
|
||||
# compute number of subplots
|
||||
function layout_args(layout::GridLayout)
|
||||
# recursively get the size of the grid
|
||||
@@ -498,7 +514,8 @@ function layout_args(layout::GridLayout)
|
||||
layout, n
|
||||
end
|
||||
|
||||
layout_args(n_override::Integer, layout::GridLayout) = layout_args(layout)
|
||||
layout_args(n_override::Integer, layout::Union{AbstractVecOrMat,GridLayout}) =
|
||||
layout_args(layout)
|
||||
|
||||
layout_args(huh) = error("unhandled layout type $(typeof(huh)): $huh")
|
||||
|
||||
@@ -562,138 +579,6 @@ function build_layout(layout::GridLayout, n::Integer, plts::AVec{Plot})
|
||||
layout, subplots, spmap
|
||||
end
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# @layout macro
|
||||
|
||||
function add_layout_pct!(kw::AKW, v::Expr, idx::Integer, nidx::Integer)
|
||||
# dump(v)
|
||||
# something like {0.2w}?
|
||||
if v.head == :call && v.args[1] == :*
|
||||
num = v.args[2]
|
||||
if length(v.args) == 3 && isa(num, Number)
|
||||
units = v.args[3]
|
||||
if units == :h
|
||||
return kw[:h] = num * pct
|
||||
elseif units == :w
|
||||
return kw[:w] = num * pct
|
||||
elseif units in (:pct, :px, :mm, :cm, :inch)
|
||||
idx == 1 && (kw[:w] = v)
|
||||
(idx == 2 || nidx == 1) && (kw[:h] = v)
|
||||
# return kw[idx == 1 ? :w : :h] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
error("Couldn't match layout curly (idx=$idx): $v")
|
||||
end
|
||||
|
||||
function add_layout_pct!(kw::AKW, v::Number, idx::Integer)
|
||||
# kw[idx == 1 ? :w : :h] = v*pct
|
||||
idx == 1 && (kw[:w] = v * pct)
|
||||
(idx == 2 || nidx == 1) && (kw[:h] = v * pct)
|
||||
end
|
||||
|
||||
isrow(v) = isa(v, Expr) && v.head in (:hcat, :row)
|
||||
iscol(v) = isa(v, Expr) && v.head == :vcat
|
||||
rowsize(v) = isrow(v) ? length(v.args) : 1
|
||||
|
||||
function create_grid(expr::Expr)
|
||||
if iscol(expr)
|
||||
create_grid_vcat(expr)
|
||||
elseif isrow(expr)
|
||||
:(
|
||||
let cell = GridLayout(1, $(length(expr.args)))
|
||||
$(
|
||||
[
|
||||
:(cell[1, $i] = $(create_grid(v))) for
|
||||
(i, v) in enumerate(expr.args)
|
||||
]...
|
||||
)
|
||||
cell
|
||||
end
|
||||
)
|
||||
|
||||
elseif expr.head == :curly
|
||||
create_grid_curly(expr)
|
||||
else
|
||||
# if it's something else, just return that (might be an existing layout?)
|
||||
esc(expr)
|
||||
end
|
||||
end
|
||||
|
||||
function create_grid_vcat(expr::Expr)
|
||||
rowsizes = map(rowsize, expr.args)
|
||||
rmin, rmax = extrema(rowsizes)
|
||||
if rmin > 0 && rmin == rmax
|
||||
# we have a grid... build the whole thing
|
||||
# note: rmin is the number of columns
|
||||
nr = length(expr.args)
|
||||
nc = rmin
|
||||
body = Expr(:block)
|
||||
for r in 1:nr
|
||||
arg = expr.args[r]
|
||||
if isrow(arg)
|
||||
for (c, item) in enumerate(arg.args)
|
||||
push!(body.args, :(cell[$r, $c] = $(create_grid(item))))
|
||||
end
|
||||
else
|
||||
push!(body.args, :(cell[$r, 1] = $(create_grid(arg))))
|
||||
end
|
||||
end
|
||||
:(
|
||||
let cell = GridLayout($nr, $nc)
|
||||
$body
|
||||
cell
|
||||
end
|
||||
)
|
||||
else
|
||||
# otherwise just build one row at a time
|
||||
:(
|
||||
let cell = GridLayout($(length(expr.args)), 1)
|
||||
$(
|
||||
[
|
||||
:(cell[$i, 1] = $(create_grid(v))) for
|
||||
(i, v) in enumerate(expr.args)
|
||||
]...
|
||||
)
|
||||
cell
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function create_grid_curly(expr::Expr)
|
||||
kw = KW()
|
||||
for (i, arg) in enumerate(expr.args[2:end])
|
||||
add_layout_pct!(kw, arg, i, length(expr.args) - 1)
|
||||
end
|
||||
s = expr.args[1]
|
||||
if isa(s, Expr) && s.head == :call && s.args[1] == :grid
|
||||
create_grid(
|
||||
:(grid(
|
||||
$(s.args[2:end]...),
|
||||
width = $(get(kw, :w, QuoteNode(:auto))),
|
||||
height = $(get(kw, :h, QuoteNode(:auto))),
|
||||
)),
|
||||
)
|
||||
elseif isa(s, Symbol)
|
||||
:(EmptyLayout(
|
||||
label = $(QuoteNode(s)),
|
||||
width = $(get(kw, :w, QuoteNode(:auto))),
|
||||
height = $(get(kw, :h, QuoteNode(:auto))),
|
||||
))
|
||||
else
|
||||
error("Unknown use of curly brackets: $expr")
|
||||
end
|
||||
end
|
||||
|
||||
function create_grid(s::Symbol)
|
||||
:(EmptyLayout(label = $(QuoteNode(s)), blank = $(s == :_)))
|
||||
end
|
||||
|
||||
macro layout(mat::Expr)
|
||||
create_grid(mat)
|
||||
end
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# make all reference the same axis extrema/values.
|
||||
|
||||
+14
-23
@@ -8,24 +8,14 @@ function RecipesPipeline.warn_on_recipe_aliases!(
|
||||
recipe_type::Symbol,
|
||||
@nospecialize(args)
|
||||
)
|
||||
for k in keys(plotattributes)
|
||||
if !is_default_attribute(k)
|
||||
dk = get(_keyAliases, k, k)
|
||||
if k !== dk
|
||||
if recipe_type == :user
|
||||
signature_string = RecipesPipeline.userrecipe_signature_string(args)
|
||||
elseif recipe_type == :type
|
||||
signature_string = RecipesPipeline.typerecipe_signature_string(args)
|
||||
elseif recipe_type == :plot
|
||||
signature_string = RecipesPipeline.plotrecipe_signature_string(args)
|
||||
elseif recipe_type == :series
|
||||
signature_string = RecipesPipeline.seriesrecipe_signature_string(args)
|
||||
else
|
||||
throw(ArgumentError("Invalid recipe type `$recipe_type`"))
|
||||
end
|
||||
@warn "Attribute alias `$k` detected in the $recipe_type recipe defined for the signature $signature_string. To ensure expected behavior it is recommended to use the default attribute `$dk`."
|
||||
pkeys = keys(plotattributes)
|
||||
for k in pkeys
|
||||
dk = get(_keyAliases, k, nothing)
|
||||
if dk !== nothing
|
||||
kv = RecipesPipeline.pop_kw!(plotattributes, k)
|
||||
if dk ∉ pkeys
|
||||
plotattributes[dk] = kv
|
||||
end
|
||||
plotattributes[dk] = RecipesPipeline.pop_kw!(plotattributes, k)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -253,12 +243,12 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW})
|
||||
attr[get_attr_symbol(letter, k)] = v
|
||||
end
|
||||
end
|
||||
for k in (:scale,), letter in (:x, :y, :z)
|
||||
# Series recipes may need access to this information
|
||||
lk = get_attr_symbol(letter, k)
|
||||
if haskey(attr, lk)
|
||||
kw[lk] = attr[lk]
|
||||
end
|
||||
end
|
||||
for k in (:scale,), letter in (:x, :y, :z)
|
||||
# Series recipes may need access to this information
|
||||
lk = get_attr_symbol(letter, k)
|
||||
if haskey(attr, lk)
|
||||
kw[lk] = attr[lk]
|
||||
end
|
||||
end
|
||||
sp_attrs[sp] = attr
|
||||
@@ -273,6 +263,7 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW})
|
||||
get(sp_attrs, sp, KW())
|
||||
end
|
||||
_update_subplot_args(plt, sp, attr, idx, false)
|
||||
_update_subplot_legend(sp, attr)
|
||||
end
|
||||
|
||||
# do we need to link any axes together?
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#! format: off
|
||||
should_precompile = true
|
||||
|
||||
|
||||
# Don't edit the following! Instead change the script for `snoop_bot`.
|
||||
ismultios = false
|
||||
ismultiversion = false
|
||||
@@ -7,9 +9,7 @@ ismultiversion = false
|
||||
@static if !should_precompile
|
||||
# nothing
|
||||
elseif !ismultios && !ismultiversion
|
||||
@static if isfile(
|
||||
joinpath(@__DIR__, "../deps/SnoopCompile/precompile/precompile_Plots.jl"),
|
||||
)
|
||||
@static if isfile(joinpath(@__DIR__, "../deps/SnoopCompile/precompile/precompile_Plots.jl"))
|
||||
include("../deps/SnoopCompile/precompile/precompile_Plots.jl")
|
||||
_precompile_()
|
||||
end
|
||||
|
||||
+23
-5
@@ -508,6 +508,18 @@ end
|
||||
primary := true
|
||||
x := xseg.pts
|
||||
y := yseg.pts
|
||||
# expand attributes to match indices in new series data
|
||||
for k in _segmenting_vector_attributes ∪ _segmenting_array_attributes
|
||||
v = get(plotattributes, k, nothing)
|
||||
if v isa AVec
|
||||
if eachindex(v) != eachindex(y)
|
||||
@warn "Indices $(eachindex(v)) of attribute `$k` do not match data indices $(eachindex(y))."
|
||||
end
|
||||
# Each segment is 6 elements long, including the NaN separator.
|
||||
# There is no trailing NaN, so the last repetition is dropped.
|
||||
plotattributes[k] = @view repeat(v; inner = 6)[1:(end - 1)]
|
||||
end
|
||||
end
|
||||
()
|
||||
end
|
||||
|
||||
@@ -1025,14 +1037,14 @@ export lens!
|
||||
throw(ArgumentError("Inset bounding box needs to in relative coordinates."))
|
||||
end
|
||||
sp = plt.subplots[sp_index]
|
||||
xl1, xl2 = xlims(plt.subplots[sp_index])
|
||||
xl1, xl2 = xlims(sp)
|
||||
bbx1 = xl1 + left(inset_bbox).value * (xl2 - xl1)
|
||||
bbx2 = bbx1 + width(inset_bbox).value * (xl2 - xl1)
|
||||
yl1, yl2 = ylims(plt.subplots[sp_index])
|
||||
yl1, yl2 = ylims(sp)
|
||||
bby1 = yl1 + (1 - bottom(inset_bbox).value) * (yl2 - yl1)
|
||||
bby2 = bby1 + height(inset_bbox).value * (yl2 - yl1)
|
||||
bbx = bbx1 + width(inset_bbox).value * (xl2 - xl1) / 2
|
||||
bby = bby1 + height(inset_bbox).value * (yl2 - yl1) / 2
|
||||
bbx = bbx1 + width(inset_bbox).value * (xl2 - xl1) / 2 * (sp[:xaxis][:flip] ? -1 : 1)
|
||||
bby = bby1 + height(inset_bbox).value * (yl2 - yl1) / 2 * (sp[:yaxis][:flip] ? -1 : 1)
|
||||
lens_index = last(plt.subplots)[:subplot_index] + 1
|
||||
x1, x2 = plotattributes[:x]
|
||||
y1, y2 = plotattributes[:y]
|
||||
@@ -1042,7 +1054,13 @@ export lens!
|
||||
series_plotindex := backup[:series_plotindex]
|
||||
seriestype := :path
|
||||
primary := false
|
||||
linecolor := :lightgray
|
||||
linecolor := get(backup, :linecolor, :lightgray)
|
||||
if haskey(backup, :linestyle)
|
||||
linestyle := backup[:linestyle]
|
||||
end
|
||||
if haskey(backup, :linewidth)
|
||||
linewidth := backup[:linewidth]
|
||||
end
|
||||
bbx_mag = (x1 + x2) / 2
|
||||
bby_mag = (y1 + y2) / 2
|
||||
xi_lens, yi_lens =
|
||||
|
||||
+27
-18
@@ -103,7 +103,10 @@ function series_segments(series::Series, seriestype::Symbol = :path; check = fal
|
||||
|
||||
segments = if has_attribute_segments(series)
|
||||
Iterators.flatten(map(nan_segments) do r
|
||||
if seriestype in (:scatter, :scatter3d)
|
||||
if seriestype == :shape
|
||||
warn_on_inconsistent_shape_attr(series, x, y, z, r)
|
||||
(SeriesSegment(r, first(r)),)
|
||||
elseif seriestype in (:scatter, :scatter3d)
|
||||
(SeriesSegment(i:i, i) for i in r)
|
||||
else
|
||||
(SeriesSegment(i:(i + 1), i) for i in first(r):(last(r) - 1))
|
||||
@@ -140,6 +143,16 @@ function warn_on_attr_dim_mismatch(series, x, y, z, segments)
|
||||
end
|
||||
end
|
||||
|
||||
function warn_on_inconsistent_shape_attr(series, x, y, z, r)
|
||||
for attr in _segmenting_vector_attributes
|
||||
v = get(series, attr, nothing)
|
||||
if v isa AVec && length(unique(v[r])) > 1
|
||||
@warn "Different values of `$attr` specified for different shape vertices. Only first one will be used."
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# helpers to figure out if there are NaN values in a list of array types
|
||||
anynan(i::Int, args::Tuple) = any(a -> try
|
||||
isnan(_cycle(a, i))
|
||||
@@ -500,7 +513,7 @@ for comp in (:line, :fill, :marker)
|
||||
end
|
||||
end
|
||||
|
||||
$get_compcolor(series, clims, i::Int = 1) =
|
||||
$get_compcolor(series, clims::Tuple{<:Number,<:Number}, i::Int = 1) =
|
||||
$get_compcolor(series, clims[1], clims[2], i)
|
||||
|
||||
function $get_compcolor(series, i::Int = 1)
|
||||
@@ -573,7 +586,6 @@ const _segmenting_array_attributes = :line_z, :fill_z, :marker_z
|
||||
function has_attribute_segments(series::Series)
|
||||
# we want to check if a series needs to be split into segments just because
|
||||
# of its attributes
|
||||
series[:seriestype] == :shape && return false
|
||||
# check relevant attributes if they have multiple inputs
|
||||
return any(
|
||||
series[attr] isa AbstractVector && length(series[attr]) > 1 for
|
||||
@@ -648,7 +660,7 @@ function with(f::Function, args...; kw...)
|
||||
newdefs[:xticks] = nothing
|
||||
newdefs[:yticks] = nothing
|
||||
newdefs[:grid] = false
|
||||
newdefs[:legend] = false
|
||||
newdefs[:legend_position] = false
|
||||
end
|
||||
|
||||
# dict to store old and new keyword args for anything that changes
|
||||
@@ -982,22 +994,15 @@ titlefont(sp::Subplot) = font(;
|
||||
color = sp[:titlefontcolor],
|
||||
)
|
||||
|
||||
legendfont(sp::Subplot) = font(;
|
||||
family = sp[:legendfontfamily],
|
||||
pointsize = sp[:legendfontsize],
|
||||
valign = sp[:legendfontvalign],
|
||||
halign = sp[:legendfonthalign],
|
||||
rotation = sp[:legendfontrotation],
|
||||
color = sp[:legendfontcolor],
|
||||
)
|
||||
legendfont(sp::Subplot) = sp[:legend_font]
|
||||
|
||||
legendtitlefont(sp::Subplot) = font(;
|
||||
family = sp[:legendtitlefontfamily],
|
||||
pointsize = sp[:legendtitlefontsize],
|
||||
valign = sp[:legendtitlefontvalign],
|
||||
halign = sp[:legendtitlefonthalign],
|
||||
rotation = sp[:legendtitlefontrotation],
|
||||
color = sp[:legendtitlefontcolor],
|
||||
family = sp[:legend_title_font_family],
|
||||
pointsize = sp[:legend_title_font_pointsize],
|
||||
valign = sp[:legend_title_font_valign],
|
||||
halign = sp[:legend_title_font_halign],
|
||||
rotation = sp[:legend_title_font_rotation],
|
||||
color = sp[:legend_title_font_color],
|
||||
)
|
||||
|
||||
tickfont(ax::Axis) = font(;
|
||||
@@ -1209,6 +1214,7 @@ function mesh3d_triangles(x, y, z, cns::Tuple{Array,Array,Array})
|
||||
end
|
||||
return X, Y, Z
|
||||
end
|
||||
|
||||
function mesh3d_triangles(x, y, z, cns::AbstractVector{NTuple{3,Int}})
|
||||
X = zeros(eltype(x), 4length(cns))
|
||||
Y = zeros(eltype(y), 4length(cns))
|
||||
@@ -1239,3 +1245,6 @@ const _attrsymbolcache = Dict{Symbol,Dict{Symbol,Symbol}}()
|
||||
|
||||
get_attr_symbol(letter::Symbol, keyword::String) = get_attr_symbol(letter, Symbol(keyword))
|
||||
get_attr_symbol(letter::Symbol, keyword::Symbol) = _attrsymbolcache[letter][keyword]
|
||||
|
||||
texmath2unicode(s::AbstractString, pat = r"\$([^$]+)\$") =
|
||||
replace(s, pat => m -> UnicodeFun.to_latex(m[2:(length(m) - 1)]))
|
||||
|
||||
@@ -199,6 +199,13 @@ end
|
||||
@test Plots.process_clims(nothing) ==
|
||||
Plots.process_clims(missing) ==
|
||||
Plots.process_clims(:auto)
|
||||
|
||||
@test (==)(
|
||||
Plots.texmath2unicode(
|
||||
raw"Equation $y = \alpha \cdot x + \beta$ and eqn $y = \sin(x)^2$",
|
||||
),
|
||||
raw"Equation y = α ⋅ x + β and eqn y = sin(x)²",
|
||||
)
|
||||
end
|
||||
|
||||
@testset "Backends" begin
|
||||
|
||||
@@ -65,6 +65,9 @@ end
|
||||
end
|
||||
|
||||
@testset "axis-aliases" begin
|
||||
@test haskey(Plots._keyAliases, :xguideposition)
|
||||
@test haskey(Plots._keyAliases, :x_guide_position)
|
||||
@test !haskey(Plots._keyAliases, :xguide_position)
|
||||
p = plot(1:2, xl = "x label")
|
||||
@test p[1][:xaxis][:guide] === "x label"
|
||||
p = plot(1:2, xrange = (0, 3))
|
||||
|
||||
+72
-2
@@ -1,4 +1,4 @@
|
||||
using Plots, Test
|
||||
using Plots, Test, Colors
|
||||
|
||||
const PLOTS_DEFAULTS = Dict(:theme => :wong2, :fontfamily => :palantino)
|
||||
Plots.__init__()
|
||||
@@ -6,8 +6,78 @@ Plots.__init__()
|
||||
@testset "Loading theme" begin
|
||||
pl = plot(1:5)
|
||||
@test pl[1][1][:seriescolor] == RGBA(colorant"black")
|
||||
@test guidefont(pl[1][:xaxis]).family == "palantino"
|
||||
@test Plots.guidefont(pl[1][:xaxis]).family == "palantino"
|
||||
end
|
||||
|
||||
empty!(PLOTS_DEFAULTS)
|
||||
Plots.__init__()
|
||||
|
||||
@testset "Legend defaults" begin
|
||||
p = plot()
|
||||
@test p[1][:legend_font_family] == "sans-serif"
|
||||
@test p[1][:legend_font_pointsize] == 8
|
||||
@test p[1][:legend_font_halign] == :hcenter
|
||||
@test p[1][:legend_font_valign] == :vcenter
|
||||
@test p[1][:legend_font_rotation] == 0.0
|
||||
@test p[1][:legend_font_color] == RGB{Colors.N0f8}(0.0, 0.0, 0.0)
|
||||
@test p[1][:legend_position] == :best
|
||||
@test p[1][:legend_title] == nothing
|
||||
@test p[1][:legend_title_font_family] == "sans-serif"
|
||||
@test p[1][:legend_title_font_pointsize] == 11
|
||||
@test p[1][:legend_title_font_halign] == :hcenter
|
||||
@test p[1][:legend_title_font_valign] == :vcenter
|
||||
@test p[1][:legend_title_font_rotation] == 0.0
|
||||
@test p[1][:legend_title_font_color] == RGB{Colors.N0f8}(0.0, 0.0, 0.0)
|
||||
@test p[1][:legend_background_color] == RGBA{Float64}(1.0, 1.0, 1.0, 1.0)
|
||||
@test p[1][:legend_foreground_color] == RGB{Colors.N0f8}(0.0, 0.0, 0.0)
|
||||
end # testset
|
||||
|
||||
@testset "Legend API" begin
|
||||
p = plot(;
|
||||
legendfontfamily = "serif",
|
||||
legendfontsize = 12,
|
||||
legendfonthalign = :left,
|
||||
legendfontvalign = :top,
|
||||
legendfontrotation = 1,
|
||||
legendfontcolor = :red,
|
||||
legend = :outertopleft,
|
||||
legendtitle = "The legend",
|
||||
legendtitlefontfamily = "helvetica",
|
||||
legendtitlefontsize = 3,
|
||||
legendtitlefonthalign = :right,
|
||||
legendtitlefontvalign = :bottom,
|
||||
legendtitlefontrotation = -5.2,
|
||||
legendtitlefontcolor = :blue,
|
||||
background_color_legend = :cyan,
|
||||
foreground_color_legend = :green,
|
||||
)
|
||||
@test p[1][:legend_font_family] == "serif"
|
||||
@test p[1][:legend_font_pointsize] == 12
|
||||
@test p[1][:legend_font_halign] == :left
|
||||
@test p[1][:legend_font_valign] == :top
|
||||
@test p[1][:legend_font_rotation] == 1.0
|
||||
@test p[1][:legend_font_color] == :red
|
||||
@test p[1][:legend_position] == :outertopleft
|
||||
@test p[1][:legend_title] == "The legend"
|
||||
@test p[1][:legend_title_font_family] == "helvetica"
|
||||
@test p[1][:legend_title_font_pointsize] == 3
|
||||
@test p[1][:legend_title_font_halign] == :right
|
||||
@test p[1][:legend_title_font_valign] == :bottom
|
||||
@test p[1][:legend_title_font_rotation] == -5.2
|
||||
@test p[1][:legend_title_font_color] == :blue
|
||||
@test p[1][:legend_background_color] == RGBA{Float64}(0.0, 1.0, 1.0, 1.0)
|
||||
@test p[1][:legend_foreground_color] == RGBA{Float64}(0.0, 0.5019607843137255, 0.0, 1.0)
|
||||
|
||||
#setting whole font
|
||||
sp = plot(
|
||||
1:5,
|
||||
legendfont = font(12),
|
||||
legend_font_halign = :left,
|
||||
foreground_color_subplot = :red,
|
||||
)[1]
|
||||
@test Plots.legendfont(sp).pointsize == 12
|
||||
@test Plots.legendfont(sp).halign == :left
|
||||
# match mechanism
|
||||
@test sp[:legend_font_color] == sp[:foreground_color_subplot]
|
||||
@test Plots.legendfont(sp).color == sp[:foreground_color_subplot]
|
||||
end # testset
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
using Plots, Test
|
||||
using OffsetArrays
|
||||
|
||||
@testset "User recipes" begin
|
||||
struct LegendPlot end
|
||||
@recipe function f(plot::LegendPlot)
|
||||
legend --> :topleft
|
||||
(1:3, 1:3)
|
||||
end
|
||||
pl = plot(LegendPlot(); legend = :right)
|
||||
@test pl[1][:legend_position] == :right
|
||||
pl = plot(LegendPlot())
|
||||
@test pl[1][:legend_position] == :topleft
|
||||
end
|
||||
|
||||
@testset "lens!" begin
|
||||
pl = plot(1:5)
|
||||
lens!(pl, [1, 2], [1, 2], inset = (1, bbox(0.0, 0.0, 0.2, 0.2)), colorbar = false)
|
||||
|
||||
Reference in New Issue
Block a user