Thread Subject: Changing Legend transparency

Subject: Changing Legend transparency

From: Randy Yates

Date: 23 Nov, 2006 05:20:47

Message: 1 of 11

When I first add a legend, it has a black border and
it is non-transparent. If I execute "legend boxoff",
the black border goes away AND the legend becomes
transparent. How do I turn off the border and keep
the legend non-transparent?
--
% Randy Yates % "Midnight, on the water...
%% Fuquay-Varina, NC % I saw... the ocean's daughter."
%%% 919-577-9882 % 'Can't Get It Out Of My Head'
%%%% <yates@ieee.org> % *El Dorado*, Electric Light Orchestra
http://home.earthlink.net/~yatescr

Subject: Changing Legend transparency

From: Dorothy

Date: 22 Nov, 2006 23:51:27

Message: 2 of 11


"Randy Yates =D0=B4=B5=C0=A3=BA
"
> When I first add a legend, it has a black border and
> it is non-transparent. If I execute "legend boxoff",
> the black border goes away AND the legend becomes
> transparent. How do I turn off the border and keep
> the legend non-transparent?
> --
> % Randy Yates % "Midnight, on the water...
> %% Fuquay-Varina, NC % I saw... the ocean's daughter."
> %%% 919-577-9882 % 'Can't Get It Out Of My Head'
> %%%% <yates@ieee.org> % *El Dorado*, Electric Light Orchestra
> http://home.earthlink.net/~yatescr
You can right-click the legend frame and choose the "properities" to
edit it.

Subject: Changing Legend transparency

From: Geordie

Date: 23 Nov, 2006 12:19:27

Message: 3 of 11

Randy,

I take it that you just want to hide the box around the legend and keep the
background colour:

to do this I would set the edge colour of the legend to match the background
color. See below

Plot(x,y); % plot data
h=legend('test'); %create lengend
set(h,'EdgeColor',[1 1 1]); %set the edge colour of the legend to white
which should be the default of the background

SC





"Randy Yates" <yates@ieee.org> wrote in message
news:m3odqy20y9.fsf@ieee.org...
> When I first add a legend, it has a black border and
> it is non-transparent. If I execute "legend boxoff",
> the black border goes away AND the legend becomes
> transparent. How do I turn off the border and keep
> the legend non-transparent?
> --
> % Randy Yates % "Midnight, on the water...
> %% Fuquay-Varina, NC % I saw... the ocean's daughter."
> %%% 919-577-9882 % 'Can't Get It Out Of My Head'
> %%%% <yates@ieee.org> % *El Dorado*, Electric Light Orchestra
> http://home.earthlink.net/~yatescr

Subject: Changing Legend transparency

From: Randy Yates

Date: 23 Nov, 2006 14:25:38

Message: 4 of 11

"Geordie" <steve.corsbie@baesystems.com> writes:

> Randy,
>
> I take it that you just want to hide the box around the legend and keep the
> background colour:
>
> to do this I would set the edge colour of the legend to match the background
> color. See below
>
> Plot(x,y); % plot data
> h=legend('test'); %create lengend
> set(h,'EdgeColor',[1 1 1]); %set the edge colour of the legend to white
> which should be the default of the background
>
> SC

Hi SC,

Thank you for your response.

There is no such 'EdgeColor' property. Are we using the same version?
I'm using 6.1.0.450 (R12.1).
--
% Randy Yates % "She tells me that she likes me very much,
%% Fuquay-Varina, NC % but when I try to touch, she makes it
%%% 919-577-9882 % all too clear."
%%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO
http://home.earthlink.net/~yatescr

Subject: Changing Legend transparency

From: Randy Yates

Date: 23 Nov, 2006 14:34:28

Message: 5 of 11

"Dorothy" <dorothys.yuan@gmail.com> writes:

> "Randy Yates дµÀ£º
> "
>> When I first add a legend, it has a black border and
>> it is non-transparent. If I execute "legend boxoff",
>> the black border goes away AND the legend becomes
>> transparent. How do I turn off the border and keep
>> the legend non-transparent?
>> --
>> % Randy Yates % "Midnight, on the water...
>> %% Fuquay-Varina, NC % I saw... the ocean's daughter."
>> %%% 919-577-9882 % 'Can't Get It Out Of My Head'
>> %%%% <yates@ieee.org> % *El Dorado*, Electric Light Orchestra
>> http://home.earthlink.net/~yatescr
> You can right-click the legend frame and choose the "properities" to
> edit it.

Hi Dorothy,

Thanks for your response.

There are two problems:

  1. I can't see a property for the legend border
  2. I need to do this programmatically rather than interactively.

--Randy

--
% Randy Yates % "...the answer lies within your soul
%% Fuquay-Varina, NC % 'cause no one knows which side
%%% 919-577-9882 % the coin will fall."
%%%% <yates@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO
http://home.earthlink.net/~yatescr

Subject: Changing Legend transparency

From: Geordie

Date: 23 Nov, 2006 14:46:14

Message: 6 of 11

Randy,

I'm using 2006a and b.

I'll load up my r12 and see if I can get that to work

SC


