move color bar title position

  • Follow


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- 
0
Reply David 11/20/2009 5:11:04 PM

On Nov 20, 9:11=A0am, "David T" <dtrac...@gmail.com> wrote:
> Hello all,
> =A0 =A0I need to be able to move the title of the colorbar from its defau=
lt center location to off to the right. Here is what i have been trying so =
far with a resulting issue.
>
> h =3D colorbar('h',...);
> set(get(h,'title'),'string','ppb');
> locate =3D get(h,'title');
> pos =3D get(locate,'position'); %it gives a position of 0.0500 2.900 1.00=
01
> pos(1,1) =3D pos(1,1)+0.03;
> set(locate,'pos');
>
> Resulting message:
> "A text's "Position" property does not have a fixed set of property value=
s."
>
> 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
>
> =A0Dave-

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
0
Reply Nathan 11/20/2009 6:47:31 PM


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- 
0
Reply David 11/20/2009 6:54:04 PM

"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). 
0
Reply matt 11/20/2009 7:06:07 PM

3 Replies
3833 Views

(page loaded in 0.051 seconds)

Similiar Articles:













7/19/2012 3:56:14 PM


Reply: