Showing posts with label J. Duda. Show all posts
Showing posts with label J. Duda. Show all posts

Thursday, January 15, 2009

Plotting in MATLAB / Making Plots Look Pretty

Alright, well, here's the scoop. Ditto wanted a v2.0 remake of a post that we started late last year. And, well, I give him whatever he wants. So, without further ado, here's Pretty Plots in Matlab, v2.0.

Using MATLAB to crank through some calculations, but having trouble making the plots pretty? Here's an example that should make a nice looking plot that's ready to be inserted into a report.

X=[1 2 3 4 5 6 7 8 9 10];
Y=X.^2;

xmin=0;
xmax=11;
ymin=0;
ymax=110;

figure
set(gca,'fontsize',14)
set(gcf, 'PaperSize', [8. 6.],'PaperPositionMode', 'auto');
plot(X,Y,'k^','markersize',10,'markerfacecolor','r')
legend('mylegend','location','northeast');
xlabel('my $x$ label','Interpreter','latex','fontsize',16);
ylabel('my $y$ label','Interpreter','latex','fontsize',16)
AXIS([xmin xmax ymin ymax])
print('-r600','-dpdf',['filename','.pdf'])

Copy, paste, and run, and you should get this (in the directory your current directory):



Alright, a quick rundown.

1. The 'figure' command is letting MATLAB know that we're making a picture with all the following attributes.
2. The 'set gca' command is setting the axes, which have the default handle 'gca', to have a font size of 14 here. This will control the size of the numbering on the axes, as well as the size of the font in the legend.
3. The 'set gcf' command is setting the paper size to 8" by 6", a size I find works well with the default figure output of MATLAB. This will prevent you from having to crop the plot later in a third-party photo editor.
4. The 'plot' command lists the X and Y arrays youd like to plot, 'k^' plots black upward facing triangles in a 'marker size' of 10pt, and filled red.
The 'legend' command puts in your legend, one entry per pair of vectors being plotted, in the northwest position.
5. The 'xlabel' and 'ylabel' commands are pretty straightforward, but the interpretter command displays the labels in the default LaTeX font instead of the MATLAB font. You can use the '$$' pairing to put in maths (the x and y).
6. The 'axis' command sets the range for x and y, just comment this out if you like what MATLAB does.
7. The 'print' command will save your figure as .pdf with the filename you specify in the current directory (where your .m file is). Here, you can always specficy a path if you'd like to save figures in a different folder.

Still to come, using str2num and num2str to automatically number plots that are part of a for loop, or to name output graphs based on input data.

Thursday, December 18, 2008

Pretty Plots in MATLAB

Using MATLAB to crank through some calculations, but having trouble making the plots pretty? Here's an example that should make a nice looking plot that's ready to be inserted into a report.

figure
set(gca,'fontsize',14)
set(gcf, 'PaperSize', [8. 6.],'PaperPositionMode', 'auto');
plot(X,Y,'k^','markersize',10,'markerfacecolor','auto')
legend('mylegend','location','northeast');
xlabel('myxlabel','Interpreter','latex','fontsize',16);
ylabel('myylabel','Interpreter','latex','fontsize',16)
AXIS([xmin xmax ymin ymax])
print('-r600','-dpdf',['filename','.pdf'])

Alright, a quick rundown.

1. The 'figure' command is letting MATLAB know that we're making a picture with all the following attributes.
2. The 'set gca' command is setting the axes, which have the default handle 'gca', to have a font size of 14 here. This will control the size of the numbering on the axes, as well as the size of the font in the legend.
3. The 'set gcf' command is setting the paper size to 8" by 6", a size I find works well with the default figure output of MATLAB. This will prevent you from having to crop the plot later in a third-party photo editor.
4. The 'plot' command lists the X and Y arrays youd like to plot, 'k^' plots black upward facing triangles in a 'marker size' of 10pt, and automatically filled.
The 'legend' command puts in your legend, one entry per pair of vectors being plotted, in the northwest position.
5. The 'xlabel' and 'ylabel' commands are pretty straightforward, but the interpretter command displays the labels in the default LaTeX font instead of the MATLAB font. You can use the '$$' pairing to put in maths.
6. The 'axis' command sets the range for x and y, just comment this out if you like what MATLAB does.
7. The 'print' command will save your figure as .pdf with the filename you specify in the current directory (where your .m file is). Here, you can always specficy a path if you'd like to save figures in a different folder.