"Randy Yates" <yates@ieee.org> wrote in message
news:m3slgaz1ct.fsf@ieee.org...
> "Geordie" <steve.corsbie@baesystems.com> writes:
>
>> Randy,
>>
>> I take it that you just want to hide the box around the legend and keep
>> the
>> background colour:
>>
>> to do this I would set the edge colour of the legend to match the
>> background
>> color. See below
>>
>> Plot(x,y); % plot data
>> h=legend('test'); %create lengend
>> set(h,'EdgeColor',[1 1 1]); %set the edge colour of the legend to white
>> which should be the default of the background
>>
>> SC
>
> Hi SC,
>
> Thank you for your response.
>
> There is no such 'EdgeColor' property. Are we using the same version?
> I'm using 6.1.0.450 (R12.1).
> --
> % Randy Yates % "She tells me that she likes me very
> much,
> %% Fuquay-Varina, NC % but when I try to touch, she makes
> it
> %%% 919-577-9882 % all too
> clear."
> %%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO
> http://home.earthlink.net/~yatescr

Subject: Changing Legend transparency

From: Geordie

Date: 23 Nov, 2006 15:18:43

Message: 7 of 11

Sorry Randy for building your hopes up, but I can't do it in release 12.1

They have added more functionality so I would suggest upgrading to a newer
version if you can

SC

"Randy Yates" <yates@ieee.org> wrote in message
news:m3slgaz1ct.fsf@ieee.org...
> "Geordie" <steve.corsbie@baesystems.com> writes:
>
>> Randy,
>>
>> I take it that you just want to hide the box around the legend and keep
>> the
>> background colour:
>>
>> to do this I would set the edge colour of the legend to match the
>> background
>> color. See below
>>
>> Plot(x,y); % plot data
>> h=legend('test'); %create lengend
>> set(h,'EdgeColor',[1 1 1]); %set the edge colour of the legend to white
>> which should be the default of the background
>>
>> SC
>
> Hi SC,
>
> Thank you for your response.
>
> There is no such 'EdgeColor' property. Are we using the same version?
> I'm using 6.1.0.450 (R12.1).
> --
> % Randy Yates % "She tells me that she likes me very
> much,
> %% Fuquay-Varina, NC % but when I try to touch, she makes
> it
> %%% 919-577-9882 % all too
> clear."
> %%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO
> http://home.earthlink.net/~yatescr

Subject: Changing Legend transparency

From: Jerome

Date: 23 Nov, 2006 10:43:02

Message: 8 of 11

Hi,

here are all the properties you need :

x = -pi:pi/20:pi;
plot(x,cos(x),'-ro',x,sin(x),'-.b')
h = legend('cos','sin',2);

set(h,'box','on', ...
'color','y', ...
'ycolor','m', ...
'xcolor','b', ...
'visible','on')

Jérôme

Subject: Changing Legend transparency

From: Randy Yates

Date: 26 Nov, 2006 22:10:04

Message: 9 of 11

Jérôme <dutmatlab@yahoo.fr> writes:

> Hi,
>
> here are all the properties you need :
>
> x = -pi:pi/20:pi;
> plot(x,cos(x),'-ro',x,sin(x),'-.b')
> h = legend('cos','sin',2);
>
> set(h,'box','on', ...
> 'color','y', ...
> 'ycolor','m', ...
> 'xcolor','b', ...
> 'visible','on')
>

Hi Jerome,

Thanks for that! A variation on your idea works for
the screen:

set((hl,'color','w','xcolor','w','ycolor','w');

However, when I print (print('file.eps','-depsc2'))
it's back to black borders. Arghh! How to get
no borders when PRINTING?!???
--
% Randy Yates % "With time with what you've learned,
%% Fuquay-Varina, NC % they'll kiss the ground you walk
%%% 919-577-9882 % upon."
%%%% <yates@ieee.org> % '21st Century Man', *Time*, ELO
http://home.earthlink.net/~yatescr

Subject: Changing Legend transparency

From: Jerome

Date: 27 Nov, 2006 02:42:39

Message: 10 of 11

Hi,

read this :

 <http://www.mathworks.com/support/solutions/data/1-16FH1.html>

You have to set the INVERTHARDCOPY property of the figure to OFF

Jérôme

Subject: Changing Legend transparency

From: Randy Yates

Date: 28 Nov, 2006 03:12:56

Message: 11 of 11

Jérôme <dutmatlab@yahoo.fr> writes:

> Hi,
>
> read this :
>
> <http://www.mathworks.com/support/solutions/data/1-16FH1.html>
>
> You have to set the INVERTHARDCOPY property of the figure to OFF

Actually I did not. I simply followed the instructions for
6.x. (Apparently it was a matter of setting the xcolor and ycolor not
to white but to the actual figure background color, which was [0.8 0.8
0.8] on my system. These then get converted to white when printing when
INVERTHARDCOpY is on.)

Thanks for your help, Jerome!
--
% Randy Yates % "And all that I can do
%% Fuquay-Varina, NC % is say I'm sorry,
%%% 919-577-9882 % that's the way it goes..."
%%%% <yates@ieee.org> % Getting To The Point', *Balance of Power*, ELO
http://home.earthlink.net/~yatescr

Tags for this Thread

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.

rssFeed for this Thread

Contact us at files@mathworks.com