Animated 3D Scatter Plot (2024)

46 views (last 30 days)

Show older comments

Fabio Taccaliti on 20 Apr 2022

  • Link

    Direct link to this question

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot

  • Link

    Direct link to this question

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot

Commented: Star Strider on 20 Apr 2022

Accepted Answer: Star Strider

Open in MATLAB Online

Hello,

I would like to create an animated 3D scatter plot that is plotting the points included in the sub-array of a cell DD (102x1 cell), each sub-array is a 29x4 (where the last three column are the 3 coordinates (x,y.z)). Here below an example of my cell and sub-array.

M = [[0;0.2;0.2;0.4;0.6;0.6;0.6],rand(7,3)]

D = diff(find([1;diff(M(:,1));1]));

DD = mat2cell(M,D,4);

DD{:}

The animated scatter should display together each subarray points and then in a subsequent time step the next subarray points.

Here below the code that alreay plot all the points together.

figure(1)

for i = 1:numel(DD)

hold on; grid on; grid minor; axis equal;

set(gcf, 'Color', 'White');

set(gca, 'Fontsize', 12);

set(gca, 'ZDir','reverse')

scatter3(DD{i}(:,2),DD{i}(:,3),DD{i}(:,4))

view(3)

xlabel('x [mm]')

ylabel('y [mm]')

zlabel('z [mm]')

end

Thanks in advance

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Star Strider on 20 Apr 2022

  • Link

    Direct link to this answer

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#answer_946555

  • Link

    Direct link to this answer

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#answer_946555

Open in MATLAB Online

Try this slightly augmented version —

figure(1)

hold on

grid minor

axis([0 2 0 2 0 2])

for i = 1:numel(DD)

view(3)

set(gcf, 'Color', 'White');

set(gca, 'ZDir','reverse')

scatter3(DD{i}(:,2),DD{i}(:,3),DD{i}(:,4))

grid on

axis([0 2 0 2 0 2])

drawnow

pause(0.25)

xlabel('x [mm]')

ylabel('y [mm]')

zlabel('z [mm]')

end

hold off

It fixes the axis limits and adds drawnow and pause to create the animation.

Experiment to get the desired results.

.

6 Comments

Show 4 older commentsHide 4 older comments

Fabio Taccaliti on 20 Apr 2022

Direct link to this comment

https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2112910

  • Link

    Direct link to this comment

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2112910

Thanks a lot for the answer, the problem is that I would like to have axis equal on my plot but then in order to have it I need the hold on command and this involves that I will plot all the sub-array on top of each other without 'cleaning' the plot each time and plot just one sub-array each time with the 0.25s pause.

Do you know how can I fix it?

Star Strider on 20 Apr 2022

Direct link to this comment

https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113070

  • Link

    Direct link to this comment

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113070

Open in MATLAB Online

My pleasure.

When I run the code I posted, the plot does not ‘clear’. All the points are plotted and remain visible, with new ones appearing in each interation of the loop.

Add the axis equal call after the first axis call —

figure(1)

hold on

grid minor

axis([0 2 0 2 0 2])

axis equal

for i = 1:numel(DD)

view(3)

set(gcf, 'Color', 'White');

set(gca, 'Fontsize', 12);

set(gca, 'ZDir','reverse')

scatter3(DD{i}(:,2),DD{i}(:,3),DD{i}(:,4))

grid on

axis([0 2 0 2 0 2])

drawnow

pause(0.25)

xlabel('x [mm]')

ylabel('y [mm]')

zlabel('z [mm]')

end

hold off

Both of the axis calls are necessary.

.

Fabio Taccaliti on 20 Apr 2022

Direct link to this comment

https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113505

Sorry maybe from what I wrote was not clear.

I would like that the plot 'clear' each iteration without showing the one from the previous.

Now from this code the axis remain equal that is perfect, but still all the points are plotted and remain visible (which I would like to avoid ) and show just the point for each iteration.

I tried several combination of hold on and hold off but still nothing.

Star Strider on 20 Apr 2022

Direct link to this comment

https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113605

  • Link

    Direct link to this comment

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113605

Open in MATLAB Online

To do that, remove the hold calls —

figure(1)

grid minor

axis([0 2 0 2 0 2])

axis equal

for i = 1:numel(DD)

view(3)

set(gcf, 'Color', 'White');

set(gca, 'Fontsize', 12);

set(gca, 'ZDir','reverse')

scatter3(DD{i}(:,2),DD{i}(:,3),DD{i}(:,4), 'filled')

grid on

axis([0 2 0 2 0 2])

drawnow

pause(0.25)

