The following function IMAGE_SU_A_METRIC, using Makie.jl and CairoMakie.jl is meant to give an image of an input matrixSU_A_METRX using a couple of parameters from an input structure STR_DTA_AMT:
The above image is fine except for one problem. It is an array of 50 x 30 cells rather than a 51 x 31 one. Thinking that I was inadvertently cropping the extreme row/ column , I’ve even tried with bigger limits ax.xlimits = M_HARM+1 and ax.ylimits = N_HARM+1 but that doesn’t solve it, other than giving out the same image as the above with one empty outer row and column of cells.
Thanks for the idea, but an image and its underlying matrix should be identical, no matter how indexed. A matrix of 2Ă—2 size must be seen as 2Ă—2 cells in the image.
And then, Julia matrix indexing begins from 1 and not 0.
As one could see, the change was ax.limits! in place of ax.limits. But what I’m frustrated about is that the documentation doesn’t make it clear on why resetting axes limits would make it work correctly. Hope Makie’s developers would do something about bringing out clearer documentation like in Matlab, else all their good work could needlessly go ignored.
I don’t know why that doesn’t error because ax.limits! doesn’t exist but in effect you’re not setting any limits which makes my previous suggestion go into effect. Your limits start at 0 now so you can see all the pixels. This has nothing to do with indices being 1-based in Julia. The image plot is considered to lie on a “quad” which is just a rectangle stretched over part of the data space. And by default that rectangle goes from 0 to n_pixels on each side.
You can alternatively try heatmap which is cell-based so you’ll get one cell centered on the numbers from 1 to n by default which seems to be the representation you want.
And oh yes, I’ve tried heatmap before settling onto image. image is what’s recommended because heatmap rendering takes longer. In regard to my issue though, heatmap produced nothing different.
Julia indexing (matrix or image) is never from 0 and always from 1. The docs clarify this.
It is not, the docs are talking about the limits! function which is an alternative to setting ax.limits directly, which is the usual way to change attributes. In that sense all attributes are already “mutating”, so they don’t need ! variants.