From 68e2173870eb922fbd4357625f61d83daaffabe9 Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Thu, 18 Jul 2024 15:47:43 +0900 Subject: [PATCH 1/7] do not plot legend upon single series default to not put autolabelling --- PlotsBase/src/Commons/attrs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PlotsBase/src/Commons/attrs.jl b/PlotsBase/src/Commons/attrs.jl index 48da09c12..ded55b6fe 100644 --- a/PlotsBase/src/Commons/attrs.jl +++ b/PlotsBase/src/Commons/attrs.jl @@ -323,7 +323,7 @@ const _bar_width = 0.8 # ----------------------------------------------------------------------------- const _series_defaults = KW( - :label => :auto, + :label => :none, :colorbar_entry => true, :seriescolor => :auto, :seriesalpha => nothing, From 1d1a03447e2342238e79641bb43d1848ade395ad Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Thu, 25 Jul 2024 13:58:00 +0900 Subject: [PATCH 2/7] fix test --- PlotsBase/test/test_misc.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PlotsBase/test/test_misc.jl b/PlotsBase/test/test_misc.jl index 06f594cef..f63fb7e03 100644 --- a/PlotsBase/test/test_misc.jl +++ b/PlotsBase/test/test_misc.jl @@ -336,7 +336,7 @@ with(:gr) do @test plot([0:1 reverse(0:1)]; labels = ["a" "b"], leg = (0.5, :inner)) isa PlotsBase.Plot @test_logs (:warn, r"n° of legend_column.*") png( - plot(1:2, legend_columns = 10), + plot(1:2, legend_columns = 10, label=:auto), tempname(), ) end From d0b917a5a108481f1d34cefa77ad464f08c8d3b9 Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Thu, 25 Jul 2024 14:39:39 +0900 Subject: [PATCH 3/7] fix other tests --- PlotsBase/test/test_args.jl | 10 +++++----- PlotsBase/test/test_pgfplotsx.jl | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/PlotsBase/test/test_args.jl b/PlotsBase/test/test_args.jl index 99c52997e..f15634fdf 100644 --- a/PlotsBase/test/test_args.jl +++ b/PlotsBase/test/test_args.jl @@ -33,12 +33,12 @@ end end @testset "Series Attributes" begin - pl = plot([[1, 2, 3], [2, 3, 4]], lw = 5) - @test hline!(deepcopy(pl), [1.75])[1].series_list[3][:label] == - hline!(deepcopy(pl), [1.75], z_order = :front)[1].series_list[3][:label] == + pl = plot([[1, 2, 3], [2, 3, 4]], lw = 5, label=:auto) + @test hline!(deepcopy(pl), [1.75], label=:auto)[1].series_list[3][:label] == + hline!(deepcopy(pl), [1.75], z_order = :front, label=:auto)[1].series_list[3][:label] == "y3" - @test hline!(deepcopy(pl), [1.75], z_order = :back)[1].series_list[1][:label] == "y3" - @test hline!(deepcopy(pl), [1.75], z_order = 2)[1].series_list[2][:label] == "y3" + @test hline!(deepcopy(pl), [1.75], z_order = :back, label=:auto)[1].series_list[1][:label] == "y3" + @test hline!(deepcopy(pl), [1.75], z_order = 2, label=:auto)[1].series_list[2][:label] == "y3" sp = pl[1] @test isempty(sp[1][:extra_kwargs]) @test sp[2][:series_index] == 2 diff --git a/PlotsBase/test/test_pgfplotsx.jl b/PlotsBase/test/test_pgfplotsx.jl index af51bde12..552d428d5 100644 --- a/PlotsBase/test/test_pgfplotsx.jl +++ b/PlotsBase/test/test_pgfplotsx.jl @@ -28,7 +28,7 @@ with(:pgfplotsx) do @testset "Legends" begin pl = plot(rand(5, 2), lab = ["1" ""], arrow = true) - scatter!(pl, rand(5)) + scatter!(pl, rand(5), label=:auto) axis_contents = first(get_pgf_axes(pl)).contents leg_entries = filter(x -> x isa PGFPlotsX.LegendEntry, axis_contents) series = filter(x -> x isa PGFPlotsX.Plot, axis_contents) @@ -93,8 +93,8 @@ with(:pgfplotsx) do end @testset "Plot in pieces" begin - pl = plot(rand(100) / 3, reg = true, fill = (0, :green)) - scatter!(pl, rand(100), markersize = 6, c = :orange) + pl = plot(rand(100) / 3, reg = true, fill = (0, :green), label=:auto) + scatter!(pl, rand(100), markersize = 6, c = :orange, label=:auto) axis_contents = first(get_pgf_axes(pl)).contents leg_entries = filter(x -> x isa PGFPlotsX.LegendEntry, axis_contents) series = filter(x -> x isa PGFPlotsX.Plot, axis_contents) From a59929733ab64de8f2f1f518237c20e633a012f6 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Wed, 2 Apr 2025 14:54:58 +0200 Subject: [PATCH 4/7] add referende images workflow --- .github/workflows/reference_images.yml | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/reference_images.yml diff --git a/.github/workflows/reference_images.yml b/.github/workflows/reference_images.yml new file mode 100644 index 000000000..dd7eb14ac --- /dev/null +++ b/.github/workflows/reference_images.yml @@ -0,0 +1,44 @@ +name: Update reference images + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + repository: JuliaPlots/PlotDocs.jl + token: ${{ secrets.PLOTS_REFIMAGES_TOKEN }} + - uses: julia-actions/setup-julia@latest + with: + version: "1" + - name: Cache artifacts + uses: actions/cache@v4 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{runner.os}}-test-${{env.cache-name}}-${{hashFiles('**/Project.toml')}} + restore-keys: | + ${{runner.os}}-test-${{env.cache-name}}- + ${{runner.os}}-test- + ${{runner.os}}- + - name: Run Plots tests + env: + PLOTSBASE_TEST_PACKAGES: GR + VISUAL_REGRESSION_TESTS_AUTO: true + shell: julia --color=yes {0} + run: | + using Pkg + gh_ref = ${{ github.ref_name }} + @info "Adding Plots#$gh_ref" + Pkg.add(PackageSpec(name="Plots", rev="$gh_ref")) + Pkg.test("Plots") + - name: Create pull request + uses: peter-evans/create-pull-request@v7 + with: + title: "Update Plot reference images from branch ${{ github.ref_name}} by the action ${{ github.workflow_ref }}" + body: "Review changes thoroughly and only merge when no unwanted chages are present." + token: ${{ secrets.PLOTS_REFIMAGES_TOKEN }} From 37812a8c2a6d52570e3ee7d59dd1325dba8c7ecd Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Wed, 2 Apr 2025 15:22:43 +0200 Subject: [PATCH 5/7] add News entry --- NEWS.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index dc901e858..7d35a95d7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,15 +8,18 @@ - deprecated backends `pgfplots` and `pyplot` removed - deprecated keyword `orientation` removed -- backends are extensions now so the backend code must be explicitly loaded using `import` with the backend package, e.g. ```julia -using Plots -import GR # loads backend code +- backends are extensions now so the backend code must be explicitly loaded using `import` with the backend package, e.g. + ```julia + using Plots + import GR # loads backend code -``` + ``` - Types are no longer part of the Plots API this affects - `Shape`, which is now `shape` +- The default `label` is now `:none`, use `:auto` to restore the previous behaviour --- + #### notes on release changes, ongoing development, and future planned work ## NOTE: this file is deprecated, see the [TagBot](https://github.com/marketplace/actions/julia-tagbot) auto-generated changelogs instead From 4b1d97d6c5ff94b0212a3322975d460d7307cdbd Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Thu, 8 May 2025 17:21:49 +0200 Subject: [PATCH 6/7] formatting --- GraphRecipes/test/runtests.jl | 22 +++++++++++----------- PlotsBase/ext/GRExt.jl | 2 +- PlotsBase/ext/GastonExt.jl | 5 ++--- PlotsBase/ext/UnitfulExt.jl | 9 ++------- PlotsBase/src/Commons/Commons.jl | 8 +++++--- PlotsBase/src/DF.jl | 2 +- PlotsBase/src/plotly.jl | 25 ++++++++++++++----------- PlotsBase/src/recipes.jl | 6 ++---- PlotsBase/test/test_args.jl | 12 +++++++----- PlotsBase/test/test_misc.jl | 2 +- PlotsBase/test/test_pgfplotsx.jl | 6 +++--- StatsPlots/src/corrplot.jl | 2 +- StatsPlots/src/hist.jl | 6 ++---- 13 files changed, 52 insertions(+), 55 deletions(-) diff --git a/GraphRecipes/test/runtests.jl b/GraphRecipes/test/runtests.jl index 14b5019b1..9dc5ce0c8 100644 --- a/GraphRecipes/test/runtests.jl +++ b/GraphRecipes/test/runtests.jl @@ -30,23 +30,23 @@ default(show = false, reuse = true) method ≡ :spectral && continue # FIXME dat = if (inp = GraphRecipes._graph_inputs[method]) ≡ :adjmat [ - 0 1 1; - 1 0 1; + 0 1 1 + 1 0 1 1 1 0 ] elseif inp ≡ :sourcedestiny Symmetric(sparse(rand(rng, 0:1, 8, 8))) elseif inp ≡ :adjlist dat = [ - 0 1 1 0 0 0 0 0 0 0; - 0 0 0 0 1 1 0 0 0 0; - 0 0 0 1 0 0 1 0 1 0; - 0 0 0 0 0 0 0 0 0 0; - 0 0 0 0 0 0 0 1 0 1; - 0 0 0 0 0 0 0 0 0 0; - 0 0 0 0 0 0 0 0 0 0; - 0 0 0 0 0 0 0 0 0 0; - 0 0 0 0 0 0 0 0 0 0; + 0 1 1 0 0 0 0 0 0 0 + 0 0 0 0 1 1 0 0 0 0 + 0 0 0 1 0 0 1 0 1 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 1 0 1 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] else diff --git a/PlotsBase/ext/GRExt.jl b/PlotsBase/ext/GRExt.jl index 9ef09b452..2cf959aec 100644 --- a/PlotsBase/ext/GRExt.jl +++ b/PlotsBase/ext/GRExt.jl @@ -2033,7 +2033,7 @@ function gr_draw_segments(series, x, y, z, fillrange, clims) series[:arrow] isa Arrow ? series[:arrow] : Arrow(:none, :simple, 1.0, 1.0) arrowside, arrowstyle, arrowsize = - arrow.side, arrow.style, (arrow.headlength+arrow.headwidth)/2 + arrow.side, arrow.style, (arrow.headlength + arrow.headwidth) / 2 gr_polyline(x[rng], y[rng]; arrowside, arrowstyle, arrowsize) end diff --git a/PlotsBase/ext/GastonExt.jl b/PlotsBase/ext/GastonExt.jl index f3ccc5690..3e5b74a2c 100644 --- a/PlotsBase/ext/GastonExt.jl +++ b/PlotsBase/ext/GastonExt.jl @@ -801,9 +801,8 @@ gaston_palette(gradient) = '(' * join(palette, ", ") * ')' end -gaston_palette_conf( - series, -) = "; set palette model RGB defined $(gaston_palette(series[:seriescolor]))" +gaston_palette_conf(series) = + "; set palette model RGB defined $(gaston_palette(series[:seriescolor]))" function gaston_marker(marker, alpha) # NOTE: :rtriangle, :ltriangle, :hexagon, :heptagon, :octagon seems unsupported by gnuplot diff --git a/PlotsBase/ext/UnitfulExt.jl b/PlotsBase/ext/UnitfulExt.jl index a59d3981b..a54f5eb06 100644 --- a/PlotsBase/ext/UnitfulExt.jl +++ b/PlotsBase/ext/UnitfulExt.jl @@ -85,13 +85,8 @@ end axisletter = plotattributes[:letter] # x, y, or z unitsymbol = Symbol(axisletter, :unit) axisunit = pop!(plotattributes, unitsymbol, _unit(eltype(first(x)))) - map( - x -> ( - plotattributes[unitsymbol] = axisunit; - fixaxis!(plotattributes, x, axisletter) - ), - x, - ) + map(x -> (plotattributes[unitsymbol] = axisunit; + fixaxis!(plotattributes, x, axisletter)), x) end # Recipe for bare units diff --git a/PlotsBase/src/Commons/Commons.jl b/PlotsBase/src/Commons/Commons.jl index 2b707b86f..ff33b4868 100644 --- a/PlotsBase/src/Commons/Commons.jl +++ b/PlotsBase/src/Commons/Commons.jl @@ -133,13 +133,15 @@ all_styles(arg) = true_or_all_true(a -> get(Commons._styleAliases, a, a) in Commons._all_styles, arg) all_shapes(arg) = true_or_all_true( a -> - get(Commons._marker_aliases, a, a) in Commons._all_markers || a isa PlotsBase.Shape, + get(Commons._marker_aliases, a, a) in Commons._all_markers || + a isa PlotsBase.Shape, arg, ) all_alphas(arg) = true_or_all_true( a -> - (typeof(a) <: Real && a > 0 && a < 1) || - (typeof(a) <: AbstractFloat && (a == zero(typeof(a)) || a == one(typeof(a)))), + (typeof(a) <: Real && a > 0 && a < 1) || ( + typeof(a) <: AbstractFloat && (a == zero(typeof(a)) || a == one(typeof(a))) + ), arg, ) all_reals(arg) = true_or_all_true(a -> typeof(a) <: Real, arg) diff --git a/PlotsBase/src/DF.jl b/PlotsBase/src/DF.jl index 31f2528c4..0101055b7 100644 --- a/PlotsBase/src/DF.jl +++ b/PlotsBase/src/DF.jl @@ -105,7 +105,7 @@ function parse_table_call!(d, x::Expr, syms, vars) new_ex = Expr(:tuple, x.args...) for (j, field_in_NT) ∈ enumerate(new_ex.args) - if isa(field_in_NT, Expr) && field_in_NT.head==:(=) + if isa(field_in_NT, Expr) && field_in_NT.head == :(=) new_ex.args[j] = Expr(:(=), field_in_NT.args...) elseif field_in_NT isa QuoteNode new_ex.args[j] = Expr(:(=), field_in_NT.value, field_in_NT) diff --git a/PlotsBase/src/plotly.jl b/PlotsBase/src/plotly.jl index 164887cc9..f927ace8f 100644 --- a/PlotsBase/src/plotly.jl +++ b/PlotsBase/src/plotly.jl @@ -895,16 +895,21 @@ function plotly_series(plt::Plot, series::Series) get_plotly_marker(series[:markershape], string(series[:markershape])), # :opacity => series[:markeralpha], :size => 2_cycle(series[:markersize], inds), - :color => rgba_string.( - plot_color.(get_markercolor.(series, inds), get_markeralpha.(series, inds)), - ), - :line => KW( - :color => rgba_string.( + :color => + rgba_string.( plot_color.( - get_markerstrokecolor.(series, inds), - get_markerstrokealpha.(series, inds), + get_markercolor.(series, inds), + get_markeralpha.(series, inds), ), ), + :line => KW( + :color => + rgba_string.( + plot_color.( + get_markerstrokecolor.(series, inds), + get_markerstrokealpha.(series, inds), + ), + ), :width => _cycle(series[:markerstrokewidth], inds), ), ) @@ -1290,10 +1295,8 @@ function plotly_html_body(plt, style = nothing) html end -js_body( - plt::Plot, - uuid, -) = "Plotly.newPlot('$(uuid)', $(plotly_series_json(plt)), $(plotly_layout_json(plt)));" +js_body(plt::Plot, uuid) = + "Plotly.newPlot('$(uuid)', $(plotly_series_json(plt)), $(plotly_layout_json(plt)));" plotly_show_js(io::IO, plot::Plot) = JSON.print(io, Dict(:data => plotly_series(plot), :layout => plotly_layout(plot))) diff --git a/PlotsBase/src/recipes.jl b/PlotsBase/src/recipes.jl index d4f0c75fa..8b6688eb5 100644 --- a/PlotsBase/src/recipes.jl +++ b/PlotsBase/src/recipes.jl @@ -728,10 +728,8 @@ function _auto_binning_nbins( ) where {N} max_bins = 10_000 _cl(x) = min(ceil(Int, max(x, one(x))), max_bins) - _iqr(v) = ( - q = Statistics.quantile(v, 0.75) - Statistics.quantile(v, 0.25); - q > 0 ? q : oftype(q, 1) - ) + _iqr(v) = (q = Statistics.quantile(v, 0.75) - Statistics.quantile(v, 0.25); + q > 0 ? q : oftype(q, 1)) _span(v) = maximum(v) - minimum(v) n_samples = length(LinearIndices(first(vs))) diff --git a/PlotsBase/test/test_args.jl b/PlotsBase/test/test_args.jl index f15634fdf..91f2b45cc 100644 --- a/PlotsBase/test/test_args.jl +++ b/PlotsBase/test/test_args.jl @@ -33,12 +33,14 @@ end end @testset "Series Attributes" begin - pl = plot([[1, 2, 3], [2, 3, 4]], lw = 5, label=:auto) - @test hline!(deepcopy(pl), [1.75], label=:auto)[1].series_list[3][:label] == - hline!(deepcopy(pl), [1.75], z_order = :front, label=:auto)[1].series_list[3][:label] == + pl = plot([[1, 2, 3], [2, 3, 4]], lw = 5, label = :auto) + @test hline!(deepcopy(pl), [1.75], label = :auto)[1].series_list[3][:label] == + hline!(deepcopy(pl), [1.75], z_order = :front, label = :auto)[1].series_list[3][:label] == + "y3" + @test hline!(deepcopy(pl), [1.75], z_order = :back, label = :auto)[1].series_list[1][:label] == + "y3" + @test hline!(deepcopy(pl), [1.75], z_order = 2, label = :auto)[1].series_list[2][:label] == "y3" - @test hline!(deepcopy(pl), [1.75], z_order = :back, label=:auto)[1].series_list[1][:label] == "y3" - @test hline!(deepcopy(pl), [1.75], z_order = 2, label=:auto)[1].series_list[2][:label] == "y3" sp = pl[1] @test isempty(sp[1][:extra_kwargs]) @test sp[2][:series_index] == 2 diff --git a/PlotsBase/test/test_misc.jl b/PlotsBase/test/test_misc.jl index ca7fb1691..57f7f2c13 100644 --- a/PlotsBase/test/test_misc.jl +++ b/PlotsBase/test/test_misc.jl @@ -329,7 +329,7 @@ with(:gr) do @test plot([0:1 reverse(0:1)]; labels = ["a" "b"], leg = (0.5, :inner)) isa PlotsBase.Plot @test_logs (:warn, r"n° of legend_column.*") png( - plot(1:2, legend_columns = 10, label=:auto), + plot(1:2, legend_columns = 10, label = :auto), tempname(), ) end diff --git a/PlotsBase/test/test_pgfplotsx.jl b/PlotsBase/test/test_pgfplotsx.jl index e888a9c7f..d8c6adb66 100644 --- a/PlotsBase/test/test_pgfplotsx.jl +++ b/PlotsBase/test/test_pgfplotsx.jl @@ -28,7 +28,7 @@ with(:pgfplotsx) do @testset "Legends" begin pl = plot(rand(5, 2), lab = ["1" ""], arrow = true) - scatter!(pl, rand(5), label=:auto) + scatter!(pl, rand(5), label = :auto) axis_contents = first(get_pgf_axes(pl)).contents leg_entries = filter(x -> x isa PGFPlotsX.LegendEntry, axis_contents) series = filter(x -> x isa PGFPlotsX.Plot, axis_contents) @@ -93,8 +93,8 @@ with(:pgfplotsx) do end @testset "Plot in pieces" begin - pl = plot(rand(100) / 3, reg = true, fill = (0, :green), label=:auto) - scatter!(pl, rand(100), markersize = 6, c = :orange, label=:auto) + pl = plot(rand(100) / 3, reg = true, fill = (0, :green), label = :auto) + scatter!(pl, rand(100), markersize = 6, c = :orange, label = :auto) axis_contents = first(get_pgf_axes(pl)).contents leg_entries = filter(x -> x isa PGFPlotsX.LegendEntry, axis_contents) series = filter(x -> x isa PGFPlotsX.Plot, axis_contents) diff --git a/StatsPlots/src/corrplot.jl b/StatsPlots/src/corrplot.jl index 708630b00..8e7157205 100644 --- a/StatsPlots/src/corrplot.jl +++ b/StatsPlots/src/corrplot.jl @@ -55,7 +55,7 @@ end linecolor --> PlotsBase.fg_color(plotattributes) markeralpha := 0.4 grad = cgrad(get(plotattributes, :markercolor, :RdYlBu)) - indices = reshape(1:(n ^ 2), n, n)' + indices = reshape(1:(n^2), n, n)' title = get(plotattributes, :title, "") title_location = get(plotattributes, :title_location, :center) title := "" diff --git a/StatsPlots/src/hist.jl b/StatsPlots/src/hist.jl index aeccae632..02a1aea0a 100644 --- a/StatsPlots/src/hist.jl +++ b/StatsPlots/src/hist.jl @@ -130,10 +130,8 @@ end # Ported from R code located here https://github.com/cran/KernSmooth/tree/master/R "Returns optimal histogram edge positions in accordance to Wand (1995)'s criterion'" -PlotsBase.wand_edges(x::AbstractVector, args...) = ( - binwidth = wand_bins(x, args...); - (minimum(x) - binwidth):binwidth:(maximum(x) + binwidth) -) +PlotsBase.wand_edges(x::AbstractVector, args...) = (binwidth = wand_bins(x, args...); +(minimum(x) - binwidth):binwidth:(maximum(x) + binwidth)) "Returns optimal histogram bin widths in accordance to Wand (1995)'s criterion'" function wand_bins(x, scalest = :minim, gridsize = 401, range_x = extrema(x), t_run = true) From 9d7df083f0acd922d95f48381132e547e2457d69 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Thu, 8 May 2025 17:34:30 +0200 Subject: [PATCH 7/7] format with newer version --- PlotsBase/ext/GastonExt.jl | 5 +++-- PlotsBase/ext/UnitfulExt.jl | 9 +++++++-- PlotsBase/src/Commons/Commons.jl | 8 +++----- PlotsBase/src/plotly.jl | 25 +++++++++++-------------- PlotsBase/src/recipes.jl | 6 ++++-- StatsPlots/src/corrplot.jl | 2 +- StatsPlots/src/hist.jl | 6 ++++-- 7 files changed, 33 insertions(+), 28 deletions(-) diff --git a/PlotsBase/ext/GastonExt.jl b/PlotsBase/ext/GastonExt.jl index 3e5b74a2c..f3ccc5690 100644 --- a/PlotsBase/ext/GastonExt.jl +++ b/PlotsBase/ext/GastonExt.jl @@ -801,8 +801,9 @@ gaston_palette(gradient) = '(' * join(palette, ", ") * ')' end -gaston_palette_conf(series) = - "; set palette model RGB defined $(gaston_palette(series[:seriescolor]))" +gaston_palette_conf( + series, +) = "; set palette model RGB defined $(gaston_palette(series[:seriescolor]))" function gaston_marker(marker, alpha) # NOTE: :rtriangle, :ltriangle, :hexagon, :heptagon, :octagon seems unsupported by gnuplot diff --git a/PlotsBase/ext/UnitfulExt.jl b/PlotsBase/ext/UnitfulExt.jl index a54f5eb06..a59d3981b 100644 --- a/PlotsBase/ext/UnitfulExt.jl +++ b/PlotsBase/ext/UnitfulExt.jl @@ -85,8 +85,13 @@ end axisletter = plotattributes[:letter] # x, y, or z unitsymbol = Symbol(axisletter, :unit) axisunit = pop!(plotattributes, unitsymbol, _unit(eltype(first(x)))) - map(x -> (plotattributes[unitsymbol] = axisunit; - fixaxis!(plotattributes, x, axisletter)), x) + map( + x -> ( + plotattributes[unitsymbol] = axisunit; + fixaxis!(plotattributes, x, axisletter) + ), + x, + ) end # Recipe for bare units diff --git a/PlotsBase/src/Commons/Commons.jl b/PlotsBase/src/Commons/Commons.jl index ff33b4868..2b707b86f 100644 --- a/PlotsBase/src/Commons/Commons.jl +++ b/PlotsBase/src/Commons/Commons.jl @@ -133,15 +133,13 @@ all_styles(arg) = true_or_all_true(a -> get(Commons._styleAliases, a, a) in Commons._all_styles, arg) all_shapes(arg) = true_or_all_true( a -> - get(Commons._marker_aliases, a, a) in Commons._all_markers || - a isa PlotsBase.Shape, + get(Commons._marker_aliases, a, a) in Commons._all_markers || a isa PlotsBase.Shape, arg, ) all_alphas(arg) = true_or_all_true( a -> - (typeof(a) <: Real && a > 0 && a < 1) || ( - typeof(a) <: AbstractFloat && (a == zero(typeof(a)) || a == one(typeof(a))) - ), + (typeof(a) <: Real && a > 0 && a < 1) || + (typeof(a) <: AbstractFloat && (a == zero(typeof(a)) || a == one(typeof(a)))), arg, ) all_reals(arg) = true_or_all_true(a -> typeof(a) <: Real, arg) diff --git a/PlotsBase/src/plotly.jl b/PlotsBase/src/plotly.jl index f927ace8f..164887cc9 100644 --- a/PlotsBase/src/plotly.jl +++ b/PlotsBase/src/plotly.jl @@ -895,21 +895,16 @@ function plotly_series(plt::Plot, series::Series) get_plotly_marker(series[:markershape], string(series[:markershape])), # :opacity => series[:markeralpha], :size => 2_cycle(series[:markersize], inds), - :color => - rgba_string.( + :color => rgba_string.( + plot_color.(get_markercolor.(series, inds), get_markeralpha.(series, inds)), + ), + :line => KW( + :color => rgba_string.( plot_color.( - get_markercolor.(series, inds), - get_markeralpha.(series, inds), + get_markerstrokecolor.(series, inds), + get_markerstrokealpha.(series, inds), ), ), - :line => KW( - :color => - rgba_string.( - plot_color.( - get_markerstrokecolor.(series, inds), - get_markerstrokealpha.(series, inds), - ), - ), :width => _cycle(series[:markerstrokewidth], inds), ), ) @@ -1295,8 +1290,10 @@ function plotly_html_body(plt, style = nothing) html end -js_body(plt::Plot, uuid) = - "Plotly.newPlot('$(uuid)', $(plotly_series_json(plt)), $(plotly_layout_json(plt)));" +js_body( + plt::Plot, + uuid, +) = "Plotly.newPlot('$(uuid)', $(plotly_series_json(plt)), $(plotly_layout_json(plt)));" plotly_show_js(io::IO, plot::Plot) = JSON.print(io, Dict(:data => plotly_series(plot), :layout => plotly_layout(plot))) diff --git a/PlotsBase/src/recipes.jl b/PlotsBase/src/recipes.jl index 8b6688eb5..d4f0c75fa 100644 --- a/PlotsBase/src/recipes.jl +++ b/PlotsBase/src/recipes.jl @@ -728,8 +728,10 @@ function _auto_binning_nbins( ) where {N} max_bins = 10_000 _cl(x) = min(ceil(Int, max(x, one(x))), max_bins) - _iqr(v) = (q = Statistics.quantile(v, 0.75) - Statistics.quantile(v, 0.25); - q > 0 ? q : oftype(q, 1)) + _iqr(v) = ( + q = Statistics.quantile(v, 0.75) - Statistics.quantile(v, 0.25); + q > 0 ? q : oftype(q, 1) + ) _span(v) = maximum(v) - minimum(v) n_samples = length(LinearIndices(first(vs))) diff --git a/StatsPlots/src/corrplot.jl b/StatsPlots/src/corrplot.jl index 8e7157205..708630b00 100644 --- a/StatsPlots/src/corrplot.jl +++ b/StatsPlots/src/corrplot.jl @@ -55,7 +55,7 @@ end linecolor --> PlotsBase.fg_color(plotattributes) markeralpha := 0.4 grad = cgrad(get(plotattributes, :markercolor, :RdYlBu)) - indices = reshape(1:(n^2), n, n)' + indices = reshape(1:(n ^ 2), n, n)' title = get(plotattributes, :title, "") title_location = get(plotattributes, :title_location, :center) title := "" diff --git a/StatsPlots/src/hist.jl b/StatsPlots/src/hist.jl index 02a1aea0a..aeccae632 100644 --- a/StatsPlots/src/hist.jl +++ b/StatsPlots/src/hist.jl @@ -130,8 +130,10 @@ end # Ported from R code located here https://github.com/cran/KernSmooth/tree/master/R "Returns optimal histogram edge positions in accordance to Wand (1995)'s criterion'" -PlotsBase.wand_edges(x::AbstractVector, args...) = (binwidth = wand_bins(x, args...); -(minimum(x) - binwidth):binwidth:(maximum(x) + binwidth)) +PlotsBase.wand_edges(x::AbstractVector, args...) = ( + binwidth = wand_bins(x, args...); + (minimum(x) - binwidth):binwidth:(maximum(x) + binwidth) +) "Returns optimal histogram bin widths in accordance to Wand (1995)'s criterion'" function wand_bins(x, scalest = :minim, gridsize = 401, range_x = extrema(x), t_run = true)