Makie.jl
Makie.jl copied to clipboard
DataInspector shall show img[row, col] = value
Description
Fixes https://github.com/JuliaPlots/Makie.jl/issues/2172
Type of change
- [x] New feature (non-breaking change which adds functionality)
This is how it looks now:
potential issue: 5 commits from my previous PR still appear here; they were merged into Makie/master as a unified commit; after merging Makie/master back into MariusDrulea/Makie/master, these individual commits still appear here, although the files are obviously the same
I think this is more of a misunderstanding. What DataInspector tells you here is how you need to index your data to get the value you are hovering over. That's not the same as telling you the axis coordinates.
img = [0 1; 0 0 ]
fig, ax, p = heatmap(img)
DataInspector(fig)
fig
for example shows the 1
in the top left corner and DataInspector correctly reports H[1, 2] = 1.000
for it.
Edit:
While writing a more detailed example, I realized DataInspector is pretty much correct. The issue is that I have to pass x'
as input and therefore img[20, 1] = x'[20, 1] = x[1, 20]
The detailed example (my argument is wrong here).
See the following example. In the top right corner the correct way do get the value is x[1, 20]
. Still the DataInspector shows img[20, 1]
.
Note I had to transpose x'
and reverse the y-axis in order to have the correct axis order for images, just like @jkrumbiegel did it today at the julia con- 2022 :). See line 37 in his code https://youtu.be/VT1XY1-fNlY?t=8869
using GLMakie
x = Float64.(repeat(1:10, 1, 20))
fig, ax, plot_obj = image(x', interpolate=false)
ax.yreversed = true
DataInspector(fig)
x looks like:
At the end I think we shall edit the default behaviour for images and heatmaps. We shall only call image(x)
and get the expected behavior. So no more transposition, no rotr90 and no more reverse of the yaxis.
I'll just close this since swapping the mouse position doesn't make this right and changing how images are interpreted is a different pr...