Proper Labeling of X & Y values Contour Plot

2 views (last 30 days)
Alex Pettit
Alex Pettit on 25 May 2022
Commented: Star Strider on 25 May 2022
Is there a way to use arrays for labeling the X&Y values of a Contour Plot ..
In this case, Y would be Frequency and X Time ( radio telescope data acq sequence )
  1 Comment
DGM on 25 May 2022
How are you using contour? If you're calling contour() with three arguments, it should have ticks and tick labels on both axes already.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 25 May 2022
Use the tick label properties to change the tick labels. Any new tick values have to be in the ranges of the current tick values, so changing them is not likely to produce the desired results.
[X,Y,Z] = peaks(50);
[c,h] = contourf(X, Y, Z);
Ax = gca; % Axes Handle
xt = Ax.XTick % Tick Values
xt = 1×7
-3 -2 -1 0 1 2 3
Ax.YTickLabel = xt*pi; % New Tick Labels
yt = Ax.YTick % Tick Values
yt = 1×7
-3 -2 -1 0 1 2 3
Ax.XTickLabel = yt-min(yt); % New Tick Labels
xlabel('Time (units)')
ylabel('Frequency (units)')
Star Strider
Star Strider on 25 May 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by