How to calculate how many plot tick would exist if the axis completely filled the figure
Ältere Kommentare anzeigen
Hi,
Thank you in advance for your help.
I'm creating a plot in MATLAB which is then saved and loaded as a background image in other software. The other software then places overlays on top of the background image to create a user output. This other software needs to scale the overlayes to align with the background image, which creates the fairly unique problem I'm struggling with.
Say I have a plot that goes from 0 to 15 in the X axis and 0 to 7 on the Y axis. I need to calculate, if those axis were extended to the full size of the saved figure, what would the axis limits be?
So far I've written code to get the pixel size of the axis and the number of ticks. Then I calculate the number of ticks per pixel, them multiple that by the number of pixles in the figure. This gets me close but not perfect. I'm a little out. So I expect there is something else in the figure rather than just the axis which is taking up pixels.
For example.
If run spy I get this image:

...which is in a figure that's much larger than the axis. If I were to extend the axis to the edge of the figure, then what would be the min and max of each axis?
Its roughly this: (Which i did in paint)

In heindsite spy is perhaps a bad example image as the Y counts down but hopefully it gets my point across.
Thank you!
3 Kommentare
Adam Danz
am 14 Jan. 2021
Could you share a working example of what you've got so far so we can see what's wrong and address the issue?
I don't have a clear mental image of what you're asking.
Gregory Smith
am 14 Jan. 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

