plot_section#
- plot_section(title, data_draw, depth_array, lon_min, lon_max, lat_min, lat_max, path_save='.', name_save='figure', n_colors=100, n_ticks=5)[source]#
Plot a time–depth heatmap using
pcolormeshwith automatic color normalization and time formatting.The function visualizes a 2D time–depth dataset as a color-shaded heatmap, automatically selecting appropriate color limits (based on percentiles) and time axis tick intervals depending on the temporal span. The color scale uses a discrete “jet” colormap with
n_colorsbins and a horizontal colorbar.- Parameters:
title (str) – Title of the figure.
tstart (datetime.datetime) – Start time of the dataset.
tend (datetime.datetime) – End time of the dataset. Must be later than
tstart.data_draw (np.ndarray) – 2D array of shape (n_time, depth) containing the data to plot.
depth (np.ndarray) – 1D array of depth values (length must match the second dimension of
data_draw).path_save (str, optional) – Directory where the output image will be saved. Defaults to the current directory (“.”).
name_save (str, optional) – Base name of the output file (without extension). Defaults to “figure”.
n_colors (int, optional) – Number of discrete color bins for the colormap. Must be ≥ 2. Default is 100.
- Returns:
Full path to the saved PNG file.
- Return type:
str