Scatter slows down exponentially over time

18 views (last 30 days)
Adeel Arif
Adeel Arif on 12 Nov 2019
Answered: Adeel Arif on 12 Nov 2019
Hello all,
I'm trying to run my code. Within a for loop, it plots x,y using scatter and continues to iterate. My problem is that when I try to see the code running in real-time using pause(1/1000000) (1 microsecond delay), the code starts slowing down exponentially upto the point that each scatter plots takes 1 second or more to appear on the graph. I timed my code and there is nothing slowing it down except scatter. Help is greatly appreciated.
performed a tic/toc of the scatter, results are attached.
  2 Comments
Walter Roberson
Walter Roberson on 12 Nov 2019
In other words, reduce the number of scatter objects -- they are expensive. You could aim for one per marker shape (okay, another layer for filled or not, and possibly one branch per marker edge color)
If I recall correctly from some old blog posts, after 100 points in a scatter object, scatter internally switches to patch representation.

Sign in to comment.

Answers (1)

Adeel Arif
Adeel Arif on 12 Nov 2019
Well I figured it out. Found this useful document. The axes limits were slowing the simultion down. May be this will be of help to others who encounter the same issue:

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!