フィルターのクリア

Fixing missing part of a figure from a plot

5 ビュー (過去 30 日間)
Tunde Adubi
Tunde Adubi 2023 年 8 月 25 日
回答済み: Voss 2023 年 8 月 25 日
After making a plot, the x-axis does not show all timestamp for 24 hrs period in the figure. See the image attached.
How can the 24th hour be included?
% Loop through each file
for idx = 1:120
% Full path to the netCDF file
ncFile = fullfile(fileList(idx).folder, fileList(idx).name);
% Extract timestamp from filename for plotting
timeStr = fileList(idx).name(19:24); % extracting HHMMSS from filename
% Convert to datetime for plotting
timestamps(idx) = datetime(['2022-07-15 ', timeStr(1:2), ':', timeStr(3:4), ':', timeStr(5:6)], 'InputFormat', 'yyyy-MM-dd HH:mm:ss');
end
% Plotting the time series
figure('position',[100 100 700 350]);
hold on
plot(timestamps, reflectivityData, '-k','LineWidth',1.0)
xlabel('Time (UTC)', 'FontSize',10);
ylabel('Corrected Reflectivity (dBZ)','FontSize',10);
set(gca,'ylim', [-10 50], 'fontsize', 10)
% Define specific timestamps for x-ticks
desiredTicks = datetime(2022, 7, 15, 0:1:24, 0, 0); % From 00:00 to 24:00 every 1 hours
% Set the x-ticks to the desired timestamps
xticks(desiredTicks);
xlim([datetime('2022-07-15 00:00:00', 'InputFormat', 'yyyy-MM-dd HH:mm:ss'), datetime('2022-07-15 23:59:59', 'InputFormat', 'yyyy-MM-dd HH:mm:ss')]);
title('Time Series of Corrected Z | 07-15 | ', 'FontSize',10);
grid on;
xtickangle(60);

回答 (1 件)

Voss
Voss 2023 年 8 月 25 日
Your xlim stop at 2022-07-15 23:59:59. Set it to 2022-07-16 00:00:00 instead.

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by