Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/reference_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
repository: "JuliaPlots/PlotReferenceImages.jl"
token: ${{ secrets.PLOTS_REFIMAGES_TOKEN }}
path: PlotReferenceImages
- uses: actions/checkout@v5
with:
path: Plots
- uses: julia-actions/setup-julia@latest
with:
version: 1
Expand All @@ -22,13 +27,23 @@ jobs:
env:
PLOTSBASE_TEST_PACKAGES: GR
VISUAL_REGRESSION_TESTS_AUTO: true
shell: julia --color=yes --project=@. {0}
shell: julia --color=yes --project=Plots {0}
run: |
using Pkg
Pkg.test("PlotsBase")
- name: Diagnostics
run: |
ls
cd PlotReferenceImages
cp -r ~/.julia/dev/PlotReferenceImages.jl/* .
ls
git status
- 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."
title: "Update Plot reference images from branch ${{ github.ref_name}} by the action ${{ github.action }}"
body: "Review changes thoroughly and only merge when no unwanted changes are present."
path: PlotReferenceImages
token: ${{ secrets.PLOTS_REFIMAGES_TOKEN }}
branch: "${{ github.ref_name}}"
base: "master"
6 changes: 2 additions & 4 deletions PlotsBase/ext/PythonPlotExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ function _py_add_series(plt::Plot{PythonPlotBackend}, series::Series)
end

if st ≡ :shape
for segment in series_segments(series)
for segment in series_segments(series, st)
i, rng = segment.attr_index, segment.range
if length(rng) > 1
lc = get_linecolor(series, clims, i, cbar_scale)
Expand All @@ -660,8 +660,6 @@ function _py_add_series(plt::Plot{PythonPlotBackend}, series::Series)
has_fs = !isnothing(fs)

path = mpl.path.Path(hcat(x[rng], y[rng]))
# FIXME: path can be un-filled e.g. ex 56,
# where rectangles are created using 4 paths instead of a single one

# shape outline (and potentially solid fill)
mpl.patches.PathPatch(
Expand Down Expand Up @@ -900,7 +898,7 @@ function _py_add_series(plt::Plot{PythonPlotBackend}, series::Series)

# handle area filling
if (fillrange = series[:fillrange]) ≢ nothing && st ≢ :contour
for segment in series_segments(series)
for segment in series_segments(series, st)
i, rng = segment.attr_index, segment.range
f, dim1, dim2 = :fill_between, x[rng], y[rng]
n = length(dim1)
Expand Down
14 changes: 6 additions & 8 deletions PlotsBase/src/DataSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,21 +274,19 @@ function series_segments(series::Series, seriestype::Symbol = :path; check = fal
end

segments = if has_attribute_segments(series)
map(nan_segments) do r
(
if seriestype ≡ :shape
warn_on_inconsistent_shape_attrs(series, x, y, z, r)
(SeriesSegment(r, first(r)),)
(SeriesSegment(segment, j),)
elseif seriestype in (:scatter, :scatter3d)
(SeriesSegment(i:i, i) for i in r)
(SeriesSegment(i:i, i) for i in segment)
else
(SeriesSegment(i:(i + 1), i) for i in first(r):(last(r) - 1))
end
end |> Iterators.flatten
(SeriesSegment(i:(i + 1), i) for i in first(segment):(last(segment) - 1))
end for (j, segment) in enumerate(nan_segments)
) |> Iterators.flatten
else
(SeriesSegment(r, 1) for r in nan_segments)
end

warn_on_attr_dim_mismatch(series, x, y, z, segments)
return segments
end

Expand Down
5 changes: 1 addition & 4 deletions PlotsBase/src/plotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -930,12 +930,9 @@ function plotly_colorbar(sp::Subplot)
end

function plotly_series_shapes(plt::Plot, series::Series, clims)
segments = series_segments(series; check = true)
segments = collect(series_segments(series, series[:seriestype]; check = true))
plotattributes_outs = map(i -> KW(), 1:length(segments))

# TODO: create a plotattributes_out for each polygon
# x, y = series[:x], series[:y]

# these are the axes that the series should be mapped to
x_idx, y_idx = plotly_link_indices(plt, series[:subplot])
plotattributes_base = KW(
Expand Down
12 changes: 0 additions & 12 deletions PlotsBase/src/recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -487,18 +487,6 @@ 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
if (v = get(plotattributes, k, nothing)) isa AVec
if eachindex(v) != eachindex(y)
@maxlog_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.
# One segment is created for each non-NaN element of `procy`.
# There is no trailing NaN, so the last repetition is dropped.
plotattributes[k] = @views repeat(v[valid_i]; inner = 6)[1:(end - 1)]
end
end
()
end

Expand Down
11 changes: 5 additions & 6 deletions PlotsBase/test/test_backends.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ is_pkgeval() || @testset "PlotlyJS" begin
end
end

is_pkgeval() || @testset "Backends" begin
is_pkgeval() || @testset "Backends $be" for be in TEST_BACKENDS
callback(mod, pkgname, i) = begin
save_func = (; pgfplotsx = mod.PlotsBase.pdf, unicodeplots = mod.PlotsBase.txt) # fastest `savefig` for each backend
pl = mod.PlotsBase.current()
Expand All @@ -65,9 +65,8 @@ is_pkgeval() || @testset "Backends" begin
)
@test filesize(fn) > 1_000
end
(Sys.islinux() && is_latest("release")) && for be in TEST_BACKENDS
skip = vcat(PlotsBase._backend_skips[be], skipped_examples, broken_examples)
PlotsBase.test_examples(be; skip, callback, disp = is_ci(), strict = true) # `ci` display for coverage
closeall()
end
!(Sys.islinux() && is_latest("release")) && continue
skip = vcat(PlotsBase._backend_skips[be], skipped_examples, broken_examples)
PlotsBase.test_examples(be; skip, callback, disp = is_ci(), strict = true) # `ci` display for coverage
closeall()
end
Loading