Skip to content

Instantly share code, notes, and snippets.

@keysie
Created January 9, 2019 14:34
Show Gist options
  • Save keysie/2669a49e304dc5db320aa2c3114e0cdb to your computer and use it in GitHub Desktop.
Save keysie/2669a49e304dc5db320aa2c3114e0cdb to your computer and use it in GitHub Desktop.
MATLAB figures without white borders (even when saving)
Something that has bothered me for *the entire* time I’ve used it is that when you show images using ‘imshow’ the resulting figure has the image surrounded in a sea of gray border. Well, I hate that gray border. It serves no purpose and today I have figured out how to remove it!
Matlab runs a script called ‘startup.m’ when it starts. This is located in your ~/matlab/ directory. If you include this line into that file (or just type it before you make the figure) then you remove the gray border:
>>iptsetpref('ImshowBorder','tight');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment