Plotting text on the x-axis for residual analysis

1 回表示 (過去 30 日間)
BOB
BOB 2017 年 12 月 14 日
回答済み: Star Strider 2017 年 12 月 14 日
Hi,
I want to plot residuals against station name with station name on the x-axis. The x-axis values are in a 192x1 cell array called "ChannelsandStations".
The y-values are in a 192x1 double called "AvgPGVResidualperStation".
I'm aware of xtick but can't seem to make it work.
Any help would be much appreciated.
Thanks

回答 (1 件)

Star Strider
Star Strider 2017 年 12 月 14 日
I don’t entirely understand what ‘can't seem to make it work’ means, so this is a guess.
You probably need to use the set function to specifically define the x-tick properties you want:
Example
StationName = {'ABC','DEF','GHI','JKL','MNO','PQR','STU','VWX','YZ1'};
figure(1)
plot(rand(1, 9), rand(1, 9), 'p')
xl = xlim;
xtix = linspace(xl(1),xl(2),length(StationName));
set(gca, 'XTick',xtix, 'XTickLabel',StationName, 'XTickLabelRotation',90)
Similar options exist for the y-axis ticks. See the documentation on Axes Properties (link) for details and other options.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by