How to just plot the data inside the minimum and maximum values in a figure?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I have 2 figures, From the frst figure I calculated the minimum and maximum y values from each x bin and then plotted these minimum and maximum values as dashed black line over second figure. My code:
y1 = y;
y1(isnan(z))= nan;
x1 = x(1,:);
minvalues = zeros(1,16);
maxvalues = zeros(1,16);
for k = 1:16
x2 = x1(:,k);
minvalues(k) = min(y1(:,k));
maxvalues(k) = max(y1(:,k));
end
plot(ax,x1,minvalues, '--k', 'Linewidth', 2)
plot(ax,x1,maxvalues, '--k', 'Linewidth', 2)
My second figure looks like this, I just want to plot data which is inside this boundary (minimum and maximum values). Outside area should be white. How can I do this? Thank you
2 comentarios
Walter Roberson
el 10 de Dic. de 2023
Do I understand correctly that you have another array, that is not x or y or z, that is being used to form the color portion of the plot? If so then are you using pcolor() or surf() or image() or imagesc() or something else to display that array at present?
Respuestas (1)
Image Analyst
el 10 de Dic. de 2023
Not sure what you mean but you can use xlim and ylim to set the ranges that are visible inside the plot box.
Regarding making some part of the graph white, we're also not sure how you're getting that colored gradient background. Are you plotting to a graph, or over (on top of) a digital image?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
6 comentarios
Image Analyst
el 11 de Dic. de 2023
nBin = 100;
Bin1 = logspace(-1, 2, nBin+1);
Bin2 = logspace(-1, 2, nBin+1);
[x, y] = meshgrid(Bin1, Bin2);
z_contour = Model1(x, y); %Contours are not displayed here
z_color = Model2(z_contour, x, y);
fig = figure;
set(fig, 'defaultFigureRenderer', 'painters')
set(fig, 'unit', 'centimeters', 'position', [50 10 13 11]);
ratio = fig.Position(3)/fig.Position(4);
axPos = [0.1 0.1 0.7 0.7*ratio];
ax = axes(fig, 'Position', axPos);
pc = pcolor(ax, x, y, z_color);
pc.EdgeColor = 'none';
ax.CLim = [-30 -15];
colormap(jet);
ax.XLim = [0.1 100];
ax.YLim = [0.1 1000];
plot(ax,x1,minvalues, '--k', 'Linewidth', 2) %I got Minimum and Maximum values from the lines of code I posted in my question
plot(ax,x1,maxvalues, '--k', 'Linewidth', 2)
How are YOU getting past that point?
Ver también
Categorías
Más información sobre Graphics Object Properties en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!