Why is the text function so terrible?
11 ビュー (過去 30 日間)
古いコメントを表示
The text funtion is absolutely terrible. The only way I can get it to put the text into an axis is to specify the properyvalue 'Parent' during the function call. It is also ridiculously (obscenely) slow. I can plot a 100,000 value dataset in microseconds but plotting an overlay of 30 or 40 2-point annotation lines and text labels takes up to 10 seconds.
Has anybody else built a text function that doesn't suck?
1 件のコメント
Walter Roberson
2011 年 11 月 9 日
>> for K = typecast(uint8('why is the text function so terrible????'),'uint32'); why(K);end
The very good engineer obeyed the tall system manager.
Bill told me to.
Loren suggested it.
The not excessively terrified and not excessively smart and bald bald engineer told me to.
The mathematician knew it was a good idea.
To please a young mathematician.
The bald and rich and smart and tall kid told me to.
The programmer knew it was a good idea.
He knew it was a good idea.
Damian wanted it that way.
回答 (1 件)
Jan
2011 年 11 月 9 日
Dear Alex,
The TEXT function draws to the current AXES object. If you want to add the text to another function, you can either activate the wanted AXES by axes(AxesHandle) or you can specify the 'Parent' property as in all other HG-objects. Thias is consistent and logical. Could you imagine any other reliable method to define where the text should appear?
If your program needs 10 seconds to create the annotations and text labels, this is most likely not a problem of TEXT:
figure;
drawnow;
tic;
for i = 1:40
text(rand, rand, 'asd');
end
drawnow;
toc
>> Elapsed time is 0.025448 seconds
I suggest to use the profiler to find the problem. Another idea would be to post the relevant part of the code in this forum.
8 件のコメント
Michael Richards
2020 年 4 月 14 日
編集済み: Michael Richards
2020 年 4 月 14 日
I have encountered a similar problem, and have come to the conclusion that the more text or plot objects that are on the figure, the more memory is taken up.
n = 0.05 % Distance between points
for x = -2:n:2 % horizontal movement
tic(); % start timer
for y = -2:n:2 % vertical movement
plot(x,y,"."); %
end
disp("Average Speed: "+(4/(n*toc()))+" points/s");
end
I use this structure to plot points when the information is conveyed by the colour of the point.
This starts satisfactorily fast, but slows down in an exponential decay.
Here's an example of a program output that uses this:
Mandelbrot
Full screen recommended
Distance between pixels (recommended 0.005): 0.01
Iterations, recommended 15: 9
Enter, or 'abort'
Average speed: 162.1917 points/s
Average speed: 84.7507 points/s
Average speed: 61.7526 points/s
Average speed: 48.826 points/s
Average speed: 41.3745 points/s
Average speed: 36.934 points/s
Average speed: 30.5935 points/s
Average speed: 25.0403 points/s
Average speed: 22.3318 points/s
Average speed: 21.1576 points/s
Average speed: 18.9941 points/s
Walter Roberson
2020 年 4 月 14 日
Yes, if you look in the mathworks blogs in around the R2014b / R2015a time, you will see that they show timing tests. Number of objects does have an effect. And whether it is line objects or scatter objects does have an effect. Also, if you were to use an animatedline() and addpoints() then that would change the timing.
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!