Data does not plot after setting XTick and XTick Label
Show older comments
I am trying to plot the data in the image such that the only Xaxis points that are shown are the ones that have a data point there. I find all the Xaxis point that have data and store them in an array called UniqueFreq.
UniqueFreq =
2012 2015 2018 2020 2023 1882 1885 1900 1915 1918
set(gca,'xtick',1:numel(unique(UniqueFreq)));
hold on
set(gca,'xticklabel',unique(UniqueFreq))
hold on
xlim([0 numel(unique(UniqueFreq))+1]);
hold on
ylim([(min(YLim) - 0.5) (max(YLim) + 0.5)]);
After I do the above I try to plot the data using:
plot(DataArray{i,8},DataArray{i,9},'-o');
hold on
Where the X value is always one of the values in the XTick, for example, a plot value would be: plot(2012,1.5); However when I do this nothing plots.
If anyone has any idea it would be really helpful.
Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!