plot different data in one surface plot

1 visualización (últimos 30 días)
jun li
jun li el 23 de Abr. de 2021
Comentada: Cris LaPierre el 23 de Abr. de 2021
i want to plot different data on one surface plot. for example :the left half part of the axis plot data1 with colormap1 ,the right half part of the axis plot data2 with colormap2
how can i do that?
for example in x range [0,25] plot surf(peaks) x range[25,50] plot surf(sine(peaks))

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 23 de Abr. de 2021
One way to do this is to create a matrix with the results of peaks in 1-25 and sin(peaks) in 26-50.
mat = peaks;
mat(:,26:end) = sin(mat(:,26:end));
surf(mat)
view(2)
  2 comentarios
jun li
jun li el 23 de Abr. de 2021
thank you very much. but now these two data have the same colormap ,sometimes i want to give each data a different colormap, how can i do that
Cris LaPierre
Cris LaPierre el 23 de Abr. de 2021
In a surface plot, color is typically based on the Z value. I don't know of a simple way to apply two different colormaps, each to half of the axis. You would have to use a custom colormap, and most likely manually assign the colors using the color input.
Since this is a separate question, I'd suggest creating a new question to attract those with expertise doing this. As a first pass, consider looking at similar questions that have already been asked. Perhaps one of them contains a solution you can use.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by