Plotting a circle on top of a trisurf graph.

3 views (last 30 days)
Gideon Idumah
Gideon Idumah on 30 Nov 2021
Commented: Gideon Idumah on 30 Nov 2021
I have solved a finite element problem, and I am using trisurf to plot the result. However, I want to specify a circular patch centered at [-0.3, -0.2] with radius 0.12, which is an area that contains activity i want to track.
T_delaunay is the triagularization of the whole nodal point V of size 2923 nodes.
T_delaunay = delaunay(V(1,:)',V(2,:)');
T_delaunay = delaunay(V(1,:)',V(2,:)');
T0 = delaunay(V(1,c_nodes)', V(2,c_nodes)');
centers = [-0.3 -0.2]; radii = 0.12;
for i = 1:length(time)
[U1,U2,~,~] = unpack(u_sol(i,:)', N);
phi1_Glc = T(17)*(U1.Glc./(U1.Glc + M(17))); % Glucose
bux = U1.oxy;
Cfree = NaN*zeros(1);
for j = 1:length(bux)
Cfree(j) = XTotalToFree(bux(j));
end
phi1_O2 = lambda(21)*((Cfree' - U2.oxy).^k); % Oxygen
phi2_Glc = T(18)*(U2.Glc./(U2.Glc + M(18)));
Ogi = (phi1_O2)./(phi1_Glc - phi2_Glc);
ind = 0.001*(5.3811 - 4.8971); % protocol 2
axis_min = 4.8971 + ind;
axis_max = 5.3811- ind;
trisurf(T_delaunay,V(1,:),V(2,:),Ogi,'EdgeColor','none')
hold on
% trisurf(T0, V(1,c_nodes), V(2,c_nodes), Ogi(c_nodes),'EdgeColor','k', 'Linewidth',1)
caxis([axis_min, axis_max])
view(2)
% viscircles(centers,radii,'Color','k');
hold off
axis('square')
title (sprintf('OGI for Protocol %d at time = %g min', Protocol, time(i) ))
set(gca,'FontSize',12)
colorbar
pause(1)
end
However, the circular patch will not show. Here is the result.
I also tried to create a delaunay triangularization of the 41 nodes contained within the patch. I specify that as T0.
T0 = delaunay(V(1,c_nodes)', V(2,c_nodes)');
I get a result which shows the triangles. However, I do not want the triangles to show. All i want to see is the boundary of the circle of the patch.
I will appreciate any help I can get.
Thanks.

Accepted Answer

Benjamin
Benjamin on 30 Nov 2021
It may be that the circle is beneath the surface object. I mean, I would expect the circle's 'ZData' to be all zeros - the default - which is obviously less than the 'ZData' of the surface created by trisurf. (I don't have access to viscircles to investigate.) If this is what's going on, one way to correct it is to set the axes 'SortMethod' property to 'childorder'.
  1 Comment
Gideon Idumah
Gideon Idumah on 30 Nov 2021
Thank you @Benjamin that surely worked. I set the 'SortMethod' property to 'childorder' and I was able to see the circles using viscircles.
Thank you once again.

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by