Matlab Graph Axis Tick | Plot Advanced Edit1
When you draw a graph, the x-axis value or y-axis value is sometimes expressed in a way that you don't like.
For example, suppose you have the following graph.
The x-axis data is marked 'x10^4.' It is not easy to understand them at a glance.
Similarly, the y-axis is also marked 'x10^-3' and is not satisfactory.
Therefore, we want to attach k to the x-axis scale value and change the unit to mNm for the y-axis itself to express neatly.
The methods are as follows. Simply paste the code below after the plot function.
xticks([0 10000 20000 30000 40000 50000 60000])
xticklabels({'0','10k','20k','30k','40k','50k','60k'})
yticks([0 0.002 0.004 0.006 0.008])
yticklabels({'0','2','4','6','8'})
~ticks and ~ticklabels are sets, and you can enter the desired values corresponding to each tick value.
The results are as follows:
For your information, if you put '\pi' in ~ticklabels, you can make π, so please use it wisely.
----
xticks([0 10000 20000 30000 40000 50000 60000])
xticklabels({'0','10k','20k','30k','40k','50k','60k'})
yticks([0 0.002 0.004 0.006 0.008])
yticklabels({'0','2','4','6','8'})
----
'유용한 지식 > Matlab' 카테고리의 다른 글
Get Matlab Excel Data | xlsread function (0) | 2020.09.24 |
---|---|
Using the Matlab 'for Statement' | Loop Statement (0) | 2020.09.24 |
Using Matlab 'if Statement' | Assumption Statement (0) | 2020.09.24 |
Matlab subplot function (0) | 2020.09.24 |
Matlab Plot Function, Basic and Useful Tips (0) | 2020.09.24 |
댓글