プロット - 軸の四分の一?

プロット - 軸の四分の一?

私はTEX初心者です

この変数をプロットして、X 軸に四半期を維持するにはどうすればよいですか?

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

これは、データをテーブルに読み込み、テーブルをプロットするybarplotまたはsharpplotによって実現できます。\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}

関連情報