Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Feb 8, 2024
2 parents 3dd90ff + f92b260 commit b11f961
Show file tree
Hide file tree
Showing 31 changed files with 358 additions and 121 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/enforce_news.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Enforce changelog"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dangoslen/changelog-enforcer@v3
with:
changeLogPath: 'CHANGELOG.md'
skipLabels: 'skip-changelog'
154 changes: 110 additions & 44 deletions NEWS.md → CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions CairoMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CairoMakie"
uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
author = ["Simon Danisch <sdanisch@gmail.com>"]
version = "0.11.6"
version = "0.11.8"

[deps]
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
Expand All @@ -24,7 +24,7 @@ FileIO = "1.1"
FreeType = "3, 4.0"
GeometryBasics = "0.4.1"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.20.5"
Makie = "=0.20.7"
PrecompileTools = "1.0"
julia = "1.3"

Expand Down
9 changes: 1 addition & 8 deletions CairoMakie/src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,14 @@ function openurl(url::String)
@warn("Can't find a way to open a browser, open $(url) manually!")
end

function display_path(type::String)
if !(type in ("svg", "png", "pdf", "eps"))
error("Only \"svg\", \"png\", \"eps\" and \"pdf\" are allowed for `type`. Found: $(type)")
end
return abspath(joinpath(@__DIR__, "display." * type))
end

function Base.display(screen::Screen, scene::Scene; connect=false)
# Nothing to do, since drawing is done in the other functions
# TODO write to file and implement upenurl
return screen
end

