MATLAB Answers

contour graph plotting and editting

2 views (last 30 days)
asd ad
asd ad on 13 Aug 2020
Commented: asd ad on 13 Aug 2020
Hello everyone,
I have this contour graph. I require the white part of the graph to be same colour as the relative humidity at 0%. How do I do this?
I have attached my graph and code to this question.
Thanks in advance
clear all
close all
clc
R1 = 0; R2 = 0.25; R3 = 0.5; R4 = 1; R5 = 2; R6 = 3; R7 = 4; R8 = 5;
R9 = 6; R10 = 7; R11 = 8; R12 = 9; R13 = 10; R14 = 12.5; R15 = 25;
L1 = 0; L2 = 1.5; L3 = 3; L4 = 4.5; L5 = 6; L6 = 7.5; L7 = 9; L8 = 10.5; L9 = 12;
L10 = 13.5; L11 = 15; L12 = 16.5; L13 = 18; L14 = 19.5; L15 = 20;
RL = [R1*L1 R2*L1 R3*L1 R4*L1 R5*L1 R6*L1 R7*L1 R8*L1 R9*L1 R10*L1 R11*L1 R12*L1 R13*L1 R14*L1 R15*L1;
R1*L2 R2*L2 R3*L2 R4*L2 R5*L2 R6*L2 R7*L2 R8*L2 R9*L2 R10*L2 R11*L2 R12*L2 R13*L2 R14*L2 R15*L2;
R1*L3 R2*L3 R3*L3 R4*L3 R5*L3 R6*L3 R7*L3 R8*L3 R9*L3 R10*L3 R11*L3 R12*L3 R13*L3 R14*L3 R15*L3;
R1*L4 R2*L4 R3*L4 R4*L4 R5*L4 R6*L4 R7*L4 R8*L4 R9*L4 R10*L4 R11*L4 R12*L4 R13*L4 R14*L4 R15*L4;
R1*L5 R2*L5 R3*L5 R4*L5 R5*L5 R6*L5 R7*L5 R8*L5 R9*L5 R10*L5 R11*L5 R12*L5 R13*L5 R14*L5 R15*L5;
R1*L6 R2*L6 R3*L6 R4*L6 R5*L6 R6*L6 R7*L6 R8*L6 R9*L6 R10*L6 R11*L6 R12*L6 R13*L6 R14*L6 R15*L6;
R1*L7 R2*L7 R3*L7 R4*L7 R5*L7 R6*L7 R7*L7 R8*L7 R9*L7 R10*L7 R11*L7 R12*L7 R13*L7 R14*L7 R15*L7;
R1*L8 R2*L8 R3*L8 R4*L8 R5*L8 R6*L8 R7*L8 R8*L8 R9*L8 R10*L8 R11*L8 R12*L8 R13*L8 R14*L8 R15*L8;
R1*L9 R2*L9 R3*L9 R4*L9 R5*L9 R6*L9 R7*L9 R8*L9 R9*L9 R10*L9 R11*L9 R12*L9 R13*L9 R14*L9 R15*L9;
R1*L10 R2*L10 R3*L10 R4*L10 R5*L10 R6*L10 R7*L10 R8*L10 R9*L10 R10*L10 R11*L10 R12*L10 R13*L10 R14*L10 R15*L10;
R1*L11 R2*L11 R3*L11 R4*L11 R5*L11 R6*L11 R7*L11 R8*L11 R9*L11 R10*L11 R11*L11 R12*L11 R13*L11 R14*L11 R15*L11;
R1*L12 R2*L12 R3*L12 R4*L12 R5*L12 R6*L12 R7*L12 R8*L12 R9*L12 R10*L12 R11*L12 R12*L12 R13*L12 R14*L12 R15*L12;
R1*L13 R2*L13 R3*L13 R4*L13 R5*L13 R6*L13 R7*L13 R8*L13 R9*L13 R10*L13 R11*L13 R12*L13 R13*L13 R14*L13 R15*L13;
R1*L14 R2*L14 R3*L14 R4*L14 R5*L14 R6*L14 R7*L14 R8*L14 R9*L14 R10*L14 R11*L14 R12*L14 R13*L14 R14*L14 R15*L14;
R1*L15 R2*L15 R3*L15 R4*L15 R5*L15 R6*L15 R7*L15 R8*L15 R9*L15 R10*L15 R11*L15 R12*L15 R13*L15 R14*L15 R15*L15];
H = [73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00 73.00;
70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17 70.17;
67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34 67.34;
64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19 64.19;
61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36 61.36;
58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53 58.53;
55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38 55.38;
49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72 49.72;
43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74 43.74;
37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76 37.76;
32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09 32.09;
23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60 23.60;
15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73 15.73;
7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87 7.87;
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00];
R = [R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15;
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15];
contourf(RL,R,H)
k = colorbar;
k.Label.String = 'Relative Humidity (%)';
xlabel('Length (\mum)')
ylabel('Radius (\mum)')

  5 Comments

Show 2 older comments
Rik
Rik on 13 Aug 2020
Be kind to yourself and use arrays next time, instead of manually writing every combination. You can use ndgrid, bsxfun, or .* to achieve that same result. repmat might also be useful.
Adam Danz
Adam Danz on 13 Aug 2020
源樹 上林, great answer.
If you copy the comment to the answers section the question will appear as answered and you can get credit for the answer.
asd ad
asd ad on 13 Aug 2020
Thanks a lot guys :) I'm a newbie

Sign in to comment.

Accepted Answer

源樹 上林
源樹 上林 on 13 Aug 2020
最後に追加。
cmap = colormap;
ax = gca;
ax.Color = cmap(1, :);

  0 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by