-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Compact string notation for subplot_mosaic #18731
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
Comments
I'm not against |
The vertical bar definitely scans better though, I'm mostly 👍, only concern is adding |
I think if something gets added it should be keyword controlled like whitespace, but also wondering if at that point we're writing a patchwork expression evaluator (since | is vertical seperation and + is horizontal composition and I'm sure will be the next request from some folks even though it's implicit...) |
The string layout definition already restricts names to single characters. Therefore, the limitation would only be that you cannot name an Axes The only use case I could come up with, would be I don't think we should make everything configurable via keywords. This is a domain specific language and we're defining it. There's little point in allowing various dialects. I don't think we need to make everything controllable via keywords. This a mini-language and we're defining it. There's little point in allowing various dialects (Not even sure we want to keep As a side note, what we are doing is a bit different from patchwork expressions. Patchwork expressions are operators to compose elements (for the layout |
I read the patchworks docs wrong, and now I'm a little concerned that designating '|' as vertical when patchwork designates '|' as horizontal is gonna be very confusing. |
I am not super concerned about the dialect collision with patchwork, as @timhoffm says we are developing a mini declarative DSL that is sufficiently different we may not want to provide the false sense of similarity. |
I agree with most of @timhoffm points, but I'm mildly against a lot of parsing logic here. There is no need for this to grow more complex. |
In this case though patchwork was a direct motivator and we expect overlapping user base so this seems like a point of confusion that we kind of can anticipate and I don't get walking directly into that conflict, especially since as Anthony points out \n works (and then we don't need to do an extra level of parsing. |
My primary concern is: Which specification reads best and is most intuitive for our average user:
In my opinion, the first one wins by large. The concerns raised above are valid but don't outweigh that advantage. Re: Added complexityThe amount of extra work compared to the \n-version is negligible - probably one line of code and two lines of docs. Re: Relation to patchworkI acknowledge that moasic is inspired by one specific part of patchwork namely the textual layout mechanism. It's only that. We don't have anything to do with patchwork composition operators (also explicitly stated in the tutorial: "While we do not implement the operator overloading style, we do provide a Pythonic API for specifying (nested) Axes layouts." ). Patchwork does not allow single-line layout strings, so there cannot be a strong expectation how the line separation char should look like. If I'd have to define single-line layout string for patchwork, the row composition operator would be a strong suggestion. However, we have our own layout specification, which is only loosely related to patchwork; e.g. we chose to use a different empty placeholder by default. Given the association would only be indirect over two steps (mpl layout --> patchwork layout --> patchwork compostion operator), I don't by that patchwork users would be significantly confused. Moreover, only a minority of our users will know patchwork anyway. |
It'd be the R users who already tend to be (understandably) frustrated that we have a different paradigm. I very much worry about the frustration of '|' means vertical alignment here and 'I' means horizontal alignment in the closest analogue they also might be using concurrently. What about borrowing from the other layout and using "," so "AA,BB"? |
',' is easy to mix up with '.', which is our empty sentinel. A better variant would be
in analogy to multiple statements on the same line. |
I love the ';', it gets my vote! |
Reading below this line is at own personal risk. Just noted down some crazy ideas so that they don't get lost. This is not an official API propsal. At the danger of annoying everybody here again:
Oh, or alternatively mapping single chars to long names:
|
Instead of
should we also allow a short string version
?
Implementing is probably as simple as:
to get back to the long version.
I got the idea while trying to find a compact replacement for the plot in https://matplotlib.org/devdocs/gallery/subplots_axes_and_figures/axes_margins.html.
The text was updated successfully, but these errors were encountered: