Open BambOoxX opened 9 months ago
Most plotting functions should handle empty vectors. I can't formulate a perfect rule but usually if you can draw zero or more of something, then this should work for zero. But if there's some data transformation inherent to a recipe which just doesn't make sense for zero elements, then this should fail. Like sum(Float64[])
returns 0
but mean(Float64[])
returns NaN
because you can't divide by zero.
Often, problems with zero elements will stem from type instabilities breaking subsequent dispatches. For example, a vector will be assembled given the input data and this ends up Any[]
for the zero-element case because it couldn't be inferred what element type it should be. Then any following dispatch will probably fail if it expected Point2f
or so. These are often reasonably easy to fix by type-constraining the relevant containers.
@jkrumbiegel Yes, that is why I explicitely called concretely typed empty vectors, that avoids the dispatch problem I guess, at least partially.
Right but this is not just about the input types, the recipes themselves will sometimes do type-unstable transformations. But those can be fixed one by one. We should definitely increase the test coverage for empty recipes. If you want to tackle that, it would already be very helpful to assess which empty cases are already tested, and which aren't, and then adding tests (that are failing) for the missing cases. Then somebody else can go in and fix those.
@jkrumbiegel i hope I will have a bit of time for that but so far I've never contributed to make. I have to say I do not know how to dev it properly without breaking the rest of my environment. I know there is a section about contributions but I had surprises with previous attempts. Any suggestions?
Right, it's a little more complex than with other packages but not terribly so. I have a shared @makie
environment that I activate when developing, because if you just activate the main Makie
env directly, you'll not get MakieCore
, and any of the backends dev'ed.
So ]activate @makie
and then dev Makie
should clone the whole Makie repo into your dev folder. Then you can dev MakieCore
etc and it should find those in the Makie folder because they are subfolders of that.
updated the opening post for what's not erroring. 2 to go
When plotting empty objects, some recipes fail on
convert_arguments
, but not all of them do, making it difficult to know if it should be an expected behavior or not. I run into this problem mostly witharrows
because sometimes I have missing objects in some model. The problem is that I do not know what is better. Not plotting at all (handling the lack of data at my level), or attempting plotting regardless of the underlying data, to preserve the plot structure.I there any recommendation regarding this ? This is somewhat related to #3228
As an example,
scatter
works, butarrows
do not.I've tested this for multiple recipes (listed below) mostly in 3D.
]activate --temp; add Makie
)