2d line plot
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Giulia
el 23 de Mayo de 2023
Comentada: Star Strider
el 30 de Mayo de 2023
Hi all,
I have temperature data for different depths over time. I'd like to display it with a coloured line plot that shows lines at the different depths filled with the temperature gradients over time (see example below). Attached are variables of depth, time and temperature for 0 meters. Anyone can give some help on how to do this?
Thank you in advance!!
0 comentarios
Respuesta aceptada
Star Strider
el 26 de Mayo de 2023
The problem with the data is that the temperature does not vary much with the depth, and then only at the ends —
load('temp0')
load('depth0')
load('time0')
whos
temp0s = [min(temp0) max(temp0)]
depth0end = depth0(end);
depth0(end) = NaN;
figure
patch(time0, -depth0, temp0, 'EdgeColor','interp')
hold on
scatter(time0(end), -depth0end, 5, temp0(end), 'filled', 's')
hold off
cb = colorbar;
cb.Label.String = 'Temperature (°C)';
colormap(turbo)
xlabel('Time')
ylabel('Depth')
figure
plot3(time0, -[depth0(1:end-1); depth0end], temp0, ':k', 'LineWidth',0.25)
hold on
scatter3(time0, -[depth0(1:end-1); depth0end], temp0, 3.5, temp0, 'filled', 's')
hold off
cb = colorbar;
cb.Label.String = 'Temperature (°C)';
colormap(turbo)
grid on
xlabel('Time')
ylabel('Depth')
zlabel('Temperature')
.
4 comentarios
Más respuestas (1)
Walter Roberson
el 23 de Mayo de 2023
You can use File Exchange contributions such as https://www.mathworks.com/matlabcentral/fileexchange/8597-plot-3d-color-line or https://www.mathworks.com/matlabcentral/fileexchange/19476-colored-line-or-scatter-plot
2 comentarios
Ver también
Categorías
Más información sobre Data Distribution Plots 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!