-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement proposal: reduce code complexity, improve legends, allow non-incremental plots (for grouped bar) #136
Comments
Really nice work! I think it's great to simplify the underlying mechanisms of AlgebraOfGraphics. It also could use some decoupling between syntax, data manipulations, and rendering (IMO, rendering is the one that should be factored out). I would propose the following way to move forward:
I believe that things like grouping should not really be in AoGBackend, which should receive the data already grouped (that is, as a list of tables, each with their own key), so that other grouping strategies become possible (multidimensional slices for instance). Analysis are not really a problem, because that's done before plotting by AlgebraOfGraphics, so you shouldn't worry about those. The other thing is the geom = visual(Scatter) + linear
data(df) * style(x, y; kwargs...) * geom using AoGBackend, we would need to have some sort of "incremental mode" for geometries (not within a single geometry). In particular, it needs to be able to |
Thanks for your feedback! I'll think about the I'll comment here once I've created the package. Are there any other ideas for such a package? If we want to make it usable without AlgebraOfGraphics syntax then we probably don't want to have its abbreviation in the name, do we? Probably TabularMakie.jl or DataMakie.jl, or so? Any ideas @SimonDanisch, @jkrumbiegel, @mkborregaard (tagging you as my perceived spokesperson for JuliaPlots)? |
I went for https://github.com/greimel/TabularMakie.jl |
Cool! My plan is as follow. I will try to work on a simplified AlgebraOfGraphicsLight that only does the conversion from the AoG language to the
Then there should be somewhere an implementation on I suspect the TabularMakie package could come very handy to render the |
Sounds good! |
Is it possible to use the Tables.jl interface instead of full blown DataFrames? If yes, I wouldn't oppose to have this directly in AbstractPlotting ;) |
It might be possible yes. I think I only need DataFrames-specific stuff twice (operation on grouped data). I could try to make it work with SplitApplyCombine.jl instead. What's your objection to DataFrames.jl? It's almost 1.0 and it makes things really convenient. |
The whole purpose of the Tables interface is not having to restrict people to Dataframes, though, right? |
Is it about the restriction of inputs (I could just transform it internally) or taking the dependency? If we use it internally we could use the DataFrames mini language for free (I think). That is we can just allow |
It's about the dependency, and making the same things work with any arbitrary other datatype that satisfies the table interface. Especially since I usually avoid Dataframes in my projects... Not because I dislike it, but just because it's quite a lot to learn and my data wrangling is usually super simple :D |
Wouldn't transforming internally also lead to copying input data in many cases? |
I think this should have its own function and not sit in the same recipe pipeline as everything else. First because table-like is not a type and Simon is right that dispatching would be hard. Second because certain recipes might want to define methods for table-like types and that would conflict. Third because the default plotting commands all return FigureAxisPlot, AxisPlot or Plot and returning a Figure with many plots and legend and colorbar breaks that default interface. |
@SimonDanisch I would probably leave it outside AbstractPlotting for now, because developing is simpler using DataFrames. When we've made some progress we can still get rid of the dependency and port it to AbstractPlotting. @mkborregaard that's probably true. @jkrumbiegel Concerning return type: I agree. I think there should be two interfaces. One which looks like standard Makie and returns something that looks like standard Makie. And a second that returns legends, colorbars, etc for easy customization. (In fact there are already two different plotting functions in TabularMakie for this reason.) Concerning input type: What about the StatsMakie approach of having a custom type Thanks a lot for this discussion. |
Having a |
I have secretly hidden inside StructArrays enough table manipulations machinery as to not need DataFrames. In particular, grouping can be done using just StructArrays, which is a dependency already. There is a
IMO, there are four distinct things:
I guess 1 and 2 can happily live in AbstractPlotting. 3. is probably simple enough to implement using the "data wrapper" (I'm happy to help switch from |
Closed by #155 |
Hi @piever,
When working on #91, #84 I found that the pipeline currently is too complex for me to fully grasp and also too complex to make progress on these two PRs. Since I want to use the Makie ecosystem for all my plots, I wrote a lighter version of this package (it's probably closer to StatsMakie) that fits in one Pluto notebook.
It improves on this package in the following ways
AllAtOnce
andIncremental
. Each plot type can specify it's own mode (but I guessIncremental
will be the default). With this and Add stacking and dodging to bar plot JuliaPlots/AbstractPlotting.jl#580 we can cover grouped bar plots.What it doesn't handle
(While 1. and 2. need some thought, 3. will be really easy to address)
EDIT: the updated code is here: https://github.com/greimel/TabularMakie.jl
Here is the notebook https://gist.github.com/greimel/7bef42c2b41dec22650f8c0262bd8b5f
here is a static preview http://htmlpreview.github.io/?https://gist.githubusercontent.com/greimel/7bef42c2b41dec22650f8c0262bd8b5f/raw/15fa97618e34a991379a47e810f3a9b39366f9b4/illustration.jl.html
and at the bottom there are some plots from the notebook.
Let me know if you like this approach then we can discuss how it can be possible to integrate this either in StatsMakie or AlgebraOfGraphics.
Please also let me know if you immediately see why this approach cannot work with the slicing approach or the composability of your AlgebraicDict.
The text was updated successfully, but these errors were encountered: