Logical image() argument names & defaults to make images look like images #4186
Replies: 24 comments
-
I think the suggested defaults for
|
Beta Was this translation helpful? Give feedback.
-
I like that In the matlab documentation for ‘axis image’ it states it:
https://www.mathworks.com/help/matlab/ref/axis.html So perhaps I’m thinking of aspect ratio in the wrong way, but I think there is a decent chance of confusion given the typical 4:3 etc interpretation. Perhaps something like |
Beta Was this translation helpful? Give feedback.
-
From these matlab docs it seems that matlab gives both Another consideration is that for 3D plots you might want to set the aspect of all three axes, so the option should work for both 2D and 3D plots (though auto-scaling the axes independently doesn't make sense in 3D, right?) I think my favorite is:
I suppose I wish I could remember the result of some slack bikeshedding on this issue a while ago. Here are some other options that came to mind:
|
Beta Was this translation helpful? Give feedback.
-
I have the same favourite as Spencer |
Beta Was this translation helpful? Give feedback.
-
Me too. To be complete, while we're at it.. on the square pixels idea there is some precedent for |
Beta Was this translation helpful? Give feedback.
-
Right. The confusion seems to be whether an aspect ratio would apply to the axes or to the data. The point about 3D having more than one aspect ratio is a good one. I think we'll gain some clarity by talking about this in terms of coordinate systems and transformations. There's a whole bunch of coordinate systems here. At the least the following coordinate systems are important in this discussion:
Setting the aspect ratio to |
Beta Was this translation helpful? Give feedback.
-
In light of the above set of coordinate systems, I think the current setup with The remaining question is how one defines the Side note: I'm not quite sure what |
Beta Was this translation helpful? Give feedback.
-
To summarize, I don't think we need What we probably do need is more documentation for the coordinate systems, transformations and generally the rendering pipeline model used by Makie. Last I looked I remained confused about this. |
Beta Was this translation helpful? Give feedback.
-
Perhaps How about:
|
Beta Was this translation helpful? Give feedback.
-
Yeah, that's a good point. The use-cases of specifying the aspect ratio of the output plot vs. the displayed image data are separate and I was conflating them.
I think Makie has a somewhat divided identity - in some sense it's this very flexible 2D/3D graphics package with a scene graph and nested coordinate systems. On the other hand for many (probably most) users it's also a plotting library and they don't want to think about coordinate systems. I think it's important to provide an API to plotting users that doesn't depend on them thinking in terms of nested coordinate systems. Of course this isn't easy and do-what-I-mean can be dangerous, but there is a lot of precedent for plotting libraries so hopefully that can help.
Not necessarily, setting
That has the side-effect of actually changing the tick labels, which seems independent of changing the shape of the plot I also think |
Beta Was this translation helpful? Give feedback.
-
This. I think the key selling point of Makie is that it (so far) manages to seamlessly bridge these two worlds. |
Beta Was this translation helpful? Give feedback.
-
For sure, I'm not intending to suggest that understanding the coordinate transformation chain should be a requirement to use Makie. The reason I bring this up is clarify the development discussion. The challenge is to have a keyword which, as you say, is friendly for incidental uses, but in the backend is precisely defined in terms of how it affects the coordinate transformation chain.
Yes, but it seems we've already got a way to do this: the |
Beta Was this translation helpful? Give feedback.
-
I'm not actually following all the subtleties here, but to me an aspect ratio of 1 means that the scale of the y axis and the x axis is the same. Meaning that a 0,0 1,0 1,1 0,1 polygon will be square. |
Beta Was this translation helpful? Give feedback.
-
By this, do you mean the following:
This is what I mean when I say the |
Beta Was this translation helpful? Give feedback.
-
Yes that is what I mean. |
Beta Was this translation helpful? Give feedback.
-
As a path forward, I vote for converging on a replacement name for As I mentioned above, I vote for
I see this as a stretching of the plot canvas, but not the axes themself. To me, scaling a plot is a little ambiguous, but stretching a plot is clearer. Plus, if were to use |
Beta Was this translation helpful? Give feedback.
-
But as I mentioned above that also changes the axis ticks. I may not be fully understanding the nested coordinate systems described in your message above. Should
This is not what I described above. My suggestion was that having an aspect ratio of
|
Beta Was this translation helpful? Give feedback.
-
@ssfrr ok, how about:
|
Beta Was this translation helpful? Give feedback.
-
Right, the question is whether the I was hoping @SimonDanisch would chime in and describe the coordinate systems in use and their preferred names, if any. There are somewhat standard names for the coordinate systems used by OpenGL but Makie might need more.
I'd prefer to think of the coordinate systems as unchanging, and the |
Beta Was this translation helpful? Give feedback.
-
Let's re-ignite this thread and keep the conversation going! |
Beta Was this translation helpful? Give feedback.
-
FWIW, all of these changes will (probably) need to be implemented individually in the backends, since |
Beta Was this translation helpful? Give feedback.
-
I agree that it would feel right if Are there anyone thinking that it a bad idea? |
Beta Was this translation helpful? Give feedback.
-
Nope, I think everyone is on board with that, I just need to find some time to implement it... |
Beta Was this translation helpful? Give feedback.
-
#1406 implemented some of the transformations in a roundabout way. |
Beta Was this translation helpful? Give feedback.
-
Related to JuliaPlots/AbstractPlotting.jl#98, #295 and #205
With the caveat of not being someone with familiarity of the inner workings.. here's my suggestion for
image()
functionality, to make images appear like I think most people would expect them to. I've aimed for logical keywords that I might try before looking at the docs...Defaults for
image()
:transpose::Bool=true
- Swaps the x & y axes. Happens before the options belowflipy::Bool=true
- Prevents images looking upside downflipx::Bool=false
- A good option to have access to. i.e. front-facing cameras whereflipx
is common practicesquarepixels::Bool=true
- The equivalent ofscale_plot = false
.show_axis::Bool=false
- I think most would expect image() to show without the axes & grid@ssfrr @SimonDanisch
Beta Was this translation helpful? Give feedback.
All reactions