Archive

Posts Tagged ‘figures’

Convert images to data with Plot Digitizer

May 30th, 2011 2 comments

You’re scouring the internet for data to prove your point…
After hours of searching, you finally found it!
One problem – it’s a chart in a pdf…

Charts are better than nothing, but you really want to have the numbers in Excel or Matlab so you can do analysis and get big insights (or at least make a nicer-looking chart).

The answer is Plot Digitizer

   Click to continue →

Matlab: Figures without borders and toolbars

June 12th, 2007 15 comments

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');

Its glorious… Now the picture scales to fill the whole window! (note this only works with the ‘imshow’ command, not ‘imagesc’).

BUT! That’s not all. I also learned about some other cute little tricks that should be included in your startup.m (if you’re me at least).

%removes menu and toolbar from all new figures
>>set(0,'DefaultFigureMenu','none');
%makes disp() calls show things without empty lines
>>format compact;

I feel like these three commands cut a lot of the pointless (inefficient) crap out of Matlab’s default display interface. Thanks to commenter Matt who pointed me toward the set(0,’Default… thing. You can use this to set up *tons* of settings so that you don’t have to set it every time. Just call:

>>set(0,'Default');

For some other useful tips on exporting figures for papers, check this related post.

Categories: Matlab Tags: ,

Matlab TeXniques

January 29th, 2007 1 comment

Those of you who don’t know or don’t care what Matlab is… today’s post isn’t for you. Just skip it.

Now that the cool kids have left, us geeks can be alone: So, in my lab at GT we primarily use Matlab, so I’m trying to rekindle that romance after a torrid affair with C++ at Siemens. Unarguably, one of the best things about Matlab is how easy it is to visualize things. However, one little tidbit has always bugged me. There is always that damn big fat gray border around all of your figures. This is only mildly annoying while programming… but when it comes time to save figures out for a paper or a report annoying becomes infuriating. You have to scale and crop and zoom and you can’t script it well at all. (Not being able to script things is one of my pet peeves.)

But fear not dear friends… I have found the solution: exportfig. This is a great script for Matlab that lets you A) use tight borders for the figure, B) change the colors cleverly to black and white or grayscale, C) save the figure directly as a .eps file for easy integration with LaTeX! Here’s a nice page that explains how to use the library: Exporting Figures for Publication: Part 2.

One question that I haven’t been able to solve is how to eliminate that gray border in day-to-day usage. I pretty much never want it. If anybody has any suggestions, send them my way!

And, since I have the attention of all you Matlab-ers out there, I just got R2006a (this is the newest version). This baby rocks. It has a cool feature that allows you to execute code in little blocks called ‘cells.’ This is exactly how I debug and prototype, so it saves me a lot of highlighting and pressing [F9]. Check it out if you have the means to.

Categories: LaTeX, Matlab Tags: , ,