Still to come, using str2num and num2str to automatically number plots that are part of a for loop, or to name output graphs based on input data.

Monday, July 7, 2008

Titaaataifa

Weee, another round of things I think are awesome, and therefore, are in fact, awesome.

You know what I love? How about "Pay-what-you-want-for-my-music-because-you-the-customer-are-truly-the-ultimate-critic" album pricing. I love that ish, seriously. And on top of that, it very well could be the the single thing that could save (or perhaps bury) the record industry.

I recently took the time to get into Girl Talk, the stage name of Greg Gillis, a mash-up DJ who seamlessly constructs a grand opera of today's R&B hits mixed with yesterday's rock ballads and everything in between. His albums make the perfect party play list, with the lyrics and beats recognizable enough to get every up out of their seats while at the same time sequences move quick enough that no one's attention span is betrayed (and that even goes for your hyperactive little brother after several boxes of hawiian punch).

Anyway, back to the point. What was unique to the Girl Talk pay what you want format for his newest album Feed the Animals was the incentives he offered for you to pay more. Triggered by a reaction similar to those prizes I wanted if I only sold a few more dollars of holiday junk for my middle school's fundraiser, I actually coughed up $13. If you were to offer up to five bucks and you'd get the mp3's. Five to ten dollars gets uncompressed FLAC files and the chance to additionally download one continuous file to avoid awkward gaps when putting the album on a disc. Anything over 10 and you get added to the list to have a hard copy mailed to you when the physical release drops. And this is all months before the CD will hit shelves.

What a smart idea. I know Radiohead has offered the pay-what-you-want format. And Stars offered up a digital edition of their newest album before a physical release. It all makes sense. The people that will pay will still pay with these other options. All it does is allow them the opportunity to hear the music as soon as it's available to all the big magazine critics without going through illegal channels while being the most honest critics of the musicians they already love and support.

Sunday, June 22, 2008

Music is so Awesome

Another three month recap...

1. Tokyo Police Club
2. Say Anything
3. Royksopp
4. Owen
5. Vampire Weekend
6. Cartel
7. Someone Still Loves You Boris Yeltsin
8. Death Cab for Cutie
9. Appleseed Cast
10. Mates of State

TPC is ridiculously good, so no surprise there. They are all good. Who am I kidding?

Friday, May 30, 2008

Titaaataifa

And were back. So much for a weekly column. Maybe the second time around. Anyway, let's get on to things I think are awesome, and therefore, are in fact, awesome.

A solar powered world would be amazing. Maybe in 20 years? Yes we can! CNN had a nifty little article about big solar collectors that would float in a geosynchronous orbit and beam energy back to the earth via electromagnetic waves. A Pentagon report reported that, "A single kilometer-wide band of geosynchronous Earth orbit experiences enough solar flux in one year to nearly equal the amount of energy contained within all known recoverable conventional oil reserves on Earth today."

Well then, why don't we do it? Apparently the billion-dollar-plus price tag is seen as too expensive, in addition to the fact that NASA has yet to produce an easier way to getting up into space. I wonder if the 500 billion we've dumped into the Iraq conflict could have footed the bill.

Fox News to show clip of E.T.

I always had a thing against Fox News, although I rarely could put my finger on it. Maybe it was their incessant spewing of right wing garbage while claiming themselves to be a more "legitimate" news agency. Well, they've proved their worthiness once again with this little number.

Thursday, April 3, 2008

1st Quarter Audio Recap

Top ten artists, 1/1/2008-3/31/2008:

1. Sufjan Stevens
2. Blink 182
3. Pompeii
4. Jack's Mannequin
5. Vampire Weekend
6. Say Anything
7. Chris Walla
8. Owen
9. Weezer
10. The Starting Line

