“清理”:一组图表的比例和标签

“清理”:一组图表的比例和标签

晚上好,

我现在已经完成了六张图表。但是还有一些问题我还没能解决。

  1. 如您所见,u_GR 似乎大于 u_2,但从物理上讲,这是不可能的。当然,一旦我添加标签,这一点就会很清楚,但我想让它们看起来大小相等。我知道这是由于 u_2 中的负值造成的。
  2. 关于标签,什么是“最佳”(即最好看)的标签制作方法?如果是我,我会定义一堆节点(例如,在 (0,1) 处为 u_GR 并将其标记为 U_something。有没有自动化的方法来实现这一点?
  3. 有什么建议我应该做什么来增强图表?

多谢。

% Basierend auf einer Vorlage von: Author: Urs Zellweger ([email protected]),s. http://texample.net/tikz/examples/phasor-diagram/
% Mit Hilfe von tex.stackexchange.com https://tex.stackexchange.com/questions/398784/coordinate-system-all-set-up-how-to-fill-it-now

\documentclass[11pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{decorations, arrows}
\usepackage{amsmath}

\pgfplotsset{Diagram/.style={
   xmax=9,
  %xmin=0,
   ymax=1.5,
  %ymin=0,
   xlabel = {$t$},
   axis lines = middle, % may want to play around with if y-axis behavious weird
   xlabel style={at={(1,0)}, anchor=west},
   ylabel style={at={(0,1)}, anchor=north east}, %position y-Label left of y-axis
    ytick=\empty,
    no marks,
    every axis plot post/.append style={very thick, red},
                    }% end of Diagram style
            }% end of pgfplotsset


\begin{document}
%%%%%%%%%%%% Diagramme f. 4TPPC %%%%%%%%%%%%
\begin{figure}

\pgfplotsset{xticklabels={ , , , $T/2$, , $T$}, height=4cm, width=0.8\textwidth}

\centering

\begin{tikzpicture}[trim axis left]

\begin{axis}[Diagram, 
ylabel = $u_{GS_{1,4}}$, 
extra x ticks={3,7}, 
extra x tick labels={\mbox{\tiny $DT$},
\mbox{\tiny ${T/2+DT}$}}]

\addplot coordinates {(0,1)  (3,1) (3,0)  (8,0) };
\end{axis}

\end{tikzpicture}

\begin{tikzpicture}[trim axis left]

\begin{axis}[Diagram, ylabel = $U_{GS_{2,3}}$, extra x ticks={3,7}, extra x tick labels={\mbox{\tiny $DT$},\mbox{\tiny ${T/2+DT}$}}]
\addplot coordinates {(0,0)  (4,0)  (4,1)  (7,1) (7,0) (8,0)};
\end{axis}

\end{tikzpicture}

\begin{tikzpicture}[trim axis left]

\begin{axis}[Diagram, 
ylabel = $u_L$,
ymin=-1.5,
extra x ticks={3,7},
extra x tick labels={\mbox{\tiny $DT$},
\mbox{\tiny ${T/2+DT}$}},
ymin=-2, ymax=2]
\addplot coordinates {(0,.5)  (3,.5) (3,-1.5) (4,-1.5) (4,.5) (7,.5) (7,-1.5) (8,-1.5) (8,0) };



\end{axis}

\end{tikzpicture}

\begin{tikzpicture}[trim axis left]

\begin{axis}[Diagram, 
ylabel = $i_L$,
ymin=0,
extra x ticks={3,7},
extra x tick labels={\mbox{\tiny $DT$},
\mbox{\tiny ${T/2+DT}$}}]

\addplot coordinates {(0,.4)  (3,.7)  (4,.4)  (7,.7) (8,.4) };
\draw [ultra thin, blue, dashed] (0,0.7)  --  (8,0.7) ;
\draw [ultra thin, blue, dashed] (0,.4) -- (8,0.4) ;
\draw [thick, blue, <->] (8,.4) -- (8,.7);
\draw [thick, color=red ] (0,.55) -- (8,.55);
\node [right] at (8,.55){$\Delta i_L$};


\end{axis}

\end{tikzpicture}

\begin{tikzpicture}[trim axis left]

\begin{axis}[Diagram, 
ylabel = $u_2$,
extra x ticks={3,7},
extra x tick labels={\mbox{\tiny $DT$},
\mbox{\tiny ${T/2+DT}$}}]

\addplot coordinates {(0,1) (3,1) (3,0) (4,0) (4,-1) (7,-1) (7,0) (8,0)} ;

\end{axis}

\end{tikzpicture}

\begin{tikzpicture}[trim axis left]

\begin{axis}[Diagram, 
ylabel = $u_{GR}$,
extra x ticks={3,7},
extra x tick labels={\mbox{\tiny $DT$},
\mbox{\tiny ${T/2+DT}$}}]

\addplot coordinates {(0,1) (3,1) (3,0) (4,0) (4,1) (7,1) (7,0) (8,0)} ;

\end{axis}

\end{tikzpicture}


\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

答案1

像这样的样子?

在此处输入图片描述

关于你的子问题:

  1. 在所有 y 标签中都使用相同的字体大小,但由于使用的字母不同,标签的显示效果可能会有所不同,例如,u并且U具有(本来就是)不同的高度 :-)
  2. 如果添加文档序言,标签的显示效果会更好\usepackage[low-sup]{subdepth}(它会将变量索引推得更低,参见上图,并比较删除此包后的结果)
  3. xtick我会考虑给出的风格建议我的答案关于你之前的一个问题

下面的代码中指出了% <---您的更改。还添加了一些注释,因此代码应该是不言自明的:

\documentclass[11pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{decorations, arrows}

\usepackage{amsmath}
\usepackage[low-sup]{subdepth}              % <--- added

\pgfplotsset{% global setings for pgfplots images
    Diagram/.style={axis lines = middle,
                    xmax=9,
                    ymax=1.5,
    ymin=0,
    xlabel = {$t$},
    xlabel style={anchor=west},             % <--- changed
    xticklabel style={font=\scriptsize},    % <--- added
    ylabel style={at={(0,1)}, anchor=north east}, % position y-label left of y-axis
    ytick=\empty,
    no marks,
    every axis plot post/.append style={very thick, red},
    set layers={axis on top}               % <--- added, maybe you liked
                    }% end of Diagram style
            }% end of pgfplotsset

\begin{document}
%%%%%%%%%%%% Diagramme f. 4TPPC %%%%%%%%%%%%
\begin{figure}

\pgfplotsset{% local settings, valid only in this figure environment
    height=4cm, width=0.8\textwidth,
    xticklabels={ , , , $T/2$, , $T$},      % <--- mowed here
    extra x ticks={3,7},                    % <--- mowed here
    extra x tick labels={$DT$, ${T/2+DT}$}  % <--- mowed here
            }% end of local pgfplotsset

\centering

    \begin{tikzpicture}[trim axis left]
\begin{axis}[Diagram,   ylabel = $u_{GS_{1,4}}$,]
\addplot coordinates {(0,1) (3,1) (3,0)  (8,0) };
\end{axis}
    \end{tikzpicture}

\smallskip
    \begin{tikzpicture}[trim axis left]
\begin{axis}[Diagram,   ylabel = $U_{GS_{2,3}}$]
\addplot coordinates {(0,0) (4,0)  (4,1)  (7,1) (7,0) (8,0)};
\end{axis}
    \end{tikzpicture}

\smallskip
    \begin{tikzpicture}[trim axis left]
\begin{axis}[Diagram,
            ylabel = $u_L$,
            ymin=-1.5]
\addplot coordinates {(0,.5) (3,.5) (3,-1.5) (4,-1.5)
                      (4,.5) (7,.5) (7,-1.5) (8,-1.5)
                      (8,0) };
\end{axis}
    \end{tikzpicture}

\smallskip
    \begin{tikzpicture}[trim axis left]
\begin{axis}[Diagram,
    ylabel = $i_L$,
            ]
\addplot coordinates {(0,.4)  (3,.7)  (4,.4)  (7,.7) (8,.4) };
    \draw [ultra thin, blue, dashed] (0,0.7) -- (8,0.7) ;
    \draw [ultra thin, blue, dashed] (0,0.4) -- (8,0.4) ;
    \draw [thick, blue, <->] (8,.4) -- (8,.7);
    \draw [thick, color=red ] (0,.55) -- (8,.55);
    \node [right] at (8,.55){$\Delta i_L$};
\end{axis}
    \end{tikzpicture}

\smallskip
    \begin{tikzpicture}[trim axis left]
\begin{axis}[Diagram,   ylabel = $u_2$]
\addplot coordinates {(0,1) (3,1) (3,0) (4,0) (4,-1) (7,-1) (7,0) (8,0)} ;
\end{axis}
    \end{tikzpicture}

\smallskip
    \begin{tikzpicture}[trim axis left]
\begin{axis}[Diagram,   ylabel = $u_{GR}$]
\addplot coordinates {(0,1) (3,1) (3,0) (4,0) (4,1) (7,1) (7,0) (8,0)} ;
\end{axis}
    \end{tikzpicture}
\end{figure}
%%%%%%%%%%%% end of Diagramme f. 4TPPC %%%%%
\end{document}

相关内容