-
Notifications
You must be signed in to change notification settings - Fork 46
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
Rename style and spec #74
Comments
I see how that can be confusing, and I guess it doesn't help that neither has docstrings... Style comes from the Grammar of Graphics idea that you "style the plot with data". They use the word "aesthetics", but somehow that feels a bit too much. I see your point that it is a mapping or a binding. AFAIU, in Vue.js or React.js this is called binding (like I kind of like the name style(:SepalLength, :SepalWidth, color = :Species) * theme(Scatter, color = [:red, :blue, :green])
style(x, y, wts = z) * linear(interval = :confidence) which IMO is a nice way to split keywords. By this logic, one should do So possible ways forward could be:
|
To clarify the last points, |
Aha so spec is plot plus data independent settings, then settings is not so good of a name. Maybe layer? What is the current way of mapping keywords under style to the expected content? Is something like color or strokecolor hard-coded to refer to colors or is that done via dispatch? Is the current system flexible enough to put basically arbitrary plot functions in a spec / layer? |
I like Pretty much nothing is hardcoded (and I would like as much as possible to keep it that way!). The mechanism is as follows:
So far the first argument of layer() do scene, attributes, args... # I wonder if one can use keyword arguments in a do block
# some custom plot
end ? |
What I was wondering about is this: you have a plot function which takes the keyword color, and you can pass a single color, an array of floats or an array of colors to that. Now you want to use this with AlgebraOfGraphics. You want to use the keyword color in the style / mapping call and feed it with some column from a data frame which has an arbitrary element type. So how does AlgebraOfGraphics know how to transform that input data. Is it hard-coded that color keyword means a transformation to color values is necessary? Does AlgebraOfGraphics create vectors of colors using internal palettes and passes those on directly, or does it pass on raw data and a color map with adequate ranges? What if I have a plotting function that takes the keyword hue, how can I tell AlgebraOfGraphics that colors are needed for this keyword? |
Ah I see. Going from arbitrary elements in your data to "plottable" things is done with scales (the interface is not fully chrystalized yet). For now AlgebraOfGraphics looks for an appropriate scale in theme(c) = AbstractPlotting.current_theme()[:palette][c]
spec(MyPlot, hue = theme(:color)) The scales need to be cleaned up at some point, probably getting a custom type rather than just lists, with support for continuous scales, and easier to customize themes. The clean interface is Last thing: concerning naming, I forgot to mention that our |
In grammar of graphics, every geom has a statistic and every statistic has a geom, so it would have made sense to call them layers as well ;) |
And I thought it would work like this (we can just make a separate issue though): mapping(:x, :y,
some_color_attr = :some_data => colorscale(log, palette = :viridis)) * layer(... |
Related question: do we have |
just to chime in on this from a user's perspective: I like mapping + layer, that would make it very clear IMO. Love the package btw, something like this has really been missing in the Julia plotting ecosystem! |
Oh forgot to respond to that last comment. Log colorscale just means that the data values are exponential and the linear color gradient maps to that exponential data. So the colorbar looks the same as usual, just with tick marks like 10, 100, 1000 You can of course achieve the same colors with a linear colorscale and log of the data first, but then your tick marks might be less intuitive if you're not used to exponents |
And we don't have that yet as the colorrange / colormap combination only has a min/max value combination, not a transform function |
EDIT: I am confused, disregard this for now... On Slack we discussed this a bit, and @piever suggested using |
So, ideas spitballed in slacks were:
Instead of the current |
I think For me, What I don't understand, yet, is how the current approach can support all possible plotting functions, no matter what their arguments and attributes are. Basically, we have arguments that are set based on grouped data (right now that's style) and arguments that are set manually (that's spec). Both of them can control visual aspects of the plot or statistical aspects, it's really the source of the attributes that's different. And I'm not sure if the current pipeline is generic enough to feed it any kind of plotting function. It feels like there are hard coded assumptions, for example that color is passed to a |
To add another voice to this discussion, the combination of |
So, from what I understand there is consensus about current
Agreed! I like
This will be fixed by the "scale" rework. In particular, one should allow |
I hadn't noticed that before, but |
Mapping sounds good! Are you done with your phd? If so, congratulations :) |
Yes, finally! Thanks :) |
I still get confused by the meaning of these. To me that suggests a better naming might be needed.
Style sounds to me like what spec is doing and spec sounds more like what style is doing. Both are not very clear about their use.
Style is explained as "the mapping from data to plot" so I'd suggest renaming it to
mapping
.spec
controls any other settings a grouping might have, so maybesettings
would be goodThe text was updated successfully, but these errors were encountered: