필터 지우기
필터 지우기

можно ли сделать так, что бы сетка отображалась поверх 3D графиков?

조회 수: 14 (최근 30일)
Pavel Kuzmitsky
Pavel Kuzmitsky 2020년 11월 20일
답변: Walter Roberson 2020년 11월 21일
вот например есть график
я хочу что бы сетка была на переднем плане и накладывалась на изображение
  댓글 수: 4
Walter Roberson
Walter Roberson 2020년 11월 20일
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
Pavel Kuzmitsky
Pavel Kuzmitsky 2020년 11월 21일
편집: Pavel Kuzmitsky 2020년 11월 21일
I don't quite understand how to do this, can a simple example? I get it so that the axes on top of the drawing completely cover it and it is not visible. Is it possible to create drawings that are superimposed on top of the previous ones, but are transparent? For example, 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

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 11월 21일
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개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by