Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8147499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:22:27+00:00 2026-06-06T14:22:27+00:00

So I have a plot of N points in the 2D plane (N can

  • 0

So I have a plot of N points in the 2D plane (N can be very large). I am writing a script that is to show the workings of an algorithm. So I have for loops. At each step in the for loop I’d like to change the color of the current point (actually probably make a stem plot with just this point).

However, at the end of the step I’d like to remove the coloring of the current point so that I can color the next one. Currently I have to redraw the whole plot (incl. the 2D points). I’m not sure whether Matlab detects such things in the plotting commands but is there a way to do this without redrawing the whole plot?

For example:

plot(x,y, '*');


for j = 1:N-1
    for i = j:N
        hold on;
        %Do stuff

        plot(x,y, '*');
        hold on;
        stem(x(1), y(1), 'g*');
    end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:22:29+00:00Added an answer on June 6, 2026 at 2:22 pm

    A quick example:

    %# plot some data
    x = 1:100;
    y = cumsum(rand(size(x))-0.5);
    plot(x,y,'*-')
    
    %# animate by going through each point
    hold on
    h = stem(x(1),y(1),'g');
    hold off
    for i=1:numel(x)
        %# update the stem x/y data
        set(h, 'XData',x(i), 'YData',y(i));
    
        %# slow down a bit, drawnow was too fast!
        pause(.1)
    end
    

    screenshot

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file of points (x, y) that I plot using gnuplot. If
I would like to plot points in two dimensional fashion (each have an x
I have an application that uses imagefilledellipse method (http://php.net/manual/en/function.imagefilledellipse.php) to draw plot points (circles)
I have the following code which lets the user plot two points on a
I have a plot (sample code pasted below) that I am trying to add
Maybe someone know how to solve this problem: I Have XY Plot with points
I would like to use Visualisation Toolkit to scatter plot points, each of which
I have a scatter plot with 10 points, some points are above and below
I have a plot like this: https://i.stack.imgur.com/zdike.png I need the data coordinates of points
I have a dataset with labels which I would like to plot with points

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.