needing help to use some codes
11 views (last 30 days)
Show older comments
I used the codes of "waterfall" and "surf" to draw three figures at once
Instead of all three figures being the same color, I want each figure to have a different color than the other. please guide me
0 Comments
Answers (1)
Umar
on 6 Aug 2024
Edited: Walter Roberson
on 6 Aug 2024
Hi @ Skill_s,
First, generate sample data using the peaks function to plot the figures. Then, create three separate figures using the figure command. For each figure, use the surf function to plot the data. Then, set a different colormap for each figure using the colormap function. By specifying different colormaps ('spring', 'summer', 'autumn'), each figure will have a distinct color scheme. This was help you visualize multiple figures simultaneously with unique colors, making it easier to differentiate between them effectively. Feel free to customize the colormaps further to suit your preferences and enhance the visual appeal of your plots. Here is example code snippet,
% Create data for plotting
[X,Y,Z] = peaks(45);
% Plot the first figure with a specific color
figure;
surf(X,Y,Z);
colormap('spring'); % Set colormap for the figure
% Plot the second figure with a different color
figure;
surf(X,Y,Z);
colormap('summer'); % Set a different colormap for the figure
% Plot the third figure with another color
figure;
surf(X,Y,Z);
colormap('autumn'); % Set a different colormap for the figure
Hope this will get you started now. Please let me know if you have any further questions.
0 Comments
See Also
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!