Query logarithmic axis properties

After a plot is generated using semilogx, how do I query the x-axis properties, i.e., xLen, xMin, xScl?

回答 (2 件)

Steven Lord
Steven Lord 2022 年 3 月 5 日

0 投票

h = semilogx(1:10, 1:10);
ax = ancestor(h, 'axes')
ax =
Axes with properties: XLim: [1 10] YLim: [1 10] XScale: 'log' YScale: 'linear' GridLineStyle: '-' Position: [0.1300 0.1100 0.7750 0.8150] Units: 'normalized' Show all properties
Now query or change the properties of the axes whose handle is ax.

1 件のコメント

Joseph Powe
Joseph Powe 2022 年 3 月 7 日
The xScl number I was searching for, in the case of a log scale, is the distance in inches (for example) between cycles. This is the value as physically measured on a graph between the powers of ten.

サインインしてコメントする。

Joseph Powe
Joseph Powe 2022 年 3 月 5 日

0 投票

I tried this, but it does not give xScl. Is it derivable from the other ax attributes?

2 件のコメント

Steven Lord
Steven Lord 2022 年 3 月 5 日
If you're asking for clarification on an answer, please post that question as a comment on the answer rather than as a separate answer.
I'm not sure what you're looking for when you say xScl. My suspicion is that you're looking for the XScale property.
h = semilogx(1:10, 1:10);
ax = ancestor(h, 'axes');
ax.XScale % Indices that the X axis is in log scale
ans = 'log'
If you want to see all the public properties that start with X, for example, use tab completion. It will list potential completions for that partial command.
ax.x% and then press the Tab key
Joseph Powe
Joseph Powe 2022 年 3 月 11 日
The xScl number I was searching for, in the case of a log scale, is the distance in inches (for example) between cycles. This is the value as physically measured on a graph between the powers of ten.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeLog Plots についてさらに検索

質問済み:

2022 年 3 月 5 日

コメント済み:

2022 年 3 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by