플롯 - 축의 4분의 1?

플롯 - 축의 4분의 1?

나는 TEX를 처음 접한다

이 변수를 어떻게 플롯하고 x축에 1/4을 유지할 수 있습니까?

date    variable
1993Q1  0.71957432
1993Q2  0.622643199
1993Q3  0.557352546
1993Q4  0.78844216
1994Q1  0.677342246
1994Q2  0.752843835
1994Q3  0.823435891
1994Q4  0.869172377
1995Q1  0.822971248
1995Q2  0.759768686
1995Q3  0.662193784
1995Q4  0.744474674
1996Q1  0.665910923
1996Q2  0.776898876
1996Q3  0.923927404
1996Q4  0.840678042
1997Q1  0.735450535
1997Q2  0.850306776

답변1

이는 데이텀을 테이블로 읽어온 다음 테이블을 플롯하는 데 사용하는 ybar플롯 또는 플롯을 통해 달성할 수 있습니다.sharp\pgfplotstableread

여기에 이미지 설명을 입력하세요

여기에 이미지 설명을 입력하세요

암호

\documentclass{article}%[border=1cm]{standalone}

\usepackage{pgfplots,pgfplotstable}

\pgfplotsset{compat=1.8}

\begin{document}


\pgfplotstableread[col sep=comma]{
date, variable
1993Q1, 0.71957432 
1993Q2, 0.622643199
1993Q3, 0.557352546 
1993Q4, 0.78844216 
1994Q1, 0.677342246 
1994Q2, 0.752843835 
1994Q3, 0.823435891 
1994Q4, 0.869172377 
1995Q1, 0.822971248 
1995Q2, 0.759768686 
1995Q3, 0.662193784 
1995Q4, 0.744474674 
1996Q1, 0.665910923 
1996Q2, 0.776898876 
1996Q3, 0.923927404 
1996Q4, 0.840678042 
1997Q1, 0.735450535 
1997Q2, 0.850306776
}\datatable

% ybar plot
\begin{tikzpicture}
\begin{axis}[
    ybar, 
    height=10cm,
    width=13cm,
    enlarge y limits=false,
    ymin=0,
    ymax=1,
    xtick=data,
    xticklabels from table={\datatable}{date},
    x tick label style={rotate=90, anchor=east}
]
\addplot [fill=blue] table [x expr=\coordindex, y=variable] {\datatable};  

\end{axis}
\end{tikzpicture}%

% -- sharp plot
\begin{tikzpicture}
\begin{axis}[
    height=10cm,
    width=13cm,
    enlarge y limits=false,
    ymin=0,
    ymax=1,
    xtick=data,
    xticklabels from table={\datatable}{date},
    x tick label style={rotate=90, anchor=east}
]
%\addplot [fill=blue] table [x expr=\coordindex, y=variable] {\datatable};  
\addplot [sharp plot] table [x expr=\coordindex, y=variable] {\datatable};  
\end{axis}
\end{tikzpicture}%
\end{document}

관련 정보