How to plot 3d vertical cross sections

13 visualizaciones (últimos 30 días)
Alex Tang
Alex Tang el 19 de Jun. de 2022
Comentada: Alex Tang el 20 de Jun. de 2022
The data are vertical sections and the data format is like: (lat,lon,height,value). The data is not in 3D volume so I think slice is not applicable in this case. Could anyone give me any tips on how to plot this kind of figures in Matlab? Many thanks.
The result should be like the following figure:
  2 comentarios
Jeffrey Clark
Jeffrey Clark el 19 de Jun. de 2022
@Alex Tang, do you have different height and value measures for the same lat-lon? Your vertical sections imply that you at least have small and large heights near the same lat-lon? Some data example needs to be looked at to find something that could work.
Alex Tang
Alex Tang el 20 de Jun. de 2022
Editada: Alex Tang el 20 de Jun. de 2022
Yes, Jeffrey and thanks for your response. The data(lat,lon,height,value)
(1,1,100,10)
(1,1,200,11)
(2,2,100,11)
(2,2,200,10)
(2,3,100,10)
(2,3,200,11)
... along the (lat,lon) line, there is a vertical profile with windspeed 10/11m/s at height 100 and 200 m, for example.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 19 de Jun. de 2022
I don't have code for that exactly but you can see how I did the following and adapt it to do what you want:
% Takes an RGB image and stacks the separate color channels at different Z levels.
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 13;
filename = 'peppers.png';
rgbImage = imread(filename);
% Extract the individual red, green, and blue color channels.
redChannel = im2double(rgbImage(:, :, 1));
greenChannel = im2double(rgbImage(:, :, 2));
blueChannel = im2double(rgbImage(:, :, 3));
H(1) = slice(repmat(redChannel,[1 1 2]),[],[], 1); %slice() requires at least 2x2x2
set(H(1),'EdgeColor','none') %required so image isn't just an edge
hold on
H(2) = slice(repmat(greenChannel,[1 1 2]),[],[], 2); %slice() requires at least 2x2x2
set(H(2),'EdgeColor','none') %required so image isn't just an edge
H(3) = slice(repmat(blueChannel,[1 1 3]),[],[], 3); %slice() requires at least 2x2x2
set(H(3),'EdgeColor','none') %required so image isn't just an edge
hold off
colormap(gray(256))
axis ij
caption = sprintf('R, G, and B Color Channels of %s', filename);
title(caption, 'FontSize', fontSize);
% Put up legend that says what slice is what color channel.
legend('B', 'G', 'R')
  3 comentarios
Image Analyst
Image Analyst el 20 de Jun. de 2022
I can't help you with those more complicated options like curved surfaces floating in space. You might have to call tech support.
Alex Tang
Alex Tang el 20 de Jun. de 2022
No worries. Anyway, thank you so much.

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by