如何绘制两个方向的x轴

 Accepted Answer

Voss
Voss on 18 Mar 2022

0 votes

If I understand what you want to do, you can try something like this:
plot(-4:4,-4:4);
ax = gca();
set(ax,'XTickLabels',abs(get(ax,'XTick')));
Note that you would also have to update the XTickLabels whenever the XTicks change, e.g., when zooming or panning or potentially when the axes changes size.

2 Comments

weihan wang
weihan wang on 18 Mar 2022
thank you very much!
Voss
Voss on 18 Mar 2022
You're welcome!

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

on 18 Mar 2022

Commented:

on 18 Mar 2022

Community Treasure Hunt

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

Start Hunting!