xlabel('x [mm]')

ylabel('y [mm]')

zlabel('z [mm]')

end

.

Fabio Taccaliti on 20 Apr 2022

Direct link to this comment

https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113895

  • Link

    Direct link to this comment

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113895

Thanks a lot, now it works :)

Star Strider on 20 Apr 2022

Direct link to this comment

https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113955

  • Link

    Direct link to this comment

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113955

As always, my pleasure!

Sign in to comment.

More Answers (1)

Steven Lord on 20 Apr 2022

  • Link

    Direct link to this answer

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#answer_946860

  • Link

    Direct link to this answer

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#answer_946860

Open in MATLAB Online

Rather than recreating the scatter plot each time, I'd apply the first of the techniques listed on the Animation Techniques documentation page. If I ran this in MATLAB Answers you wouldn't see the animation, but if you run it in MATLAB you can.

% Sample data

theta = 0:15:360;

x = cosd(theta);

y = sind(theta);

% Create the initial "frame" of the animation

h = scatter(x, y, 'o');

% Control the axes so at its "widest" the whole circle still fits

axis([-5 5 -5 5])

% Make it look circular

axis equal

% At each frame, push each point outward (or pull it inwards)

for r = repmat([1:5 4:-1:2], 1, 10)

% Update the existing object's properties rather than creating a new one

h.XData = r*x;

h.YData = r*y;

% Let you see the animation

pause(0.1)

end

In the "real" animation you might want to use one of the options for drawnow instead of pause.

1 Comment

Show -1 older commentsHide -1 older comments

Fabio Taccaliti on 20 Apr 2022

Direct link to this comment

https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113900

  • Link

    Direct link to this comment

    https://matlabcentral.mathworks.com/matlabcentral/answers/1700565-animated-3d-scatter-plot#comment_2113900

Thanks Steven, I'll have a better look into this :)

Sign in to comment.

Sign in to answer this question.

See Also

Categories

MATLABGraphics2-D and 3-D PlotsAnimation

Find more on Animation in Help Center and File Exchange

Tags

  • plot
  • 3d

Products

  • MATLAB

Release

R2022a

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Animated 3D Scatter Plot (11)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

Animated 3D Scatter Plot (2024)

FAQs

Can a scatter plot be 3D? ›

3D scatter plots are used to plot data points on three axes in the attempt to show the relationship between three variables. Each row in the data table is represented by a marker whose position depends on its values in the columns set on the X, Y, and Z axes.

How to make a 3D animated series? ›

How are 3D Animation Videos Made?
  1. Step 1: Concept. Before any 3D animation comes to life, its idea must first take shape. ...
  2. Step 2: Storyboarding. ...
  3. Step 3: 3D Modeling. ...
  4. Step 4: Texturing. ...
  5. Step 5: Rigging and Skinning. ...
  6. Step 6: Animation. ...
  7. Step 7: Lighting. ...
  8. Step 8: Camera Settings.
Jun 17, 2024

How do you make an interactive 3D scatter plot in Python? ›

Generally 3D scatter plot is created by using ax. scatter3D() the function of the matplotlib library which accepts a data sets of X, Y and Z to create the plot while the rest of the attributes of the function are the same as that of two dimensional scatter plot.

Can 3D models be animated? ›

Animate Anything - Animate your own 3D models with AI

Upload your static 3D model and watch a fully rigged and animated 3D model pop out! Just hit the button below to get cracking straight from your browser. Crank up your creativity through the power and prowess of AI.

Can Excel do 3D scatter plots? ›

Where to Find the 3D Scatter Plot in Excel? A Scatter plot in excel is an in-built chart located under the Insert ribbon tab in Excel.

Can Excel plot 3D graphs? ›

First, go to the "Insert" tab in the Excel ribbon and click on the "3D Scatter" chart icon. This will bring up a list of available chart types. Select the type of 3D plot you want to create and click "OK".

How much does it cost to make a 3D animated series? ›

You can expect to spend between $5,000 to $25,000 per minute for a 2D animation. For 3D animation services, the cost range is typically higher, between $15,000 to $50,000 per minute.

Can I make 3D animation for free? ›

Use FlexClip's free 3D animation maker to produce a unique 3D animation for game, education, advertisem*nt, science or art creative expression at the speed of creativity! Browse through 3D animation video templates of different types, pick one to you need, and start your animation storytelling in 3D.

Is 3D animation hard? ›

From there, you define and paint surfaces and textures, and crucially “rigs”, analogous to bones and muscles, which aren't seen but will allow the human to move more realistically. All of this is incredibly hard, to the point that 3D artists will study anatomy in great detail to be able to do all of this better.

