можно ли сделать так, что бы сетка отображалась поверх 3D графиков?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pavel Kuzmitsky
am 20 Nov. 2020
Beantwortet: Walter Roberson
am 21 Nov. 2020
вот например есть график
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/421078/image.png)
я хочу что бы сетка была на переднем плане и накладывалась на изображение
4 Kommentare
Walter Roberson
am 20 Nov. 2020
you could perhaps create a second axes with color 'none' on top of the first, with linkaxes so that they rotate the same way, but the empty axes would be visually on top
Akzeptierte Antwort
Walter Roberson
am 21 Nov. 2020
fig = figure();
ax1 = axes('Parent', fig);
[X, Y] = meshgrid(1:50, 1:60);
Z = X.^2 + Y.^2 - cos(X.*Y);
surf(ax1, X, Y, Z, 'edgecolor', 'none');
ax2 = axes('Parent', fig, 'color', 'none', 'gridalpha', 1);
linkprop([ax1 ax2], {'Position', 'XLim', 'YLim', 'ZLim', 'View'});
grid(ax2, 'on');
Here the grid is on top of the surface. It is a bit difficult to tell that it is not the case that the surface is transparent with the grid below it, but in that case the grid would not appear as dark as it does here.
I would add a surface to this drawing, which would be a transparent grid, that is, the holes in the grid are transparent, and not the grid itself
You would not be able to do that just by using "grid on": there is a single grid alpha that is for the entire grid, with no way to make it selective. You would therefore have to draw the grid, such as using a surface or patch. For example surface with 'EdgeAlpha', 'interp' and 'AlphaData' being a 2D array the same size as ZData.
If you use that, then you do not need two axes: you can use a single axes with SortOrder set to 'childorder' https://blogs.mathworks.com/graphics/2014/11/04/sortmethod/
0 Kommentare
Weitere Antworten (0)
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!