Clarity when you have multiple plots

조회 수: 1 (최근 30일)
Raushan . 2022년 8월 30일
댓글: Raushan . 2022년 9월 2일
Hey guys! I have one .csv file containing 8 columns. I want to plot 8th column (Time200) on x axis and remaining 7 columns on y axis. I did that but plots look messy, I mean its hard to interprate the difference among graphs. Is there any way to make these plots clear or interpratable. I will appreciate any kind of help. Thank you.

채택된 답변

Image Analyst
Image Analyst 2022년 8월 30일
편집: Image Analyst 님. 2022년 9월 2일
How about this:
% Initialization Steps.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
data = importdata('Plotdata.csv');
timeData =;
columnHeaders = data.colheaders;
[rows, columns] = size(timeData);
% Sort by column 8 in ascending order
timeData = sortrows(timeData, 8)
t = timeData(:, end); % Times are the last column.
% Make up colors for the plot lines
plotColors = jet(columns - 1);
% Plot columns 1 to columns-1
for col = 1 : columns - 1
y = timeData(:, col);
plot(t, y, '.-', 'Color', plotColors(col, :), 'LineWidth', 2, 'MarkerSize', 30);
hold on;
xlabel('Time', 'FontSize',fontSize);
ylabel('y', 'FontSize',fontSize);
grid on;
hold off;
legend(columnHeaders(1:end-1), 'Location', 'southwest')
[EDIT] plot with original data removed at poster's request.
  댓글 수: 3
Raushan 2022년 9월 2일
Thank you very much sir! It helps me a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)


Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by