-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use :linestyle
in poly!(…, cycle=[…])
#4544
Comments
Cycling is only supported to cycle through a palette on a per plot basis, not with one big plot. using CairoMakie
using Makie.GeometryBasics
# Pass the figure a theme with a new palette
f = Figure(palette=(; linestyle=[
:solid,
:dash,
:dot,
:dashdot,
(:dash, :loose),
(:dot, :loose),
(:dashdot, :loose),
(:dash, :dense),
(:dot, :dense),
(:dashdot, :dense),
]))
Axis(f[1, 1])
for i in 1:3, j in 1:3
poly!(
Rect(i, j, 0.75, 0.5),
color = :white,
strokewidth = 2,
cycle = [:linestyle],
)
end
f
This works, but will be a bit slower then using one poly call. |
(Something went wrong when posting my reply. I hope this won't be duplicated now; if so, I'm sorry!) Thanks for the reply! Is it intentional that f = Figure()
Axis(f[1, 1])
poly!(
[Rect(i, j, 0.75, 0.5) for i = 1:3 for j = 1:3],
color = :white,
strokewidth = 2,
strokecolor = 1:9,
)
display(f) |
To add to this further: In the end, I want to combine changing f = Figure(;
palette = (;
linestyle = [
:solid,
:dash,
:dot,
:dashdot,
(:dash, :loose),
(:dot, :loose),
(:dashdot, :loose),
(:dash, :dense),
(:dot, :dense),
(:dashdot, :dense),
],
strokecolor = Makie.wong_colors(),
),
)
Axis(f[1, 1])
for rect in [Rect(i, j, 0.75, 0.5) for i = 1:3 for j = 1:3]
poly!(rect, color = :white, strokewidth = 2, cycle = [:linestyle, :strokecolor])
end
display(f) It doesn't throw an error but it does not change the strokecolor either: |
The color doesn't change because by default the cycler goes through all values of cycle component 1 first, then all of 2, etc. You have nine rects and nine linestyles so you never see strokecolor 2. You can use
|
Hi, thank you for developing and maintaining this library! 🙂
I'm trying to get
poly!
to cycle not over colors but over line styles (mainly to have a fall back for people with color vision deficiencies). However, that does not work (or I may be doing something wrong here).For simplicity, I copied and adjusted the
poly!
example from the docs.This throws the following error:
I also tried to force the
Linestyle
type by applyingMakie.to_linestyle.
as well as(Linestyle ∘ Makie.to_linestyle).
but to no avail.what version of Makie are you running? (
]st -m Makie
)can you reproduce the bug with a fresh environment ? (
]activate --temp; add Makie
)Yes.
What platform + GPU are you on?
NixOS, not using GPU. But quite sure it has nothing to do with the platform I'm using.
The text was updated successfully, but these errors were encountered: