Mesh plot with only every nth line plotted?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Guido
am 10 Okt. 2014
Kommentiert: Guido
am 10 Okt. 2014
Hello,
is it possible to reduce the number of plotted lines in a mesh-plot without loss of accuracy? I know, I can reduce the number of data points. But in this case the accuracy of the mesh-plot gets quite bad (see exsample below). Is there any way to say "mesh" to show only every nth line of the wireframe?
% [Matlab]
[DataX,DataY,DataZ] = peaks(100);
subplot(1,2,1);
mesh(DataX,DataY,DataZ,'EdgeColor','k');
subplot(1,2,2);
mesh(DataX(1:10:end,1:10:end),DataY(1:10:end,1:10:end),...
DataZ(1:10:end,1:10:end),'EdgeColor','k');
% [/Matlab]
Best regards
Guido
[Edit] Really bad mistake in writing corrected. [/Edit]
0 Kommentare
Akzeptierte Antwort
Mike Garrity
am 10 Okt. 2014
There isn't a nice automatic way to do it, but it's not too hard. You need 3 surfaces. One for the white background, one for the row edges, and one for the column edges. It would look something like this:
rskip = round(linspace(1,size(DataZ,1),32));
cskip = round(linspace(1,size(DataZ,2),32));
surf(DataX,DataY,DataZ,'FaceColor','white','EdgeColor','none');
hold on
surf(DataX(rskip,:),DataY(rskip,:),DataZ(rskip,:),'FaceColor','none','MeshStyle','row');
surf(DataX(:,cskip),DataY(:,cskip),DataZ(:,cskip),'FaceColor','none','MeshStyle','column');
hold off
The reason for this is that you want to reduce the resolution between edges, but not along edges.
Weitere Antworten (1)
Thorsten
am 10 Okt. 2014
If you reduce the number of lines the plot will usually be less accurate, unless in special cases where you have, e.g., a plane. The only thing you can do is to find a compromise between accuracy and line number that fits your needs.
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!