Why is the SCATTER function much slower than the PLOT function in MATLAB?

I am plotting a large number of data points with the SCATTER function, and I would like to know why it takes much longer to use SCATTER than to use PLOT (with no LineStyle) for the same data.

 Accepted Answer

The SCATTER function creates a patch object for each data point, not a line object. Using PLOT with the same data creates a single line object. Therefore, even though each individual patch object might be simpler than the line object, the combination of the number of patch objects to be created, and the calculations necessary to determine the data used to create each patch, make the SCATTER function slower than PLOT.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!