Thread Subject: scatterhist with axis

Subject: scatterhist with axis

From: perfreem@gmail.com

Date: 30 Jan, 2009 15:15:53

Message: 1 of 6

hello,

i am using the scatterhist command to plot a scatter plot along with
its histogram. how can i make it so axes are added to the histogram
(the y axis), so that i know what each bar represents?

thanks you.

Subject: scatterhist with axis

From: Tom Lane

Date: 30 Jan, 2009 15:48:31

Message: 2 of 6

> i am using the scatterhist command to plot a scatter plot along with
> its histogram. how can i make it so axes are added to the histogram
> (the y axis), so that i know what each bar represents?

Here's one way:

   % Get all axes in current figure, make them visible
   set(findobj(gcf,'type','axes'),'visib','on')

-- Tom

Subject: scatterhist with axis

From: perfreem@gmail.com

Date: 30 Jan, 2009 16:52:11

Message: 3 of 6

On Jan 30, 10:48=A0am, "Tom Lane" <tl...@mathworks.com> wrote:
> > i am using the scatterhist command to plot a scatter plot along with
> > its histogram. how can i make it so axes are added to the histogram
> > (the y axis), so that i know what each bar represents?
>
> Here's one way:
>
> =A0 =A0% Get all axes in current figure, make them visible
> =A0 =A0set(findobj(gcf,'type','axes'),'visib','on')
>
> -- Tom

thanks, but i don't want all the axes to show, just the y axis of the
histograms... how can i find this axis id? i just want to be able to
interpret the height of every bar on the histogram.

Subject: scatterhist with axis

From: us

Date: 30 Jan, 2009 17:23:02

Message: 4 of 6

perfreem@gmail.com
> i am using the scatterhist command to plot a scatter plot along with
> its histogram. how can i make it so axes are added to the histogram
> (the y axis), so that i know what each bar represents...

one of the solutions

% the data
     x=randn(1000,1);
     y=randn(1000,1);
% the plot
     lh=scatterhist(x,y);
     bc=get(gcf,'color');
     set(lh(2:3),'visible','on','color',bc,'box','off');
% - x-axis hist
     set(lh(2),'xtick',[],'xcolor',bc);
% - y-axis hist
     set(lh(3),'ytick',[],'ycolor',bc);

us

Subject: scatterhist with axis

From: perfreem@gmail.com

Date: 3 Feb, 2009 00:20:03

Message: 5 of 6

On Jan 30, 12:23=A0pm, "us " <u...@neurol.unizh.ch> wrote:
> perfr...@gmail.com
>
> > i am using thescatterhistcommand to plot a scatter plot along with
> > its histogram. how can i make it so axes are added to the histogram
> > (the y axis), so that i know what each bar represents...
>
> one of the solutions
>
> % the data
> =A0 =A0 =A0x=3Drandn(1000,1);
> =A0 =A0 =A0y=3Drandn(1000,1);
> % the plot
> =A0 =A0 =A0lh=3Dscatterhist(x,y);
> =A0 =A0 =A0bc=3Dget(gcf,'color');
> =A0 =A0 =A0set(lh(2:3),'visible','on','color',bc,'box','off');
> % - x-axis hist
> =A0 =A0 =A0set(lh(2),'xtick',[],'xcolor',bc);
> % - y-axis hist
> =A0 =A0 =A0set(lh(3),'ytick',[],'ycolor',bc);
>
> us


when i do this, the histogram axes appear to have the right values but
are shown as negative numbers. any idea how to fix this?

thank you

Subject: scatterhist with axis

From: us

Date: 3 Feb, 2009 16:32:01

Message: 6 of 6

perfreem@gmail.com
> > one of the solutions
> > ...

> when i do this, the histogram axes appear to have the right values but
> are shown as negative numbers. any idea how to fix this...

one of the solutions

% the data
     x=5*randn(1000,1);
     y=.5*randn(1000,1);
% the plot
     lh=scatterhist(x,y);
     bc=get(gcf,'color');
     set(lh(2:3),'visible','on','color',bc,'box','off');
% - x-axis hist
     set(lh(2),'xtick',[],'xcolor',bc);
     set(lh(2),'yticklabel',abs(get(lh(2),'ytick')));
% - y-axis hist
     set(lh(3),'ytick',[],'ycolor',bc);
     set(lh(3),'xticklabel',abs(get(lh(3),'xtick')));

us

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
abs us 3 Feb, 2009 11:35:05
scatterhist us 30 Jan, 2009 12:25:06
randn us 30 Jan, 2009 12:25:06
graphics handle us 30 Jan, 2009 12:25:06
code us 30 Jan, 2009 12:25:06
rssFeed for this Thread

Contact us at files@mathworks.com