예를 들어 이 그림에 표시된 것처럼 그래프의 여러 부분에서 축의 크기를 다르게 조정하는 방법입니다. 비슷한 그래프가 있는데 X 좌표가 작아서 시작 부분의 점이 Y 축에 너무 가까워지는 것이 마음에 들지 않습니다. 어떻게 해결할 수 있나요?
\pgfplotsset{compat=newest}
\begin{figure} [H]
\centering
{
\begin{tikzpicture}
\begin{axis}
[ scale only axis, % The height and width argument only apply to the actual axis
height=8cm,
width=15cm,
enlargelimits=true,
axis lines = middle, % привычные оси со стрелочками с пересечением в нуле
% возможные значения: box, left, middle, center, right, none
xlabel = {$f$, кГц}, % подпись оси x
ylabel = {$K(f)$}, % подпись оси y
xlabel style={below right},
ylabel style={above left},
grid=major, % м.б. еще both - и там и там
grid style={dotted, cyan},
]
\addplot coordinates {
(0.02,0.8)
(0.1,0.8)
(0.2,0.75)
(0.5,0.7)
(1,0.6)
(2,0.4)
(5,0.25)
(10,0.15)
(15,0.1)
(20,0.07)
(50,0.034)
(100,0.016)
(200,0.008)
};
\end{axis}
\end{tikzpicture}
}
\caption{График }
\end{figure}
답변1
TeX.SX에 오신 것을 환영합니다! semilogxaxis
대신에 axis
로그 스케일링을 시도해 볼 수도 있습니다.엑스중심선:
\documentclass[border=10pt]{standalone}
\usepackage[T2A]{fontenc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{semilogxaxis}[
scale only axis, % The height and width argument only apply to the actual axis
height=8cm,
width=15cm,
axis lines=left, % привычные оси со стрелочками с пересечением в нуле
% возможные значения: box, left, middle, center, right, none
axis line shift=10pt,
xlabel={$f$, кГц}, % подпись оси x
ylabel={$K(f)$}, % подпись оси y
grid=major, % м.б. еще both - и там и там
grid style={dotted, cyan},
log ticks with fixed point,
xtick={0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200},
]
\addplot coordinates {
(0.02,0.8)
(0.1,0.8)
(0.2,0.75)
(0.5,0.7)
(1,0.6)
(2,0.4)
(5,0.25)
(10,0.15)
(15,0.1)
(20,0.07)
(50,0.034)
(100,0.016)
(200,0.008)
};
\end{semilogxaxis}
\end{tikzpicture}
\end{document}