File Exchange

image thumbnail

offsetAxes(ax)

version 2.0.0.0 (799 Bytes) by Anne Urai
Offset axes, mimicks Seaborn's 'despine' option for plotting

3 Downloads

Updated 09 Nov 2016

View License

In Python/Seaborn, there is the option to offset the x and y axis at the origin. This 'despine' pulls the x-axis down a bit, and the y-axis left, so that data that are close to either one become more visible. This function mimics the behaviour in a matlab plot, by changing the axis limits and covering the origin of the axes with a white line.

Comments and Ratings (4)

Laura

Laura (view profile)

Pierre Morel

Hi Anne, I was just looking into the possibility to integrate such functionality in gramm (I like the look!), and I convinced myself that there should be a cleaner way of doing this, without white lines/boxes. A trip to undocumentedmatlab and a few minutes later I found that in recent Matlab versions you can actually shorten axes lines by changing values in a.XRuler.Axle.VertexData and a.YRuler.Axle.VertexData. Additional hidden properties can be read with fieldnames(struct(a.YRuler.Axle))

Niels

Niels (view profile)

Daniel

Daniel (view profile)

Updates

2.0.0.0

Thanks to Pierre Morel and http://tinyurl.com/obtuh39, I updated the function to resize 'XRuler.Axle.VertexData' and 'YRuler.Axle.VertexData', and keeping this constant when resizing using a listener.

1.2.0.0

new file

1.2.0.0

added a user-defined option to mask data outside range

1.2.0.0

Instead of only masking parts of the axes we don't wan't, also cover this part of the data with a white area (in case xdata or ydata extend beyond current axis limits). Optimized for 4x4 subplots. Added use of plotboxpos by Kelly Kearney

1.1.0.0

Added screenshot, slack values adjusted for 4x4 subplot

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Acknowledgements

Inspired by: plotboxpos

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor