Skip to main content

All Questions

Tagged with
0 votes
1 answer
381 views

Legend from two different plots on one single plot

So if I run my code I am supposed to get a legend for both the plots but I am getting only for one. Can someone please give a solution. I want both plots in one graph but the separate legend command ...
Chris Toomer's user avatar
0 votes
2 answers
2k views

Legend Location 'Best', but still in corner if possible

I want to set the Location of my legend to 'Best' (like legend('y1','y2','Location','Best')) so the legend doesn't collide with my lines, but at the same time, I would prefer to have it in a corner if ...
Max's user avatar
  • 1,481
2 votes
1 answer
6k views

Warning: Ignoring extra legend entries.

I am creating several plots. Each plot can have up to 5 lines. At the end of my code I am including the line: legend([line0 line1 line2 line3 line4],{'DN','D','R','ME','PP'}) However, sometimes some ...
phdstudent's user avatar
  • 1,104
36 votes
2 answers
65k views

Add custom legend without any relation to the graph

I wish to insert a legend that is not related to the graph whatsoever: figure; hold on; plot(0,0,'or'); plot(0,0,'ob'); plot(0,0,'ok'); leg = legend('red','blue','black'); Now I wish to add it to ...
jarhead's user avatar
  • 1,861
1 vote
1 answer
851 views

How to enlarge legend symbols?

I am plotting my data as %% Plot relative wrt to GT for each frame XIndx_lsd = linspace(1,592, size( accu_RE_lsdSlam, 1 ) ); XIndx_my = linspace(1,592, size( accu_RE_my_method, 1 ) ); plot( ...
mkuse's user avatar
  • 2,408
1 vote
0 answers
49 views

adding a legend in 3 for loops with three plots .MATLAB

l want to make a legend for my figure but l have 3 for loops with three plots like mentioned below : legend 1 : essential legend 2 : less essential legend 3 : most important for P=1:K % body ...
vincet's user avatar
  • 937
1 vote
1 answer
4k views

One combined legend entry for multiple plots

For some reason, I would like to plot the line and marker of the same data separately. data1 = (1:1:10)'; data2 = (1:2:10); figure(1); plot(data1,data1,'or'); hold on; plot(data2,data2,'-r'); legend('...
cgao's user avatar
  • 165
1 vote
2 answers
3k views

Custom Legend Matlab 2014b

I have a figure where I had some plots trough different functions using hold on. When I want to create my Legend, I don't have access to all the handle of my figures. Is there a way to create an ...
R.Falque's user avatar
  • 934
2 votes
3 answers
373 views

How to customize a legend in matlab plot window

As shown in the image below, the legend is too long for the plot window. what I want to do is: 1- To know how to split the legend over a second line? 2- To know how to shorten the red line in ...
Amrmsmb's user avatar
1 vote
2 answers
2k views

Concatenating 2D plots

I have several 2D-plots in MATLAB. In each plot there are some lines (each line is a row-vector of values of fixed length). There is always a base line (black one) and the remaining colored lines may ...
learner's user avatar
  • 1,219
1 vote
1 answer
347 views

Matlab text overflows legend

Very irritating there is enough size on the graph to widen the legend but it does not resize automatically to the content. Anyone a suggestion on how to fix this? (latex interpreter set to legend) ...
BigChief's user avatar
  • 1,505
2 votes
2 answers
10k views

how to change the sequence of the legend

I want to change the sequence of the legend. See the figure. I want the sequence to be: green and data2, blue and data3, black and data4, red and data1. Could anyone give a demo?
tqjustc's user avatar
  • 3,764
4 votes
1 answer
7k views

Matlab: subplot with sublegend

I want to add a legend at the bottom of a subplot (2 by 2): As you can see the charts in the 2nd row are squeezed a little bit because I manually adjusted it. Is there a function like sublegend(...) ...
Markus's user avatar
  • 773
0 votes
1 answer
3k views

Change figure legend text

I have a figure with several lines and a corresponding legend. For example: figure; hold all; plot(sin(1:0.1:10)); plot(cos(1:0.1:10)); legend('sin', 'cos'); I wonder if it is possible to change ...
texnic's user avatar
  • 4,049
1 vote
5 answers
331 views

Legend containing only specific plots

I have 10 curves in a plot, but only three of them should appear in the legend. For example, among 10 curves, just the first, 5th and 10th should be in the legend, how I can do this? Here's my ...
user3271929's user avatar

15 30 50 per page