How do you animate a 3D plot in Python? ›

Approach:
  1. Import required module.
  2. Create a 3d figure.
  3. Create sample data.
  4. Animate 360 views of the graph.
  5. Display Graph.
Feb 18, 2023

How to make a 3D plot interactive? ›

Making the 3D Plot Interactive

To make our 3D plot interactive, we need to use the %matplotlib widget magic command, which we've already enabled at the beginning of this post. This command allows us to rotate, zoom, and pan the plot using our mouse or trackpad.

Can Python do 3D plots? ›

We could plot 3D surfaces in Python too, the function to plot the 3D surfaces is plot_surface(X,Y,Z), where X and Y are the output arrays from meshgrid, and Z=f(X,Y) or Z(i,j)=f(X(i,j),Y(i,j)). The most common surface plotting functions are surf and contour.

What AI can create 3D animation? ›

Krikey AI Animation tools use generative AI to create 3D Animations from text or video prompts. You can create animated videos in minutes and use their browser based video editor to add voiceovers, camera shot types, cool backgrounds and more. They even have templates to help you get started for free today!

How do you plot a scatter plot in D3? ›

How to create a scatter plot using D3
  1. Step 1: Dataset. Before even starting to code, we need a data set to base our chart on. ...
  2. Step 2: D3 and SVG container. ...
  3. Step 3: Set margin. ...
  4. Step 4: Set scale. ...
  5. Step 5: Add text. ...
  6. Step 6: Add axis. ...
  7. Step 7: Scatter dots.
Mar 19, 2021

What is the X Y Z scatter plot? ›

An XYZ class scatter plot is a scatter plot with symbols that mark the intersection of X, Y, and Z column data based on a required fourth value (Class column). Class scatter plots group data into discrete classes (bins). The data points are displayed using the symbol assigned to the class.

What is scatter map 3D? ›

A 3D scatter plot allows the visualization of multivariate data. This scatter plot takes multiple scalar variables and uses them for different axes in phase space. The different variables are combined to form coordinates in the phase space and they are displayed using glyphs and coloured using another scalar variable.

References

Top Articles
10 of the Best North Carolina Recipes - Big Bear's Wife
Vegetarian Skillet Chili Recipe
Hamlett Dobson Funeral Home Obituaries Kingsport Tn
El Paso Craigs
Kokomoscanner
サリスF70プッシュへのプッシュフルエクステンションヘビーデューティドロワーランナー
Car Parts Open Now
Fantasy football rankings 2024: Sleepers, breakouts, busts from model that called Deebo Samuel's hard NFL year
Butte County Court Oroville Ca
24/7 Walmarts Near Me
Myhr North Memorial
Find The Eagle Hunter High To The East
6023445010
Practice Assist.conduit.optum
Equity Livestock Altoona Market Report
Rainbird Wiring Diagram
Amazing Lash Bay Colony
Onderdelen | Onderdelen en services
Best Internists In Ft-Lauderdale
Overload RS3 Guide - Rune Fanatics
Osrs Toby
Excuse Me This Is My Room Comic
2012 Buick Lacrosse Serpentine Belt Diagram
Missing 2023 Showtimes Near Lucas Cinemas Albertville
Proctor Motors In Lampasas
Tamilrockers.com 2022 Isaimini
What is a Nutmeg in Soccer? (Explained!) - Soccer Knowledge Hub
modelo julia - PLAYBOARD
Bronya Build Prydwen
Rugged Gentleman Barber Shop Martinsburg Wv
Noel Berry's Biography: Age, Height, Boyfriend, Family, Net Worth
Rubios Listens Com
9132976760
Mtvkay21
Uhauldealer.com Login Page
Ancestors The Humankind Odyssey Wikia
Computer Repair Tryon North Carolina
Ucla Course Schedule
Culvers Flavor Of The Day Freeport Il
Whatcom County Food Handlers Permit
Ewing Irrigation Prd
How Much Does Costco Gas Cost Today? Snapshot of Prices Across the U.S. | CostContessa
Busted Magazine Columbus Ohio
Chess Unblocked Games 66
Neo Geo Bios Raspberry Pi 3
Watch Races - Woodbine Racetrack
Evangeline Shrine Club Banquet Hall Photos
Busted Newspaper Zapata Tx
Doctor Strange in the Multiverse of Madness - Wikiquote
Explain the difference between a bar chart and a histogram. | Numerade
Halloween 1978 Showtimes Near Movie Tavern Little Rock
Chase Bank Time Hours
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 6814

Rating: 5 / 5 (80 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.