Skip to content
Open
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a7ad176
prototype infrastructure for direction, orientation and repeated dims
ffreyer Oct 3, 2025
5af58de
simplify if block a bit
ffreyer Oct 3, 2025
a0dd0c8
match argument_dims default to old behavior
ffreyer Oct 3, 2025
a9d7876
fix typo
ffreyer Oct 6, 2025
4bb89ec
add infrastructure for dim_converts in axis labels
ffreyer Oct 6, 2025
d14e326
control units in tick labels from Axis
ffreyer Oct 6, 2025
f4b617e
fix some errors with new Axis dim_converts
ffreyer Oct 6, 2025
e71ef49
add argument_dim_kwargs
ffreyer Oct 6, 2025
8f38f58
run add_attributes first so that dim_converts can include them
ffreyer Oct 6, 2025
22c00b6
fix/update hvlines
ffreyer Oct 7, 2025
6c607fc
get heatmap, surface, contour, contourf working
ffreyer Oct 7, 2025
7367313
update hist
ffreyer Oct 8, 2025
6fe3b7b
handle image
ffreyer Oct 8, 2025
57803d6
remove dynamic unit prefixes
ffreyer Oct 8, 2025
135ff68
update band, errorbars, rangebars, hspan, vspan
ffreyer Oct 9, 2025
4090b5b
update remaining basic_recipes plots that should work
ffreyer Oct 9, 2025
7962927
update stats recipes
ffreyer Oct 9, 2025
a6483f8
diy missing dim_convert discard
ffreyer Oct 9, 2025
27c8a94
cleanup print
ffreyer Oct 9, 2025
349c268
avoid errors for empty rich text
ffreyer Oct 9, 2025
9d8f40c
fix label typing
ffreyer Oct 9, 2025
7ffadab
fix voronoi 3 args, update timeseries
ffreyer Oct 10, 2025
9ed5906
add tests
ffreyer Oct 10, 2025
c064892
fix boxplot, 3D contour
ffreyer Oct 10, 2025
9c347e7
fix 3D surface convert, test remaining primitives
ffreyer Oct 11, 2025
946a61e
fix log units
ffreyer Oct 13, 2025
d8599eb
remove unused code
ffreyer Oct 13, 2025
75eb60a
fix triplot/poly conversion
ffreyer Oct 13, 2025
9c27eb2
revert deleted convert_arguments but remove recursion
ffreyer Oct 13, 2025
98517ff
fix empty rich text properly
ffreyer Oct 13, 2025
072c132
fix qqplot/qqnorm/early convert kwargs application
ffreyer Oct 13, 2025
3b75279
fix "]" from formatter ending up in superscript after a "^"
ffreyer Oct 13, 2025
9511d09
fix load order
ffreyer Oct 13, 2025
fb81392
rename attribute + docstrings
ffreyer Oct 13, 2025
d80f8d6
update Axis3
ffreyer Oct 14, 2025
2441b30
add long units
ffreyer Oct 14, 2025
d4d8ba6
fix Int error in Date resampling
ffreyer Oct 15, 2025
c7be144
fix/update tests
ffreyer Oct 15, 2025
ab33a0a
revert to late attribute adding and only add required attributes earl…
ffreyer Oct 15, 2025
c988fa9
fix tests missing parent_is_scene
ffreyer Oct 15, 2025
c471bbd
revert unnecessary change to add_convert_kwargs!()
ffreyer Oct 15, 2025
d6a2e0a
fix PlotSpec
ffreyer Oct 15, 2025
770b842
remove unused `try_dim_convert` and `should_dim_convert` (keep name f…
ffreyer Oct 16, 2025
6ea83c9
drop unnecessary method
ffreyer Oct 16, 2025
2deafe3
update docs
ffreyer Oct 16, 2025
7702f33
run formatter
ffreyer Oct 17, 2025
b3ef766
minor cleanup
ffreyer Oct 17, 2025
00ae1ae
get point-like data working
ffreyer Oct 17, 2025
b63bcce
remove prints
ffreyer Oct 18, 2025
a77f1e3
explicitly exclude Axis3D plots
ffreyer Oct 18, 2025
2d76f0a
allow ranges in argument_dims()
ffreyer Oct 18, 2025
649548a
update more point like arguments
ffreyer Oct 18, 2025
9d8c31d
fix getindex(nothing, idx)
ffreyer Oct 18, 2025
6f7f48b
fix failing dim converts tests
ffreyer Oct 18, 2025
874d04d
fix empty array application
ffreyer Oct 18, 2025
dcfc8d2
fix convert_arguments tests
ffreyer Oct 18, 2025
7b96f65
fix tooltip
ffreyer Oct 18, 2025
6165677
fix annotations
ffreyer Oct 18, 2025
eceebe5
fix tooltip
ffreyer Oct 18, 2025
6f8519e
make `force_dimconverts` settable to fix Axis3
ffreyer Oct 18, 2025
fc9e33a
fix mesh
ffreyer Oct 18, 2025
3ee11e8
fix tests
ffreyer Oct 18, 2025
0520d01
fix docs
ffreyer Oct 19, 2025
de9310e
avoid converting non data space
ffreyer Oct 19, 2025
6673a64
improve documentation of conversion logic and steps
ffreyer Oct 19, 2025
9223ac1
add refimg for label attributes
ffreyer Oct 19, 2025
934949f
avoid need for ::Automatic in show_dim_convert_in_...()
ffreyer Oct 20, 2025
767ab09
allow early conversions when dim converts are forced (+ some restruct…
ffreyer Oct 20, 2025
8891191
add tests for point-like data & fix conversions
ffreyer Oct 20, 2025
ff3a8bd
run formatter
ffreyer Oct 20, 2025
dfc5f6e
fix and test band with vectypes
ffreyer Oct 20, 2025
f2d6347
fix docs?
ffreyer Oct 20, 2025
75a793a
default units to axis labels only
ffreyer Oct 20, 2025
a4ebd24
default multiple point-like arguments
ffreyer Oct 20, 2025
7a9f0a3
make sure every recipe has dim convert exit paths
ffreyer Oct 21, 2025
7a8cb30
some cleanup + docstrings
ffreyer Oct 21, 2025
672c8d8
fix dodgy docs
ffreyer Oct 23, 2025
3f74daa
add section about conversion target types to recipe docs
ffreyer Oct 23, 2025
ff74ca2
update changelog
ffreyer Oct 23, 2025
7feb429
Merge branch 'master' into ff/dim-converts
ffreyer Nov 15, 2025
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
8 changes: 5 additions & 3 deletions Makie/ext/MakieDynamicQuantitiesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import DynamicQuantities as DQ

M.expand_dimensions(::M.PointBased, y::AbstractVector{<:DQ.UnionAbstractQuantity}) = (keys(y), y)
M.create_dim_conversion(::Type{<:DQ.UnionAbstractQuantity}) = M.DQConversion()
M.should_dim_convert(::Type{<:DQ.UnionAbstractQuantity}) = true

unit_string(quantity::DQ.UnionAbstractQuantity) = string(DQ.dimension(quantity))

Expand All @@ -24,18 +23,21 @@ function unit_convert(quantity::DQ.UnionAbstractQuantity, value)
end

needs_tick_update_observable(conversion::M.DQConversion) = conversion.quantity
show_dim_convert_in_ticklabel(::M.DQConversion, ::M.Automatic) = true

function M.get_ticks(conversion::M.DQConversion, ticks, scale, formatter, vmin, vmax)
function M.get_ticks(conversion::M.DQConversion, ticks, scale, formatter, vmin, vmax, show_in_label)
quantity = conversion.quantity[]
quantity isa M.Automatic && return [], []
unit_str = unit_string(quantity)
tick_vals, labels = M.get_ticks(ticks, scale, formatter, vmin, vmax)
if conversion.units_in_label[]
if show_in_label
labels = labels .* unit_str
end
return tick_vals, labels
end

M.get_label_suffix(conversion::M.DQConversion) = unit_string(conversion.quantity[])

function M.convert_dim_value(conversion::M.DQConversion, attr, values, last_values)
if conversion.quantity[] isa M.Automatic
conversion.quantity[] = oneunit(first(values))
Expand Down
1 change: 1 addition & 0 deletions Makie/src/Makie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ include("dim-converts/unitful-integration.jl")
include("dim-converts/dynamic-quantities-integration.jl")
include("dim-converts/categorical-integration.jl")
include("dim-converts/dates-integration.jl")
include("dim-converts/argument_dims.jl")

include("scenes.jl")
include("float32-scaling.jl")
Expand Down
8 changes: 7 additions & 1 deletion Makie/src/basic_recipes/annotation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ If no label positions are given, they will be determined automatically such
that overlaps between labels and data points are reduced. In this mode, the labels should
be very close to their associated data points so connection plots are typically not visible.
"""
@recipe Annotation begin
@recipe Annotation (merged_positions::VecTypesVector{4, <:Real},) begin
"""
The color of the text labels. If `automatic`, `textcolor` matches `color`.
"""
Expand Down Expand Up @@ -167,6 +167,12 @@ function closest_point_on_rectangle(r::Rect2, p)
return argmin(c -> norm(c - p), candidates)
end

argument_dims(::Type{<:Annotation}, x, y) = (1, 2)
argument_dims(::Type{<:Annotation}, xy) = ((1, 2),)
argument_dims(::Type{<:Annotation}, x, y, x2, y2) = (1, 2, 1, 2)
argument_dims(::Type{<:Annotation}, xy::VecTypes{2}, xy2::VecTypes{2}) = ((1, 2), (1, 2))
argument_dims(::Type{<:Annotation}, xy::VecTypesVector{2}, xy2::VecTypesVector{2}) = ((1, 2), (1, 2))

function Makie.convert_arguments(::Type{<:Annotation}, x::Real, y::Real)
return ([Vec4d(NaN, NaN, x, y)],)
end
Expand Down
21 changes: 14 additions & 7 deletions Makie/src/basic_recipes/arrows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,39 @@

struct ArrowLike <: ConversionTrait end

argument_dims(::ArrowLike, xy::VecTypes{N}, uv::VecTypes{N}) where {N} = (1:N, 1:N)
argument_dims(::ArrowLike, xy::VecTypesVector{N}, uv::VecTypesVector{N}) where {N} = (1:N, 1:N)
argument_dims(::ArrowLike, x, y, f) = (1, 2)
argument_dims(::ArrowLike, x, y, z, f::Function) = (1, 2, 3)
argument_dims(::ArrowLike, x, y, u, v) = (1, 2, 1, 2)
argument_dims(::ArrowLike, x, y, z, u, v, w) = (1, 2, 3, 1, 2, 3)

# vec(::Point) and vec(::Vec) works (returns input), but vec(::Tuple) errors
convert_arguments(::ArrowLike, pos::VecTypes{N}, dir::VecTypes{N}) where {N} = ([pos], [dir])

function convert_arguments(::ArrowLike, pos::AbstractArray, dir::AbstractArray)
return (
convert_arguments(PointBased(), vec(pos))[1],
convert_arguments(PointBased(), vec(dir))[1],
convert_arguments(PointBased(), vec(pos))...,
convert_arguments(PointBased(), vec(dir))...,
)
end

function convert_arguments(::ArrowLike, x, y, u, v)
return (
convert_arguments(PointBased(), vec(x), vec(y))[1],
convert_arguments(PointBased(), vec(u), vec(v))[1],
convert_arguments(PointBased(), vec(x), vec(y))...,
convert_arguments(PointBased(), vec(u), vec(v))...,
)
end
function convert_arguments(::ArrowLike, x::AbstractVector, y::AbstractVector, u::AbstractMatrix, v::AbstractMatrix)
return (
vec(Point{2, float_type(x, y)}.(x, y')),
convert_arguments(PointBased(), vec(u), vec(v))[1],
convert_arguments(PointBased(), vec(u), vec(v))...,
)
end
function convert_arguments(::ArrowLike, x, y, z, u, v, w)
return (
convert_arguments(PointBased(), vec(x), vec(y), vec(z))[1],
convert_arguments(PointBased(), vec(u), vec(v), vec(w))[1],
convert_arguments(PointBased(), vec(x), vec(y), vec(z))...,
convert_arguments(PointBased(), vec(u), vec(v), vec(w))...,
)
end

Expand Down
3 changes: 3 additions & 0 deletions Makie/src/basic_recipes/axis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ $(ATTRIBUTES)
)
end

argument_dim_kwargs(::Type{<:Axis3D}) = tuple()
argument_dims(::Type{<:Axis3D}, args...) = nothing

isaxis(x) = false
isaxis(x::Axis3D) = true

Expand Down
17 changes: 13 additions & 4 deletions Makie/src/basic_recipes/band.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,28 @@ Plots a band from `ylower` to `yupper` along `x`. The form `band(lower, upper)`
between the points in `lower` and `upper`.
Both bounds can be passed together as `lowerupper`, a vector of intervals.
"""
@recipe Band (lowerpoints, upperpoints) begin
@recipe Band (lowerpoints::VecTypesVector{N, <:Real} where {N}, upperpoints::VecTypesVector{N, <:Real} where {N}) begin
documented_attributes(Mesh)...
"The direction of the band. If set to `:y`, x and y coordinates will be flipped, resulting in a vertical band. This setting applies only to 2D bands."
direction = :x
shading = NoShading
end

function convert_arguments(::Type{<:Band}, x, ylower, yupper)
argument_dim_kwargs(::Type{<:Band}) = (:direction,)
function argument_dims(::Type{<:Band}, x, ylower, yupper; direction)
return direction === :x ? (1, 2, 2) : (2, 1, 1)
end
function argument_dims(::Type{<:Band}, lower::VecTypesVector{N}, upper::VecTypesVector{N}; direction) where {N}
return direction === :x ? (1, 2) : (2, 1)
end

function convert_arguments(::Type{<:Band}, x::RealVector, ylower::RealVector, yupper::RealVector)
return (Point2{float_type(x, ylower)}.(x, ylower), Point2{float_type(x, yupper)}.(x, yupper))
end

convert_arguments(P::Type{<:Band}, x::AbstractVector{<:Number}, y::AbstractVector{<:Interval}) =
convert_arguments(P, x, leftendpoint.(y), rightendpoint.(y))
function convert_arguments(P::Type{<:Band}, x::AbstractVector, y::AbstractVector{<:Interval})
return convert_arguments(P, x, leftendpoint.(y), rightendpoint.(y))
end

function band_connect(n)
ns = 1:(n - 1)
Expand Down
1 change: 1 addition & 0 deletions Makie/src/basic_recipes/barplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Plots bars of the given `heights` at the given (scalar) `positions`.
end

conversion_trait(::Type{<:BarPlot}) = PointBased()
argument_dim_kwargs(::Type{<:BarPlot}) = (:direction,)

function bar_rectangle(x, y, width, fillto, in_y_direction)
# y could be smaller than fillto...
Expand Down
4 changes: 4 additions & 0 deletions Makie/src/basic_recipes/bracket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ By default each label is rotated parallel to the line between the bracket points
space = :data
end

argument_dims(::Type{<:Bracket}, xy1::VecTypes{2}, xy2::VecTypes{2}) = ((1, 2), (1, 2))
argument_dims(::Type{<:Bracket}, xy1::VecTypesVector{2}, xy2::VecTypesVector{2}) = ((1, 2), (1, 2))
argument_dims(::Type{<:Bracket}, x1, y1, x2, y2) = (1, 2, 1, 2)

function convert_arguments(::Type{<:Bracket}, point1::VecTypes{2, T1}, point2::VecTypes{2, T2}) where {T1, T2}
return ([(Point2{float_type(T1)}(point1), Point2{float_type(T2)}(point2))],)
end
Expand Down
6 changes: 0 additions & 6 deletions Makie/src/basic_recipes/contourf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ similar to how [`surface`](@ref) works.
mixin_colormap_attributes(allow = (:colormap, :colorscale, :nan_color))...
end

# these attributes are computed dynamically and needed for colorbar e.g.
# _computed_levels
# _computed_colormap
# _computed_extendlow
# _computed_extendhigh

_get_isoband_levels(levels::Int, mi, ma) = collect(range(Float32(mi), nextfloat(Float32(ma)), length = levels + 1))

function _get_isoband_levels(levels::AbstractVector{<:Real}, mi, ma)
Expand Down
51 changes: 49 additions & 2 deletions Makie/src/basic_recipes/error_and_rangebars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,40 @@ end

### conversions for errorbars

argument_dim_kwargs(::Type{<:Union{Errorbars, Rangebars}}) = (:direction,)

function argument_dims(::Type{<:Errorbars}, x, y, e; direction)
return ifelse(direction === :y, (1, 2, 2), (1, 2, 1))
end

function argument_dims(::Type{<:Errorbars}, x, y, l, h; direction)
return ifelse(direction === :y, (1, 2, 2, 2), (1, 2, 1, 1))
end

function argument_dims(::Type{<:Errorbars}, x, y, lh::VecTypesVector{2}; direction)
return ifelse(direction === :y, (1, 2, (2, 2)), (1, 2, (1, 1)))
end

function argument_dims(::Type{<:Errorbars}, xy::VecTypesVector{2}, e; direction)
return ifelse(direction === :y, ((1, 2), 2), ((1, 2), 1))
end

function argument_dims(::Type{<:Errorbars}, xy::VecTypesVector{2}, l, h; direction)
return ifelse(direction === :y, ((1, 2), 2, 2), ((1, 2), 1, 1))
end

function argument_dims(::Type{<:Errorbars}, xy::VecTypesVector{2}, lh::VecTypesVector{2}; direction)
return ifelse(direction === :y, ((1, 2), (2, 2)), ((1, 2), (1, 1)))
end

function argument_dims(::Type{<:Errorbars}, xye::VecTypesVector{3}; direction)
return ifelse(direction === :y, ((1, 2, 2),), ((1, 2, 1),))
end

function argument_dims(::Type{<:Errorbars}, xylh::VecTypesVector{4}; direction)
return ifelse(direction === :y, ((1, 2, 2, 2),), ((1, 2, 1, 1),))
end

function convert_arguments(::Type{<:Errorbars}, x::RealOrVec, y::RealOrVec, error_both::RealOrVec)
T = float_type(x, y, error_both)
xyerr = broadcast(x, y, error_both) do x, y, e
Expand Down Expand Up @@ -111,6 +145,18 @@ end

### conversions for rangebars

function argument_dims(::Type{<:Rangebars}, x, l, h; direction)
return ifelse(direction === :y, (1, 2, 2), (2, 1, 1))
end

function argument_dims(::Type{<:Rangebars}, x, lh::VecTypesVector{2}; direction)
return ifelse(direction === :y, (1, (2, 2)), (2, (1, 1)))
end

function argument_dims(::Type{<:Rangebars}, xlh::VecTypesVector{3}; direction)
return ifelse(direction === :y, ((1, 2, 2),), ((2, 1, 1),))
end

function convert_arguments(::Type{<:Rangebars}, val::RealOrVec, low::RealOrVec, high::RealOrVec)
T = float_type(val, low, high)
val_low_high = broadcast(Vec3{T}, val, low, high)
Expand All @@ -129,8 +175,9 @@ function convert_arguments(
return (val_low_high,)
end

Makie.convert_arguments(P::Type{<:Rangebars}, x::AbstractVector{<:Number}, y::AbstractVector{<:Interval}) =
convert_arguments(P, x, endpoints.(y))
function convert_arguments(P::Type{<:Rangebars}, x::AbstractVector, y::AbstractVector{<:Interval})
return convert_arguments(P, x, endpoints.(y))
end

### the two plotting functions create linesegpairs in two different ways
### and then hit the same underlying implementation in `_plot_bars!`
Expand Down
3 changes: 3 additions & 0 deletions Makie/src/basic_recipes/hvlines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function projview_to_2d_limits(plot::AbstractPlot)
end
end

argument_dims(::Type{<:HLines}, y) = (2,)
argument_dims(::Type{<:VLines}, x) = (1,)

function Makie.plot!(p::Union{HLines, VLines})
mi = p isa HLines ? (:xmin) : (:ymin)
ma = p isa HLines ? (:xmax) : (:ymax)
Expand Down
3 changes: 3 additions & 0 deletions Makie/src/basic_recipes/hvspan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Both bounds can be passed together as an interval `xs_lowhigh`.
documented_attributes(Poly)...
end

argument_dims(::Type{<:HSpan}, ylow, yhigh) = (2, 2)
argument_dims(::Type{<:VSpan}, xlow, yhigh) = (1, 1)

function Makie.plot!(p::Union{HSpan, VSpan})
mi = p isa HSpan ? :xmin : :ymin
ma = p isa HSpan ? :xmax : :ymax
Expand Down
7 changes: 6 additions & 1 deletion Makie/src/basic_recipes/poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const PolyElements = Union{Polygon, MultiPolygon, Circle, Rect, AbstractMesh, Ve
convert_arguments(::Type{<:Poly}, v::AbstractVector{<:PolyElements}) = (v,)
convert_arguments(::Type{<:Poly}, v::Union{Polygon, MultiPolygon}) = (v,)

argument_dims(::Type{<:Poly}, vertices::VecTypesVector{N}, indices) where {N} = (1:N,)

function convert_pointlike(args...)
return convert_arguments(PointBased(), args...)
Expand All @@ -24,7 +25,11 @@ function convert_arguments(::Type{<:Poly}, path::AbstractMatrix{<:Number})
return convert_pointlike(path)
end

function convert_arguments(::Type{<:Poly}, vertices::AbstractArray, indices::AbstractArray)
function convert_arguments(::Type{<:Poly}, vertices::RealArray, indices::AbstractArray)
return convert_arguments(Mesh, vertices, indices)
end

function convert_arguments(::Type{<:Poly}, vertices::AbstractArray{<:VecTypes}, indices::AbstractArray)
return convert_arguments(Mesh, vertices, indices)
end

Expand Down
2 changes: 2 additions & 0 deletions Makie/src/basic_recipes/spy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ function boundingbox(p::Spy, space::Symbol = :data)
return apply_transform_and_model(p, data_limits(p))
end

argument_dims(::Type{<:Spy}, x, y, mat) = (1, 2)

function convert_arguments(::Type{<:Spy}, matrix::AbstractMatrix{T}) where {T}
Tr = Makie.float_type(T)
return convert_arguments(Spy, Tr.((0, size(matrix, 1))), Tr.((0, size(matrix, 2))), matrix)
Expand Down
4 changes: 2 additions & 2 deletions Makie/src/basic_recipes/stairs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Plot a stair function.

The conversion trait of `stairs` is `PointBased`.
"""
@recipe Stairs begin
@recipe Stairs (positions,) begin
"""
The `step` parameter can take the following values:
- `:pre`: horizontal part of step extends to the left of each value in `xs`.
Expand All @@ -19,7 +19,7 @@ end
conversion_trait(::Type{<:Stairs}) = PointBased()

function plot!(p::Stairs{<:Tuple{<:AbstractVector{T}}}) where {T <: Point2}
map!(p, [:converted_1, :step], :steppoints) do points, step
map!(p, [:positions, :step], :steppoints) do points, step
if step === :pre
s_points = Vector{T}(undef, length(points) * 2 - 1)
s_points[1] = point = points[1]
Expand Down
15 changes: 13 additions & 2 deletions Makie/src/basic_recipes/streamplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,24 @@ See the function `Makie.streamplot_impl` for implementation details.
mixin_generic_plot_attributes()...
end

function convert_arguments(::Type{<:StreamPlot}, f::Function, xrange, yrange)
argument_dims(::Type{<:StreamPlot}, f, x, y) = (0, 1, 2)
argument_dims(::Type{<:StreamPlot}, f, x, y, z) = (0, 1, 2, 3)

# Normalize x, y, (z) types for dim converts
function convert_arguments(::Type{<:StreamPlot}, f::Function, xrange::RangeLike, yrange::RangeLike)
return (f, extrema(xrange), extrema(yrange))
end
function convert_arguments(::Type{<:StreamPlot}, f::Function, xrange::RangeLike, yrange::RangeLike, zrange::RangeLike)
return (f, extrema(xrange), extrema(yrange), extrema(zrange))
end

function convert_arguments(::Type{<:StreamPlot}, f::Function, xrange::RangeLike{<:Real}, yrange::RangeLike{<:Real})
xmin, xmax = extrema(xrange)
ymin, ymax = extrema(yrange)
return (f, Rect(xmin, ymin, xmax - xmin, ymax - ymin))
end

function convert_arguments(::Type{<:StreamPlot}, f::Function, xrange, yrange, zrange)
function convert_arguments(::Type{<:StreamPlot}, f::Function, xrange::RangeLike{<:Real}, yrange::RangeLike{<:Real}, zrange::RangeLike{<:Real})
xmin, xmax = extrema(xrange)
ymin, ymax = extrema(yrange)
zmin, zmax = extrema(zrange)
Expand Down
12 changes: 1 addition & 11 deletions Makie/src/basic_recipes/text.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
struct RichText
type::Symbol
children::Vector{Union{RichText, String}}
attributes::Dict{Symbol, Any}
function RichText(type::Symbol, children...; kwargs...)
cs = Union{RichText, String}[children...]
return new(type, cs, Dict(kwargs))
end
end

function check_textsize_deprecation(@nospecialize(dictlike))
return if haskey(dictlike, :textsize)
throw(ArgumentError("`textsize` has been renamed to `fontsize` in Makie v0.19. Please change all occurrences of `textsize` to `fontsize` or revert back to an earlier version."))
Expand Down Expand Up @@ -855,7 +845,7 @@ struct GlyphInfo
origin::Point2f
extent::GlyphExtent
size::Vec2f
rotation::Quaternion
rotation::Quaternionf
color::RGBAf
strokecolor::RGBAf
strokewidth::Float32
Expand Down
7 changes: 6 additions & 1 deletion Makie/src/basic_recipes/textlabel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

Plots the given text(s) with a background(s) at the given position(s).
"""
@recipe TextLabel (positions,) begin
@recipe TextLabel (positions::Union{
VecTypesVector{N, <:Real} where {N},
AbstractArray{<:Tuple{<:AbstractString, <:VecTypes{N, <:Real} where {N}}},
AbstractArray{<:AbstractString},
AbstractString
},) begin
# text-like args interface
"Specifies one piece of text or a vector of texts to show, where the number has to match the number of positions given. Makie supports `String` which is used for all normal text and `LaTeXString` which layouts mathematical expressions using `MathTeXEngine.jl`."
text = ""
Expand Down
Loading
Loading