-
Notifications
You must be signed in to change notification settings - Fork 65
allow multiple series from one argument #46
Conversation
Update: actually implementing the correct theme here was quite easy. If we are OK with temporarily not having interactivity when plotting |
I've created a custom Example: p = PlotList(
PlotSpecs{Scatter}((rand(10), rand(10)), theme -> merge(theme, Theme(color = :red))),
PlotSpecs{Lines}((-pi..pi, sin), theme -> merge(theme, Theme(color = :red))),
)
plot(p) is the translation of (hopefully I still remember the plots syntax correctly): @series begin
seriestype := :scatter
x = 1:10
y = 1:10
color := :red
(x, y)
end
@series begin
seriestype := :line
x = -pi..pi
y = sin
color := :red
(x, y)
end If we like it, I'd propose to consider using |
It's a nice idea - but do you find this style clearer than the |
I was just reminded how nice the |
This is more of an implementation than a syntax. A It'd be good to discuss how to improve the syntax without introducing macros, but as long as each The technical constrain at the moment is that
The columns-are-series syntax can be extremely convenient, that's for sure! Having this IMO the main limitations of "columns-as-series" are that it requires columns to have the same length and that sometimes converting to these row vectors can be a bit verbose (as |
Continuing the discussion from Slack, I felt the need to introduce this complex system (of passing a
Note that in 1) and 2) we'd need to figure out whether we want to distinguish if something comes from the theme or from a keyword the user passed. For example,
Overall however it feels like all of these are best handled as a carefully chosen set of custom types that can be passed to each attribute individually. Potentially the main ones could be: attr = Delayed(f, syms) which would be converted into DefaultsTo(value) which would be converted to |
(FWIW I think the precedence should be user_keyword trumps recipe trumps theme) |
@SimonDanisch I was planning to merge this soonish, are you happy with the current state of the PR? My idea is that |
This introduces a general mechanism to generate multiple series from convert arguments, by creating an object to represent them.
I can optionally pass functions to this multiple object to modify the theme for the specific subseries:
and each individual series can have their own plot type:
TODO:
Interactivity? It's a bit tricky because the number of series may change
Allow
MultiplePlot
to absorb all the themes of the individual plots, this may be tricky in generalFigure out whether it can be made to work nice with layout / labelling / cycling palette etc
Once this is a clean implementation I should be able to simplify (and make less buggy) the StatsMakie implementation of analysis that return multiple plots.