フィルターのクリア

How do I guage plotting speed when using the plot function?

2 ビュー (過去 30 日間)
Brad
Brad 2015 年 9 月 16 日
コメント済み: Brad 2015 年 9 月 23 日
I'm using the plot function to produce an XY plot of altitude versus time. The total number of data points is 21,834. Using the tic and toc commands, it is taking 227 seconds to plot all of these points. This seems a bit excessive. However, in reading the MATLAB documentation, as well as several other questions regarding this topic, I'm a bit confused as to what a reasonable expectation of plot time would actually be.
Is this a reasonable amount of time given the number of data points.

採用された回答

Mike Garrity
Mike Garrity 2015 年 9 月 16 日
Measuring graphics performance is kind of a rich topic. There are a couple of different variables which are important to consider. I've been writing introductions to some of these on the MATLAB Graphics blog:
Perhaps one of those posts would be a good starting point for you.
  3 件のコメント
Mike Garrity
Mike Garrity 2015 年 9 月 16 日
Then that's probably the case I talked about in Number of graphics objects. There are a number of possible workarounds in there. Be sure to check out the first comment on that post by Yair Altman for more good suggestions.
Brad
Brad 2015 年 9 月 16 日
It is similar and I'm looking to come up with a similar approach. Thanks again!!

サインインしてコメントする。

その他の回答 (1 件)

Kirby Fears
Kirby Fears 2015 年 9 月 16 日
編集済み: Kirby Fears 2015 年 9 月 16 日
Below is a simple test to show that plotting 21 thousand observations does not take long. The below plot is done in 0.005 seconds.
x=1:21834;
y=rand(1,21834);
plot(x,y)
Are you calling the plot function repeatedly? If you show some of your code, you may get help speeding up plot performance.
  5 件のコメント
Steven Lord
Steven Lord 2015 年 9 月 17 日
Try calling SCATTER instead of PLOT multiple times. You can specify the colors of the points to be displayed as a vector, which is used to map to the colormap, or as a matrix of RGB triplets.
rgbTriplets = dec2bin(0:7, 3) == '1';
colorIndices = randi([1 size(rgbTriplets, 1)], 10, 1);
colorOfEachPoint = rgbTriplets(colorIndices, :);
This generates 10 random point "categories" and creates a matrix with the corresponding color for each point's category in that point's row. All the points with index 1 should be black [0 0 0], 2 should be blue [0 0 1], etc.
[colorIndices, colorOfEachPoint]
Now use colorOfEachPoint as the C input to SCATTER.
Brad
Brad 2015 年 9 月 23 日
Steve, thank you. This approach works great!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by