
다음과 비슷한 코드가 있습니다.
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{filecontents}{data-fake.dat}
xpos y date
1 1 09-01
2 3 09-02
3 1 09-03
4 4 09-04
5 2 09-05
6 1 09-06
7 2 09-07
8 0 09-08
9 1 09-09
10 2 09-10
11 1 09-11
12 2 09-12
13 0 09-13
14 1 09-14
15 1 09-15
16 0 09-16
17 2 09-17
18 0 09-18
19 0 09-19
20 0 09-20
21 4 09-21
22 0 09-22
23 0 09-23
24 1 09-24
25 0 09-25
26 0 09-26
27 1 09-27
28 3 09-28
29 1 09-29
30 10 09-30
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=32cm,
axis x line*=bottom,
axis y line*=left,
ymode=log,
log ticks with fixed point,
xtick=data,
xticklabels from table={data-fake.dat}{date},
x tick label style={rotate=90}
]
\addplot table[x=xpos,y=y] {data-fake.dat};
\end{axis}
\end{tikzpicture}
\end{document}
09-20
y축이 로그 모드에 있을 때 플롯이 올바르게 인쇄되는 동안 x 틱이 다음 10개의 틱을 무시하도록 인쇄되는 이유는 무엇입니까 ?
y축이 로그 모드가 아닌 경우처럼 모든 x 눈금이 표시되도록 하려면 어떻게 해야 합니까?
답변1
문제는 Y 열에 0 값이 있고 이러한 값에 대한 로그가 무한대( -\infty
)라는 것입니다. 따라서 이러한 값은 pgfplots에서 건너뜁니다. 세 번째 열의 날짜가 잘못 설정되었습니다. 이는 X축의 숫자 값(첫 번째 열)을 표시하면 알 수 있습니다. 그리고 이러한 값 집합(0 포함)의 경우 로그 눈금을 사용할 수 없습니다.