Fractional position on plots

Position text or data relative to the frame of a plot, not necessarily relative to the data.
282 Downloads
Updated 10 Sep 2012

View License

Functions xput, yput, and zput return the respective x, y, or z coordinate of a given fraction of the full x, y, or z range of a plot. These are useful if you have several plots with different data ranges, but you want text or a marker to appear in the same position relative to the frame of each plot. Input argument is simply the fractional linear dimension from 0 to 1.

EXAMPLE:
x = -40:120;
y = x + 10*sin(x);
plot(x,y); hold on
plot(xput(.2),yput(.4),'rp','markersize',15)
text(xput(.1),yput(.9),'this is an example','fontsize',14)
text(xput(.6),yput(.25),'another example!','fontsize',16)
box off

Cite As

Chad Greene (2024). Fractional position on plots (https://www.mathworks.com/matlabcentral/fileexchange/38110-fractional-position-on-plots), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0