Skip to content

Commit

Permalink
Merge branch 'master' into ff/lighting
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer authored Jan 12, 2024
2 parents dae619c + 5ef0426 commit 29a4db5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 4 additions & 1 deletion docs/explanations/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ Defining a conversion for every plot type likely won't make sense, so one can re
Makie.convert_arguments(P::Type{<:Scatter}, ::MyType) = convert_arguments(P, rand(10))
```

Conversion traits make it easier to define behavior for a group of plot types that share the same trait. `PointBased` for example applies to `Scatter`, `Lines`, etc. Predefined are `NoConversion`, `PointBased`, `SurfaceLike` and `VolumeLike`.
Conversion traits make it easier to define behavior for a group of plot types that share the same trait.
`PointBased` for example applies to `Scatter`, `Lines`, etc.
The predefined traits are `NoConversion`, `PointBased`, `CellGrid <: GridBased`, `VertexGrid <: GridBased`, `ImageLike`, `VolumeLike` and `SampleBased`.
They all inherit from `ConversionTrait`, sometimes indirectly.

```julia
Makie.convert_arguments(::PointBased, ::MyType) = ...
Expand Down
16 changes: 14 additions & 2 deletions src/basic_recipes/streamplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ See the function `Makie.streamplot_impl` for implementation details.
maxsteps = 500,
color = norm,

arrow_size = 15,
arrow_size = automatic,
arrow_head = automatic,
density = 1.0,
quality = 16,
Expand Down Expand Up @@ -213,10 +213,22 @@ function plot!(p::StreamPlot)
rotations = map(x -> x[2], data)
end

arrow_size = map(p, p.arrow_size) do arrow_size
if arrow_size === automatic
if N == 3
return 0.2 * minimum(p.limits[].widths) / minimum(p.gridsize[])
else
return 15
end
else
return arrow_size
end
end

scatterfun(N)(
p,
lift(first, p, data);
markersize=p.arrow_size, rotations=rotations,
markersize=arrow_size, rotations=rotations,
color=lift(x -> x[4], p, data),
marker = lift((ah, q) -> arrow_head(N, ah, q), p, p.arrow_head, p.quality),
colormap_args...,
Expand Down

0 comments on commit 29a4db5

Please sign in to comment.