Changing the scale of axis in surf plot
Show older comments
Hello,
I plotted a 3D graph using 'surf' function. I want to change the axis scale to different values. My X-axis is 0:10:70. I want to convert X-axis to a scale having 0 at center of the axis and -35 and +35 on the both sides. Is it possible to do that?
Thanks in advance.

Accepted Answer
More Answers (1)
Mauro Gisbert Verdú
on 11 Mar 2020
0 votes
If you know the specific limits of your axis, may you use the x,y - ticklabels funtion. It works perfectly
Example:
xticklabels({80 85 90 95 100})
yticklabels({20 25 30 35 40})
2 Comments
Adam Danz
on 11 Mar 2020
I wouldn't recommend this approach because the real x and y values for your data are no longer represented in the plot. This makes troubleshooting difficult and it can be misleading to viewers who aren't familiar with the code or your future-self who has forgotten that he tick labels have been changed.
It's much better to change the actual x and y values in your data so that the axis ticks represent the actual data values.
Mauro Gisbert Verdú
on 11 Mar 2020
I agree, however when you work with codificated variables the response surface change acording to tbis data. Its more understadable plot with real variables although the plot was with the codificated.
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!