Code covered by the BSD License  

Highlights from
marginhist.m

4.83333

4.8 | 6 ratings Rate this file 14 Downloads (last 30 days) File Size: 1.69 KB File ID: #4359
image thumbnail

marginhist.m

by Peter Perkins

 

12 Jan 2004 (Updated 30 Nov 2009)

2D scatterplot w/marginal histograms.

| Watch this File

File Information
Description

This function creates a 2D scatterplot from two data vectors, and puts a univariate histogram for each vector at the horizontal and vertical axes of the plot.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
12 Jan 2007 Ken Mackay

just what I need

20 Nov 2008 Maximilien Chaumon

Perfect, should be included in future matlab versions.

10 Jan 2010 Mohammed

perfectt !!

06 Oct 2010 Scott McKinney

This function is quite good. However, for aesthetics, it would be nice to have that supporting line on the x-axis histogram as well as on the y-axis histogram.

This can be achieved by replacing
 subplot(2,2,4); bar(cx,-nx,1); h2 = gca; axis([xlim -max(nx)*1.01 0]); axis('off');

with

subplot(2,2,4); bar(cx,-nx,1); line(xlims,[0 0],'Color','k'); h2 = gca; axis([xlim -max(nx)*1.01 0.01]); axis('off');

27 Mar 2011 J G

is there any way to use this function in a subplot? Thanks!

14 Jun 2011 Allen

Would be great to have a switch to turn on or off either axis (for instance time-series data). Also would be wonderful to have hlines or vlines for std's whenever desired. (or a colored transparent rectangle showing 1 std)

Also would be wonderful to allow for multiple data sets. :) [I'm sure I can come up with more for you to code as well... great submission!]

Please login to add a comment or rating.
Updates
25 Jun 2009

change name, standardize header info, add copyright

30 Nov 2009

Rename to marginhist.m.

Tag Activity for this File
Tag Applied By Date/Time
specialized Peter Perkins 22 Oct 2008 07:12:38
plotting Peter Perkins 22 Oct 2008 07:12:38
scatterplot Peter Perkins 22 Oct 2008 07:12:38
histogram Peter Perkins 22 Oct 2008 07:12:38
vector Peter Perkins 22 Oct 2008 07:12:38
axes Peter Perkins 22 Oct 2008 07:12:38
plot Peter Perkins 22 Oct 2008 07:12:38
2d Peter Perkins 22 Oct 2008 07:12:38

Contact us at files@mathworks.com