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
Wrapped facet & wrapped concat / repeat #393
Comments
Should this be called ggplot uses the former, but essentially it's for creating trellis matrix. |
+1 |
We almost support this already. It's really easy with the new Vega layouts that we are already using. |
I guess one argument for saying facet = wrapped facet is that it will likely be used more often. (In a way, once we have wrapped facet, I suspect that people will use row/column mostly when they want to use both row and column?) |
@kanitw I like that idea. It has the added benefit that it removes the ambiguity of what it means if someone specifies both column and wrap, for example. This proposal lets you specify either:
but not both. |
I think (not 100% sure yet, though) I would prefer a different name for the encoding channel and a top level operator, i.e. something different from @kanitw latest code example. I'm (finally) landing on what I think is a really nice julia syntax for vega-lite, but the latest design iteration I have kind of relies on not having overlaps between the names of encoding channels and top level spec elements. |
@davidanthoff If you can give a brief example of how your API looks like that would be great. We might take that into consideration. That said, we will have to design what's best for the JSON format here so if the proposal to have Put
|
Sure. Nothing is final, at this point, but this is where I'm going right now. In general you pipe data into a spec. And the most verbose version of doing a spec resembles the JSON closely: data |> @vlplot(
mark=:bar,
encoding={
x={field=:field_a},
y={field=:field_b}
}
) And then I provide a number of shortcuts that make common cases easier. I have altair's shorthand, the ability to use data |> @vlplot(:bar,enc={x="field_a:q",y="field_b:q"}) I'd really like to also get rid of the nesting caused by data |> @vlplot(:bar, x="field_a:q", y="field_b:q") I think that is pretty much ideal for the simple and common cases at the REPL where I might just want to quickly explore a dataset. But this last step (optionally leaving out the You can look at many more examples here, here, here and here. All the examples are copied from either the vega-examples or the altair examples, and I've always pasted the original above the julia syntax so that one can easily compare. These notebooks don't yet use all of the simplifications I described in this comment here. |
@davidanthoff I see. I think you should distinguish between a Repl method for a single view spec ( |
Let me think about that. Right now the view composition is done mostly via various julia operator overloads (I don't have examples for all of those options up yet), which ends up being quite intuitive for the most part. |
In collisions are a concern, another option is to add a prefix to the encodings: |
@jheer proposes another alternative which is using
If both This syntax is nice in the sense that we preserve the existing syntax and only need to extend the facet spec with rows/columns. (Note that we can support That said, writing this spec down, I start to feel that I still like the one above that just simply has I also don't think that the MVP of this need to support wrapped facet with vertical flow. |
I like that. But how would you defined this when you are giving column or row in encoding? An alternative would be allowing one of the row/columns to be defined as it is and the other as a value. That would be read as: encode this data value as rows and use 5 columns. |
Not sure what you mean here. Can you elaborate? |
Something like this:
|
Or This would allow you to write wrapped facets in this "long" or the "short" form (with encoding). |
@eibanez We should not mix between number of |
I thought about it, and I think I kind of like the idea of additional top level things like
I think I'd also like to avoid that, it makes every case more verbose, which is something I'm trying to avoid. So, from my point of view ideally you guys would use something like |
I have to admit that I'm not a fan of having additional things like |
How does this work with arbitrarily nested specs? For example |
Just write it down as JSON, remove the quotes around key names, replace data |> @vlplot(
vconcat=[
{
mark=:bar,
encoding={
x=:foo
}
},
{
mark=:line,
encoding={
x=:bar
}
}
]
) There is a more convenient syntax to concat specs, but the raw thing just works as well. |
Another complicated issue is that for row/column facet -- we use headers to display labels for each subplot of the facet. However, for wrapped facet, we need to use a different mechanism (e.g., title of each subplot). For this reason, the schema of facet wrap's field definition may be different from facet row/column' field definition as it wouldn't have "headers". Or we will have to re-design how we specify facet title and labels. If we do the former, we shouldn't re-use facet row/column syntax for wrapped facet. |
@sirahd Do you want to look into this? |
I've summarize the proposed syntax in #393. So let's close this and continue our discussion there. |
The actual issue is #4457 |
Current vegalite supports small multiples only on one axis (with
row
/col
similar to Tableau)However, it's useful to create wrapped small mutliples (similar to
lattice
inr
/ ggplot)http://codealamode.blogspot.com/2012/02/trellis-graphs-in-ggplot2.html
or this example
The text was updated successfully, but these errors were encountered: