How to better graphically represent this data?

21 views (last 30 days)
Taiji on 11 Jul 2024 at 9:48
Edited: Hassaan on 11 Jul 2024 at 10:05
Greetings,
So I have three varaiables R1,R2 and R3. Each variable has an actual real value and a calculated value. For each variable I am calculating the error and storing them in variables called R1error, R2error and R3error. To represent this data in a table form is easy, I just make a table for each error with all possible combination values within the range. The problem comes when I want to graphically represent this data. If I follow the same logic, I will have three 3d graphs that will represent the error. But is there a better way to represent this data? For example if someone wanted to look up what is the error at R1 = 100, R2 = 200 and R3 = 300, they will have to look at the three separate graphs and come to conclusions which is not very intuitive since all the errors are related to each other. If someone has a better idea, I would be grateful for the help.

Hassaan on 11 Jul 2024 at 10:04
Edited: Hassaan on 11 Jul 2024 at 10:05
3D Scatter Plot with Color Coding
% Example data
R1 = rand(100, 1) * 100;
R2 = rand(100, 1) * 100;
R3 = rand(100, 1) * 100;
R1error = rand(100, 1) * 10;
R2error = rand(100, 1) * 10;
R3error = rand(100, 1) * 10;
% Calculate total error or any specific error you want to visualize
totalError = R1error + R2error + R3error;
% 3D scatter plot
scatter3(R1, R2, R3, 100, totalError, 'filled');
xlabel('R1');
ylabel('R2');
zlabel('R3');
colorbar;
title('Total Error Visualization');
2D Heatmaps in Subplots
% Example data (gridded for heatmap)
[X, Y] = meshgrid(linspace(0, 100, 20), linspace(0, 100, 20));
Z1 = rand(20, 20) * 10; % R1error
Z2 = rand(20, 20) * 10; % R2error
Z3 = rand(20, 20) * 10; % R3error
% Subplot for each heatmap
figure;
subplot(1, 3, 1);
imagesc(X(1,:), Y(:,1), Z1);
colorbar;
xlabel('R1');
ylabel('R2');
title('R1 Error Heatmap');
subplot(1, 3, 2);
imagesc(X(1,:), Y(:,1), Z2);
colorbar;
xlabel('R1');
ylabel('R3');
title('R2 Error Heatmap');
subplot(1, 3, 3);
imagesc(X(1,:), Y(:,1), Z3);
colorbar;
xlabel('R2');
ylabel('R3');
title('R3 Error Heatmap');
Parallel Coordinates Plot
% Combine the data into a single matrix
data = [R1, R2, R3, R1error, R2error, R3error];
% Parallel coordinates plot
figure;
parallelcoords(data, 'Labels', {'R1', 'R2', 'R3', 'R1error', 'R2error', 'R3error'});
title('Parallel Coordinates Plot of Errors');
xlabel('Variables and Errors');
ylabel('Values');

R2024a

Community Treasure Hunt

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

Start Hunting!