Thread Subject: move color bar title position

Subject: move color bar title position

From: David T

Date: 20 Nov, 2009 17:11:04

Message: 1 of 4

Hello all,
   I need to be able to move the title of the colorbar from its default center location to off to the right. Here is what i have been trying so far with a resulting issue.

h = colorbar('h',...);
set(get(h,'title'),'string','ppb');
locate = get(h,'title');
pos = get(locate,'position'); %it gives a position of 0.0500 2.900 1.0001
pos(1,1) = pos(1,1)+0.03;
set(locate,'pos');

Resulting message:
"A text's "Position" property does not have a fixed set of property values."

I've also tried using the 'location' option with same result

Anyone have an idea on how to set the position of the color bar title? I need to make many plots at once so using the plot editor is a last resort. Thanks for your help

 Dave-

Subject: move color bar title position

From: Nathan

Date: 20 Nov, 2009 18:47:31

Message: 2 of 4

On Nov 20, 9:11 am, "David T" <dtrac...@gmail.com> wrote:
> Hello all,
>    I need to be able to move the title of the colorbar from its default center location to off to the right. Here is what i have been trying so far with a resulting issue.
>
> h = colorbar('h',...);
> set(get(h,'title'),'string','ppb');
> locate = get(h,'title');
> pos = get(locate,'position'); %it gives a position of 0.0500 2.900 1.0001
> pos(1,1) = pos(1,1)+0.03;
> set(locate,'pos');
>
> Resulting message:
> "A text's "Position" property does not have a fixed set of property values."
>
> I've also tried using the 'location' option with same result
>
> Anyone have an idea on how to set the position of the color bar title? I need to make many plots at once so using the plot editor is a last resort. Thanks for your help
>
>  Dave-

Something I noticed:
when you typed "set(locate,'pos');" you failed to tell Matlab WHERE to
set the position of "locate".

If pos is the variable you are using for the new position, use
something like this:
set(locate,'pos',pos);

-Nathan

Subject: move color bar title position

From: David T

Date: 20 Nov, 2009 18:54:04

Message: 3 of 4

AWESOME! that was it. I didn't even see that, i had been staring at this script for awhile too. Thanks a lot. That makes things a lot easier.

 Dave-

Subject: move color bar title position

From: matt dash

Date: 20 Nov, 2009 19:06:07

Message: 4 of 4

"David T" <dtracy85@gmail.com> wrote in message <he6okc$l63$1@fred.mathworks.com>...
> AWESOME! that was it. I didn't even see that, i had been staring at this script for awhile too. Thanks a lot. That makes things a lot easier.
>
> Dave-

fyi, calling set with only the property name without a value is supposed to return a list of all allowable values, so the warning was telling you that position doesnt have a list of values (can be any two numbers).

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
colorbar David T 20 Nov, 2009 12:14:21
position David T 20 Nov, 2009 12:14:21
location David T 20 Nov, 2009 12:14:21
rssFeed for this Thread

Contact us at files@mathworks.com