legend is too large

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

legend is too large

Octave - General mailing list
Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

siko1056
On 11/24/19 8:30 PM, LucaLuca via Help list for GNU Octave wrote:
> look this pics:
> https://gyazo.com/b1c42bdc4b1bdc6d3fb64e6e8f4bb4df
>
> is possible to reduce legend's plot?
>

To make it easier for us to help you, please provide some meaningful
portion of your code to reproduce that graphic and the version of Octave
you are using.  General advice: please look at the manual [1].  If you
create the legend by

   [hleg, hleg_obj, hplot, labels] = legend (...)

You might be able to get() and set() certain properties of the legend
object to your needs.

HTH,
Kai

[1] https://octave.org/doc/v5.1.0/XREFlegend.html


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

Octave - General mailing list
i send my code:

function canz

EquityO=sum((rand(1,60)),1);
EquityU=sum((rand(1,60)),1);
EquityU_2=sum((rand(1,60)),1);
EquityF=sum((rand(1,60)),1);
other=sum((rand(1,60)),1);

 x=1:length(EquityU);
 
grid on
hold on
plot (x,EquityU,'r',
x,EquityF,'b',x,EquityO,'g',x,EquityU_2,'m',x,other,'c');

hold off

legend ({'filter oth_eq',
'UnFiltred','Filtred','OneContract','UnFiltred_2'}, 'location',
'northwest');

 
endfunction



output:

https://gyazo.com/ca0abcf68d0b3ca02202063e96c184ac

i don't understand using help legend how can i reduce size



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

Octave - General mailing list
I forgot to write the version of octave that I use:

5.1.0



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

BGreen


On Tue, Nov 26, 2019 at 6:21 AM LucaLuca via Help list for GNU Octave <[hidden email]> wrote:
I forgot to write the version of octave that I use:

5.1.0



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



You can do this with the position property. It takes an array as an argument, with the first two arguments being the position and the last two being the width and height of the legend. Therefore, you can make the legend narrower by a factor of e.g. 0.75 by calling

lg1 = legend ({'filter oth_eq', 'UnFiltred','Filtred','OneContract','UnFiltred_2'}, 'location', 'northwest');
posvec_lg1 = get(lg1,"position");
set(lg1,"position",[posvec_lg1(1),posvec_lg1(2),0.75*posvec_lg1(3),posvec_lg1(4)]);



Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

Octave - General mailing list
hi BGreen

I tried your solution
sometimes it goes and does not go





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

BGreen

On Wed, Nov 27, 2019 at 11:08 AM LucaLuca via Help list for GNU Octave <[hidden email]> wrote:
hi BGreen

I tried your solution
sometimes it goes and does not go





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

We generally can't help if you don't give us the code that shows what you did.


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

Octave - General mailing list
excuse me..i give you code:


function canc

EquityO=sum((rand(1,60)),1);
EquityU=sum((rand(1,60)),1);
EquityU_2=sum((rand(1,60)),1);
EquityF=sum((rand(1,60)),1);
other=sum((rand(1,60)),1);

 x=1:length(EquityU);
 
grid on
hold on
plot (x,EquityU,'r',
x,EquityF,'b',x,EquityO,'g',x,EquityU_2,'m',x,other,'c');

hold off

lg1=legend ({'filter
oth_eq','UnFiltred','Filtred','OneContract','UnFiltred_2'},
'location','northwest');
legend boxoff
posvec_lg1 = get(lg1,"position");
set(lg1,"position",[posvec_lg1(1),posvec_lg1(2),0.1*posvec_lg1(3),posvec_lg1(4)]);

 
endfunction


https://gyazo.com/dfc93dd062172ea44bc701b2bd6b3b11





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

BGreen
On Wed, Nov 27, 2019 at 11:57 AM LucaLuca via Help list for GNU Octave <[hidden email]> wrote:
excuse me..i give you code:


function canc

EquityO=sum((rand(1,60)),1);
EquityU=sum((rand(1,60)),1);
EquityU_2=sum((rand(1,60)),1);
EquityF=sum((rand(1,60)),1);
other=sum((rand(1,60)),1);

 x=1:length(EquityU);

grid on
hold on
plot (x,EquityU,'r',
x,EquityF,'b',x,EquityO,'g',x,EquityU_2,'m',x,other,'c');

hold off

lg1=legend ({'filter
oth_eq','UnFiltred','Filtred','OneContract','UnFiltred_2'},
'location','northwest');
legend boxoff
posvec_lg1 = get(lg1,"position");
set(lg1,"position",[posvec_lg1(1),posvec_lg1(2),0.1*posvec_lg1(3),posvec_lg1(4)]);


endfunction


https://gyazo.com/dfc93dd062172ea44bc701b2bd6b3b11





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



The white box in the background is the legend area. It's already narrower than the text. Isn't narrowing it what you wanted? I have no idea what you mean by "sometimes it goes and does not go".


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

Octave - General mailing list
I want to restrict the area of the legend
Not the text of the legend



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

BGreen
On Wed, Nov 27, 2019 at 1:38 PM LucaLuca via Help list for GNU Octave <[hidden email]> wrote:
I want to restrict the area of the legend
Not the text of the legend



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



That's exactly what the code does. It alters area without altering text.


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

Francesco Potortì
In reply to this post by Octave - General mailing list
>I want to restrict the area of the legend
>Not the text of the legend

Luca, you cannot assume that people work for you.  This list is made of
people who like to help others working on Octave.  You should be
grateful for that and do your homework before asking.

You should tell us what you did (with code), what you want to do (with
examples, if possible) and what you did try and fail.  Without that, you
are asking us to do your work for you.  This is not what this list is
about.

Do you have code for reproducing your case?  Have you read the manual?
What pages exactly?  What have you understood?  What have you tried?

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it



Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

Octave - General mailing list
In reply to this post by BGreen
look this pics:

https://gyazo.com/5a02a32742131ef81a0e0a1f342ba99d


https://gyazo.com/608e7e27ef6c54c3b5758bf2d7e7e1e4

i've used different multiplier and the window width is the same (only the
size of the writing has changed)




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: legend is too large

BGreen


On Thu, Nov 28, 2019 at 4:57 AM LucaLuca via Help list for GNU Octave <[hidden email]> wrote:
look this pics:

https://gyazo.com/5a02a32742131ef81a0e0a1f342ba99d


https://gyazo.com/608e7e27ef6c54c3b5758bf2d7e7e1e4

i've used different multiplier and the window width is the same (only the
size of the writing has changed)




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



The font size is identical. The window width is all that has changed. In the pictures, you measured the window height, not the width.

Please find a way communicate clearly what you need before you ask for help next time. If you do not, I will not respond, and most likely no one else here will either.