Description
This discord thread got me thinking and I'd like to suggest this alternative take on:
In this discussion, the user wanted to store an entire 2D plot in each frame of their simulation result, and resorted to logging a matplotlib raster:
Note: this proposal address the (possibly time-varying) "instantaneous" plot use case, aka the use case where the entire plot (X and Y axis) is stored at a single time point (modulo latest at). It does not address the case where one time varying scalar must be plotted against another time varying scalar.
Core proposal
The core proposal is to introduce a ScalarAbscissa
component (someone please finds a better name) that is essentially a Scalar
component to be used as X axis (with tagged components we could actually reuse the same Scalar
component).
Then, the existing Timeseries view would be altered as follows:
- Renamed to
Plot view
. - When used in Latest At mode: plot the
Scalar
component (which, in this case, should typically be a n>1 batch) against theScalarAbscissa
component. - When used in Range mode: no modifications w.r.t to the current behaviour. (For a given time point, if the
Scalar
is a batch, pick instance at index 0 and ignore others. Also, ignoreScalarAbscissa
.)
Scalar
x ScalarAbscissa
join
- Obviously, we have basic instance join semantics.
- The resulting plot has a number of point which is the min of both components (if
Scalar
as 10 instance andScalarAbscissa
as 15, then we plot 10 points). - The fallback provider for
ScalarAbscissa
isrange(n)
wheren = len(Scalar)
. - If multiple entities are added to the plot view, each
Scalar
are matched against the collocatedScalarAbscissa
(if any). In other words, not cross-entity shenanigans (*)
(*) this is a bit of a limitation in the case of many series against the same abscissa. Possible workaround:
- allow 2d tensors to be considered a collection of multiple scalars
- allow multiple scalars to be collocated using tagged components
- allow any vecXD-based component to be plottable
Bonus features
- When in Range mode with n>1
Scalar
batches, have some options to display a compound value for each point (mean/media with stddev bars, box plot, etc.) - …