I was at first surprised to see Blink that far up there, but I do roll through that playlist frequently enough. Nice work Pompeii, only 10 or 11 tracks released and you still get on the podium.

Oh, and in the spirit of March...

Last four out:

11. The Cure
12. Frou Frou
13. Stars
14. Nada Surf

Bubble watch!

Wednesday, April 2, 2008

Utilities

With all the social networking, instant messaging protocols, internet applications, email accounts, et cetera, anything that helps me consolidate is always advantageous. Listed here are a few sites I've found really useful over the last few months.

meebo.com
- It's been around for a while, but its simplicity always brings me back. Great for multi-protocol (aim, gtalk, yahoo, all at once) instant messaging while not at your own computer.

pidgin.im or adiumx.com - Great open source multi-protocol instant messaging clients for pc/linux and mac. Totally customizable, change the colors, the sounds, whatever. Add-free awesomeness.

twitter.com - Just got into this yesterday. Manage your status from IM or phone via sms and your status update can be relayed to all your IM accounts, facebook, myspace, blogs, and such.

senduit.com - Upload a file up to 100 mb and you'll get a private link to share with whomever you wish. You say how long the file is hosted, from 30 minutes to 24 hours.

socialthing.com - Still in beta, haven't been able to test yet, but looks amazing. Consolidate all the feeds from any social communities you may belong to.

Monday, March 3, 2008

A Regularly Played Out Hypothetical Situation

I'm sitting in my living room. I look outside. Wow, there's a broken down limousine outside in the street, and a man in a suit approaching my lovely home. I answer the door.

"Yes, can I help you?"

"I'm with Senator Obama, we are having some vehicle issues, may we come in while we wait for the backup vehicle to get here?"

"Sure, make yourself comfortable."

Would this really happen? No. Of course not. Why would anyone want to relax on my 1980's leather section (for which I have a deep love) when they could chill out in their limousine? There is no reason. But I'll continue the daydream anyway.

I'd probably offer him a beer, but I'm not sure if he'd take it. Maybe if it was late, and he was on the road for a while, and some secret service guy took a test sip to make sure it wasn't poisoned, or skunked maybe.

Either way it would be such a trip. Actually talking to someone and only asking the questions you care to know the answer about. Not watching Lou Dobbs be a dickhead on CNN. Just, being chums with Barrack Obama. Or McCain. Or whoever.

Next time I see a limousine at the end of the road I'm spreading tacks in front of my driveway. Like a fancy celebrity mouse trap. Only no glue pad or poison. Just tacks.

Tuesday, February 19, 2008

What is four loves four?

The simplest way to define that which seems temporarily indefinable is to break it down into it's more definable component parts. Let's try this.

We have these lovely bookends, four and four. What is four? Why are they there? What do they mean? Who put them there? How did they get put there? Where is there? Let's turn to Wikipedia. "4 (four) is a number, numeral, and glyph. It is the natural number following 3 and preceding 5. Four is the only number in the English language for which the number of letters in its name is equal to the number itself. This is also true in several other languages." Wow four. You've certainly got a lot going for you. I'm glad we picked you to be in the title of our lovely little project here. Thanks buddy.

So now to the crux of the matter, our centerpiece, love. Ask different people what love is and you're sure to get different definitions. Ask a tennis player and he or she might say zero. Why you ask? Well this I can explain without Wikipedia. Tennis was invented millions of years ago by the tyrannosaurus rex, and when making the rules the t-rex wanted love to by synonymous with no score, because he loved when his brontosaurus opponents had no score. It's fact. Check Wikipedia. In... five minutes (or when I'm done with this post). Anyway. Love is caritas. And our good Pope Benedict XVI was right when he said deus caritas est.

But most important. Four love four (404) is an html not found error. Like 404, you will not find material worthy of glossy-paged magazines, hard-cover books, or gold-frames here. What you will find is a wonderfully mediocre attempt at creativity by individuals who so desire to be creative, perfectly suitable not for the above, but for the gigantic trash-can that is the interweb. So keep posted, stay tuned, and click refresh in your browser from as many unique IP addresses as you can (it boosts our ego).

Until later,
Doodah