File Exchange

image thumbnail

plotboxpos

version 1.4 (101 KB) by

Returns the position of a plotted axis region

45 Downloads

Updated

This function returns the position of the plotted region of an axis, which may differ from the actual axis position, depending on the axis limits, data aspect ratio, and plot box aspect ratio. The position is returned in the same units as the those used to define the axis itself. This function can only be used for a 2D plot.

Comments and Ratings (28)

Mike Wilson

Is there any way to view the readme file for plotboxpos that does NOT require using GitHub?

Lilla Horvath

Rob Campbell

Rob Campbell (view profile)

Just what I needed. Neatly coded. Thanks.

Arnaud Laurent

Arnaud Laurent (view profile)

Fritz

Fritz (view profile)

Pierre Morel

Pierre Morel (view profile)

  • 1 file
  • 126 downloads
  • 4.97619

Kelly Kearney

Kelly Kearney (view profile)

@Dmitry,

As noted in the help, this function is only intended for 2D plots. The math gets much messier for 3D; if someone else wants to figure those calculations out I'd be happy to incorporate them, but I don't really have the motivation to do so myself. I've updated the description on this page to reflect this limitation.

Dmitry

Dmitry (view profile)

Nice function, but it does not work for 3d plots with daspect([1 1 1]) !

J.R.

J.R. (view profile)

Please ignore my previous comment. It DOES work with colorbar present.

J.R.

J.R. (view profile)

This function does a great job. However, when the colorbar is present in the figure, the function returns the plotted axis region as if a colorbar doesn't exist. I was graphing a pcolor plot with the colorbar on when I discovered this.

maf

maf (view profile)

Tianhan

Nice Tool!
Saves me lot of time, thanks!

Eoghan

Eoghan (view profile)

Brilliant little function. Cheers!

Chad Greene

Chad Greene (view profile)

Thank you Kelly for solving a problem I've had for months. This function is well written. You've saved me a world of headaches.

Jeremy Fyke

Works as advertised - thanks.

Ajay

Ajay (view profile)

Claudia

Thanks so much. That's awesome!

This is fantastic. Thanks.

Mathieu

Brian Emery

Finds the position of the axes after modifying the DataAspectRatio and PlotBoxAspectRatio. This is exactly what I need, thanks!

Very useful function, thanks.
It's missing only a little test like:

if nargin < 1
h = gca;
end

and your function becomes perfect !
Thanks again.

dk

dk (view profile)

Jakob

Jakob (view profile)

Kelly Kearney

Carlos, getInUnits.m is available in the File Exchange: (http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8898&objectType=file). Sorry for the confusion; I will update the documentation on this page to clarify this.

Carlos Moffat

Kelly, getInUnits does not exist, as far as I can tall, as a MATLAB function.

Updates

1.4

Updated description to match the one on GitHub.

1.4

Linked to GitHub repository

1.3

- verified for R2014b graphics

1.2

Now defaults to current axis if no input provided. Also updated example image to a simpler one.

1.1

Small rewrite to remove dependency on external functions

Clarified use of another File Exchange function (getInUnits.m).

MATLAB Release
MATLAB 7.0.4 (R14SP2)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today