Slowing of program when adding legend.

Hi,
I'm plotting 4 functions in one graph and then adding a legend. For some reason adding the legend is really slowing the computation time - are there any things that slow the legend function down? For example I'm plotting vectors (about 20,000 elements) inside cell arrays in a for and if loop - does this sort of set up slow the legend function?
Any insight is appreciated,
Thanks!

답변 (1개)

per isakson
per isakson 2012년 10월 4일
편집: per isakson 2012년 10월 4일

0 개 추천

legend is slow, especially if it runs into trouble finding a suitable position. Specify a position and see if that improves the speed, e.g.
legend( ...,'Location', 'NorthEast' )

댓글 수: 4

Isktaine
Isktaine 2012년 10월 4일
I already have a location specified.
Matt Fig
Matt Fig 2012년 10월 4일
Sad but true, the legend function is very slow. I only use it at the very end of any code that calls it an I expect to wait.
per isakson
per isakson 2012년 10월 4일
  • Long ago I made a simple replacement for legend because I found it so slow.
  • You might check with profile too see what is going on.
Isktaine
Isktaine 2012년 10월 4일
Thanks, I had no idea it was slow in general - good to know!

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2012년 10월 4일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by