Rotation of colormap for ellipsoid
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have plotted the ellipsoid using the surf() function and rotated it based on a condition. However, the colormap on the face of the ellipsoid is not rotating. I have a couple of ellipsoids in a single figure each rotated at different angles. So I need a separate colormap for each ellipsoid rotated w.rt its angle. I have attached a picture of the results I want:
Thank you for your support and time!
0 comentarios
Respuestas (2)
Abhishek Chakram
el 16 de Nov. de 2023
Hi Akash V,
I understand that you want to have different colormaps for different ellipsoid with respect to its angle. To achieve this, you can use the “colormap” function. It allows to set different colormaps for different axes objects. Here is an example for the same:
tiledlayout(2,1)
ax1 = nexttile;
surf(peaks)
colormap(ax1,spring)
ax2 = nexttile;
surf(peaks)
colormap(ax2,winter)
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram
0 comentarios
DGM
el 16 de Nov. de 2023
Editada: DGM
el 16 de Nov. de 2023
No code was provided, so we don't know how the objects CData relates to its ZData. We don't know what OP observed or expected, since it's really not clear whether the screenshot is an example of the problem (which is what it appears to be) or if it's an example of the goal (which is what is claimed).
Ether way, creating multiple axes and using a different colormap has nothing to do with the problem or its solution. This is a problem about CData, not the applied colormap.
If you create a surf using only Z or XYZ data, then CData is derived from Z, and CDataMode is 'auto'. If you rotate the surf object, CData will be updated to follow the transformed ZData.
% surf(Z)
% surf(X,Y,Z)
If instead, you explicitly specify CData when creating the surf, then CDataMode is set to 'manual'. In any case, if you want to be able to transform the object without the CData being updated, make sure the CDataMode is 'manual'.
% surf(X,Y,Z,Z)
For example:
[x y z] = sphere(20);
% CData gets updated
hs = surf(x,y,z);
rotate(hs,[1 0 0],-45)
view(-90,0)
% CData doesn't get updated
hs = surf(x,y,z);
hs.CDataMode = 'manual';
rotate(hs,[1 0 0],-45)
view(-90,0)
0 comentarios
Ver también
Categorías
Más información sobre Orange en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!