function Base.display(screen::Screen{IMAGE}, scene::Scene; connect=false)
path = display_path("png")
path = joinpath(mktempdir(), "display.png")
Makie.push_screen!(scene, screen)
cairo_draw(screen, scene)
Cairo.write_to_png(screen.surface, path)
Expand Down
30 changes: 19 additions & 11 deletions CairoMakie/src/overrides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,36 @@ complex and slower to draw than standard paths with single color.
"""
function draw_plot(scene::Scene, screen::Screen, poly::Poly)
# dispatch on input arguments to poly to use smarter drawing methods than
# meshes if possible
return draw_poly(scene, screen, poly, to_value.(poly.args)...)
# meshes if possible.
# however, since recipes exist, we can't explicitly handle all cases here
# so, we should also take a look at converted
# First, we check whether a `draw_poly` method exists for the input arguments
# before conversion:
return if Base.hasmethod(draw_poly, Tuple{Scene, Screen, typeof(poly), typeof.(to_value.(poly.args))...})
draw_poly(scene, screen, poly, to_value.(poly.args)...)
# If not, we check whether a `draw_poly` method exists for the arguments after conversion
# (`plot.converted`). This allows anything which decomposes to be checked for.
elseif Base.hasmethod(draw_poly, Tuple{Scene, Screen, typeof(poly), typeof.(to_value.(poly.converted))...})
draw_poly(scene, screen, poly, to_value.(poly.converted)...)
# In the worst case, we return to drawing the polygon as a mesh + lines.
else
draw_poly_as_mesh(scene, screen, poly)
end
end

# Override `is_cairomakie_atomic_plot` to allow `poly` to remain a unit,
# instead of auto-decomposing in lines and mesh.
is_cairomakie_atomic_plot(plot::Poly) = true

"""
Fallback method for args without special treatment.
"""
function draw_poly(scene::Scene, screen::Screen, poly, args...)
draw_poly_as_mesh(scene, screen, poly)
end

function draw_poly_as_mesh(scene, screen, poly)
draw_plot(scene, screen, poly.plots[1])
draw_plot(scene, screen, poly.plots[2])
end


# in the rare case of per-vertex colors redirect to mesh drawing
function draw_poly(scene::Scene, screen::Screen, poly, points::Vector{<:Point2}, color::AbstractArray, model, strokecolor, strokewidth)
# As a general fallback, draw all polys as meshes.
# This also applies for e.g. per-vertex color.
function draw_poly(scene::Scene, screen::Screen, poly, points, color, model, strokecolor, strokestyle, strokewidth)
draw_poly_as_mesh(scene, screen, poly)
end

Expand Down Expand Up @@ -150,6 +157,7 @@ function polypath(ctx, polygon)
end

draw_poly(scene::Scene, screen::Screen, poly, polygon::Polygon) = draw_poly(scene, screen, poly, [polygon])
draw_poly(scene::Scene, screen::Screen, poly, multipolygon::MultiPolygon) = draw_poly(scene, screen, poly, multipolygon.polygons)
draw_poly(scene::Scene, screen::Screen, poly, circle::Circle) = draw_poly(scene, screen, poly, decompose(Point2f, circle))

function draw_poly(scene::Scene, screen::Screen, poly, polygons::AbstractArray{<:Polygon})
Expand Down
2 changes: 2 additions & 0 deletions CairoMakie/test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[deps]
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeoInterfaceMakie = "0edc0954-3250-4c18-859d-ec71c1660c08"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
ReferenceTests = "d37af2e0-5618-4e00-9939-d430db56ee94"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
11 changes: 6 additions & 5 deletions CairoMakie/test/rasterization_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function svg_has_image(x)
save(path, x)
# this is rough but an easy way to catch rasterization,
# if an image element is present in the svg
return !occursin("<image id=", read(path, String))
return occursin("<image id=", read(path, String))
end
end

Expand All @@ -18,13 +18,14 @@ end
pl = poly!(ax, Makie.GeometryBasics.Polygon(pts))

@testset "Unrasterized SVG" begin
@test svg_has_image(fig)
@test !svg_has_image(fig)
end

@testset "Rasterized SVG" begin
lp.rasterize = true
@test !svg_has_image(fig)
@test svg_has_image(fig)
lp.rasterize = 10
@test !svg_has_image(fig)
@test svg_has_image(fig)
end
end

end
15 changes: 15 additions & 0 deletions CairoMakie/test/svg_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ end
@test svg_isnt_rasterized(poly(BezierPath([
MoveTo(0.0, 0.0), LineTo(1.0, 0.0), LineTo(1.0, 1.0), CurveTo(1.0, 1.0, 0.5, 1.0, 0.5, 0.5), ClosePath()
])))
@test !svg_isnt_rasterized(poly(rand(Point2f, 10); color = rand(RGBAf, 10)))

poly1 = Makie.GeometryBasics.Polygon(rand(Point2f, 10))
@test svg_isnt_rasterized(poly(Makie.GeometryBasics.MultiPolygon([poly1, poly1])))
@test svg_isnt_rasterized(poly(Makie.GeometryBasics.MultiPolygon([poly1, poly1]), color = :red))
@test svg_isnt_rasterized(poly(Makie.GeometryBasics.MultiPolygon([poly1, poly1]), color = [:red, :blue]))

@testset "GeoInterface polygons" begin
using GeoInterface, GeoInterfaceMakie
poly2 = GeoInterface.convert(GeoInterface.Wrappers, poly1)
@test svg_isnt_rasterized(poly(poly2))
@test svg_isnt_rasterized(poly(poly2, color = :red))
@test svg_isnt_rasterized(poly(GeoInterface.Wrappers.MultiPolygon([poly2, poly2]), color = [:red, :blue]))
end

end

@testset "reproducable svg ids" begin
Expand Down
4 changes: 2 additions & 2 deletions GLMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "GLMakie"
uuid = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
version = "0.9.6"
version = "0.9.8"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down Expand Up @@ -30,7 +30,7 @@ FreeTypeAbstraction = "0.10"
GLFW = "3.3"
GeometryBasics = "0.4.1"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.20.5"
Makie = "=0.20.7"
Markdown = "1.0, 1.6"
MeshIO = "0.4"
ModernGL = "1"
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can find instructions to set that up in:
https://nextjournal.com/sdanisch/GLMakie-nogpu
And for a headless github action:

https://github.com/MakieOrg/Makie.jl/blob/master/.github/workflows/glmakie.yaml
https://github.com/MakieOrg/Makie.jl/blob/master/.github/workflows/reference_tests.yml
If none of these work for you, there is also a Cairo and WebGL backend
for Makie which you can use:

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Makie"
uuid = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
authors = ["Simon Danisch", "Julius Krumbiegel"]
version = "0.20.5"
version = "0.20.7"

[deps]
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Expand Down
8 changes: 4 additions & 4 deletions RPRMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RPRMakie"
uuid = "22d9f318-5e34-4b44-b769-6e3734a732a6"
authors = ["Simon Danisch"]
version = "0.6.5"
version = "0.6.7"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand All @@ -16,11 +16,11 @@ RadeonProRender = "27029320-176d-4a42-b57d-56729d2ad457"
Colors = "0.9, 0.10, 0.11, 0.12"
FileIO = "1.6"
GeometryBasics = "0.4.1"
Makie = "=0.20.5"
RadeonProRender = "0.3.0"
julia = "1.3"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.20.7"
Printf = "1.0, 1.6"
RadeonProRender = "0.3.0"
julia = "1.3"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
2 changes: 2 additions & 0 deletions ReferenceTests/src/tests/examples3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
moon = loadasset("moon.png")
fig, ax, meshplot = mesh(Sphere(Point3f(0), 1f0), color=moon, shading=NoShading, axis = (;show_axis=false))
update_cam!(ax.scene, Vec3f(-2, 2, 2), Vec3f(0))
cameracontrols(ax).settings.center[] = false # avoid recenter on display
fig
end

Expand Down Expand Up @@ -585,6 +586,7 @@ end
cam = cameracontrols(ax.scene)
cam.fov[] = 22f0
update_cam!(ax.scene, cam, Vec3f(0.625, 0, 3.5), Vec3f(0.625, 0, 0), Vec3f(0, 1, 0))
cameracontrols(ax).settings.center[] = false # avoid recenter on display
fig
end

Expand Down
25 changes: 23 additions & 2 deletions ReferenceTests/src/tests/figures_and_makielayout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ end
# https://github.com/MakieOrg/Makie.jl/issues/3579
@reference_test "Axis yticksmirrored" begin
f = Figure(size = (200, 200))
Axis(f[1, 1], yticksmirrored = true, yticksize = 10, ytickwidth = 4)
Axis(f[1, 1], yticksmirrored = true, yticksize = 10, ytickwidth = 4, spinewidth = 5)
Colorbar(f[1, 2])
f
end
@reference_test "Axis xticksmirrored" begin
f = Figure(size = (200, 200))
Axis(f[1, 1], xticksmirrored = true, xticksize = 10, xtickwidth = 4)
Axis(f[1, 1], xticksmirrored = true, xticksize = 10, xtickwidth = 4, spinewidth = 5)
Colorbar(f[0, 1], vertical = false)
f
end
Expand All @@ -147,6 +147,25 @@ end
end
end

@reference_test "Legend with scalar colors" begin
f = Figure()
ax = Axis(f[1, 1])
for i in 1:3
lines!(ax, (1:3) .+ i, color = i, colorrange = (0, 4), colormap = :Blues, label = "Line $i", linewidth = 3)
end
for i in 1:3
scatter!(ax, (1:3) .+ i .+ 3, color = i, colorrange = (0, 4), colormap = :plasma, label = "Scatter $i", markersize = 15)
end
for i in 1:3
barplot!(ax, (1:3) .+ i .+ 8, fillto = (1:3) .+ i .+ 7.5, color = i, colorrange = (0, 4), colormap = :tab10, label = "Barplot $i")
end
for i in 1:3
poly!(ax, [Rect2f((j, i .+ 12 + j), (0.5, 0.5)) for j in 1:3], color = i, colorrange = (0, 4), colormap = :heat, label = "Poly $i")
end
Legend(f[1, 2], ax)
f
end

@reference_test "LaTeXStrings in Axis3 plots" begin
xs = LinRange(-10, 10, 100)
ys = LinRange(0, 15, 100)
Expand Down Expand Up @@ -204,6 +223,7 @@ end
rticklabelstrokewidth = 1, rticklabelstrokecolor = :white,
thetaticklabelsize = 18, thetaticklabelcolor = :blue,
thetaticklabelstrokewidth = 1, thetaticklabelstrokecolor = :white,
thetaticks = ([0, π/2, π, 3π/2], ["A", "B", "C", rich("D", color = :orange)]), # https://github.com/MakieOrg/Makie.jl/issues/3583
)
f
end
Expand Down Expand Up @@ -305,3 +325,4 @@ end
axislegend(ax)
fig
end

8 changes: 4 additions & 4 deletions WGLMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name = "WGLMakie"
uuid = "276b4fcb-3e11-5398-bf8b-a0c2d153d008"
authors = ["SimonDanisch <sdanisch@gmail.com>"]
version = "0.9.5"
version = "0.9.7"

[deps]
Bonito = "824d6782-a2ef-11e9-3a09-e5662e0c26f8"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
FreeTypeAbstraction = "663a7486-cb36-511b-a19d-713bb74d65c9"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Hyperscript = "47d2ed2b-36de-50cf-bf87-49c2cf4b8b91"
Bonito = "824d6782-a2ef-11e9-3a09-e5662e0c26f8"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
Expand All @@ -20,14 +20,14 @@ ShaderAbstractions = "65257c39-d410-5151-9873-9b3e5be5013e"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
Bonito = "3.0.0"
Colors = "0.11, 0.12"
FileIO = "1.1"
FreeTypeAbstraction = "0.10"
GeometryBasics = "0.4.1"
Hyperscript = "0.0.3, 0.0.4, 0.0.5"
Bonito = "3.0.0"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.20.5"
Makie = "=0.20.7"
Observables = "0.5.1"
PNGFiles = "0.3, 0.4"
PrecompileTools = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions docs/makedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ pagefind = let
end
success(`$pagefind`)

# copy NEWS file over to documentation
# copy CHANGELOG file over to documentation
cp(
joinpath(@__DIR__, "..", "NEWS.md"),
joinpath(@__DIR__, "..", "CHANGELOG.md"),
joinpath(@__DIR__, "news.md"),
force = true)

Expand Down
5 changes: 4 additions & 1 deletion src/basic_recipes/barplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ function barplot_labels(xpositions, ypositions, bar_labels, in_y_direction, flip
end

function Makie.plot!(p::BarPlot)

bar_points = p[1]
if !(eltype(bar_points[]) <: Point2)
error("barplot only accepts x/y coordinates. Use `barplot(x, y)` or `barplot(xy::Vector{<:Point2})`.")
end
labels = Observable(Tuple{Union{String,LaTeXStrings.LaTeXString}, Point2f}[])
label_aligns = Observable(Vec2f[])
label_offsets = Observable(Vec2f[])
Expand Down
Loading

0 comments on commit b11f961

Please sign in to comment.