MATLAB: The scale of the x-axis (Format: HH:MM:SS)

axisdateformatplotscaletimetime seriesx axis

I have 2 imported columns from excel that I plotted already, the time column ( the format HH:MM:SS) is on the x-axis and the value column is on the y-axis.
The problem that I am trying to solve since both the columns are 1645 long (or better said: they contain 1645 rows), so I want to change the x axis scale on the graph to make the distance between the times somehow longer, otherwise it looks like a long unwanted line under the x-axis.
Any Ideas how to change the x-axis scale on the graph for a better appearance?
The second hurdle that I am facing, I keep getting the error below whenever I try to plot the average line of the value column on the same graph where the time and the value column are plotted. Maybe because the x and y axis are already used?
avgline= sum(value_column)/size(value_column),1); %the value_column and time column are already defined from the workspace)
nexttile
plot(time_column,value_column)
hold on
plot(avgline,'-r','LineWidth',2);
title('Value 6')
hold off
%The Error that I get:
%Values plotted against x-axis must be categorical values. To create categorical values, use the categorical function.

Best Answer

try looking into the 'xtick' property to specify which x-ticks you want to show. it'll suppress the rest of them
x=1:10; %demo time values
y=1:10; %demo data
plot(x,y) %create figure
set(gca,'xtick',[1 3 6 10]) %manipulate x-axis to only show some values