需要一些 addplot 修改

需要一些 addplot 修改

我對我想要創建的情節有一些疑問。這是一個最小的例子:

\documentclass[]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
            width=\textwidth,%Breite des Plots
            axis line style=thin,%Achsenstärke
            axis y line = center,
            axis x line = center,
            no markers,%keine Markierungen auf den Plots
            every axis plot/.append style={thin},%Plotstärke
            axis on top=false,%Achsen hinter dem Plot
        ]
        \addplot table[col sep=semicolon,/pgf/number format/read comma as period, x index = {0}, y index = {1}]{124-Auswertung.csv};
        \addplot table[col sep=semicolon,/pgf/number format/read comma as period, x index = {0}, y index = {2}]{124-Auswertung.csv};
        \addplot table[col sep=semicolon,/pgf/number format/read comma as period, x index = {0}, y index = {3}]{124-Auswertung.csv};
        \addplot table[col sep=semicolon,/pgf/number format/read comma as period, x index = {0}, y index = {4}]{124-Auswertung.csv};
        \addplot table[col sep=semicolon,/pgf/number format/read comma as period, x index = {0}, y index = {5}]{124-Auswertung.csv};
        \addplot table[col sep=semicolon,/pgf/number format/read comma as period, x index = {0}, y index = {6}]{124-Auswertung.csv};
    \end{axis}
\end{tikzpicture}
\end{document}

結果:在此輸入影像描述

csv 檔案在這裡(太長,無法在此處新增):https://dl.dropboxusercontent.com/u/57816350/124-Auswertung.csv

由於只有第一個圖是測量值,而第二個到第六個圖只是訊號,因此我想在 y 尺度上重新命名這些圖,如下所示。

有沒有辦法標記特定區域,如下圖?我希望最好在 CSV 檔案中包含標記區域。我該怎麼做呢?

有沒有辦法讓 col sep... 和 pgf/number/... as period ... 選項更全域化?

由於我在文件中會有很多非常相似的圖,所以我想預先定義圖的顏色(當我將其添加到每個圖時,顏色選項似乎不起作用)

如何改變軸的顏色?

我想要實現的目標:

在此輸入影像描述

請幫忙!

答案1

像這樣?

在此輸入影像描述

\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{backgrounds}% <-- added

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
width=\textwidth,%Breite des Plots
axis line style=thin,%Achsenstärke
axis y line=left,
axis x line=middle,
no markers,%keine Markierungen auf den Plots
%every axis plot/.append style={thin},%Plotstärke
%%axis on top=false,%Achsen hinter dem Plot
ytick={-6,...,1},% <-- added
yticklabels={$v_5$,$v_4$,$v_3$,$v_2$,$v_1$,-1,0,1},% <-- added
% only for demonstration ...
trig format plots=rad,
domain=0:4*pi, samples=48, 
xmax=4.1*pi, ymax=1.2
        ]
        \addplot    {   0.5*sin(x)};
        \addplot    {-1+0.5*sin(x)};
        \addplot    {-2+0.5*sin(x)};
        \addplot    {-3+0.5*sin(x)};
        \addplot    {-4+0.5*sin(x)};
        \addplot    {-5+0.5*sin(x)};
        \addplot    {-6+0.5*sin(x)};
\scoped[on background layer] \fill[red!30] (2.5,-6.5) rectangle (3.5,1);
    \end{axis}
\end{tikzpicture}
\end{document}

為了演示解決方案,我使用了sin您可以簡單地用表格替換的函數。

相關內容