Plot graph of different color for different points? Matlab

Click For Summary
SUMMARY

This discussion focuses on plotting points with different colors in MATLAB. The user seeks to implement a loop that generates a curve, where each point is represented in a unique color. The provided code snippet demonstrates the use of the 'plot' function, while the 'scatter' function is suggested for visualizing multiple points with varying colors using the 'jet' colormap. The key takeaway is that MATLAB allows for dynamic color assignment in plots through indexing and colormap functions.

PREREQUISITES
  • Familiarity with MATLAB programming language
  • Understanding of plotting functions in MATLAB
  • Knowledge of colormaps in MATLAB, specifically 'jet'
  • Basic concepts of loops and indexing in MATLAB
NEXT STEPS
  • Explore MATLAB's 'colormap' function for advanced color mapping techniques
  • Learn about the 'hold on' command to overlay multiple plots in MATLAB
  • Investigate the use of 'scatter3' for 3D point plotting with color variations
  • Study MATLAB's 'plot' function options for customizing line styles and markers
USEFUL FOR

This discussion is beneficial for MATLAB users, data visualizers, and engineers looking to enhance their graphical representations by incorporating color variations in their plots.

cks
Messages
164
Reaction score
0
I would like to plot a curve with each point with different color.

For example

x0=2;
for i=1:1:200
x1=x0*cos(x0)+exp(x0);
plot(i,x1) (THIS IS THE PLACE WHERE I WANT TO PUT DIFFERENT COLOR)
x0=x1;
end
 
Physics news on Phys.org
scatter(1:10,2:11,50,jet(10))
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K