图中轴延伸

图中轴延伸

我正在策划这件事

在此处输入图片描述

但由于某种原因,我的图表很奇怪:

在此处输入图片描述

平均能量损失

\documentclass{article}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfplots}

\begin{document}
    \begin{center}
        \begin{tikzpicture}
            \begin{axis}
                [xmin=0,
                xmax=80,
                ymin=0,
                ymax=27.5,
                xlabel={$t$},
                ylabel={$v$},
                grid=both,
                grid style={line width=.1pt, draw=black},
                major grid style={line width=.2pt,draw=black},
                axis lines=middle,
                minor tick num=1,
                axis x line=bottom,
                axis y line=left,
                axis line style={-stealth},
                ticklabel style={font=\tiny},
                yticklabels={0,10,15,20,25},
                xticklabels={,10,20,30,40,50,60,70},
                ytick={0,10,12.5,15,17.5,20,22.5,25},
                xtick={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75},
                xlabel style={at={(ticklabel* cs:1)},anchor=north west},
                ylabel style={at={(ticklabel* cs:1)},anchor=south west}]
                
                \addplot[domain=0:80,red,line width=0.5mm,samples=500] {15*(1-e^(-x/5)) + 10};
                
            \end{axis}
        \end{tikzpicture}
    \end{center}
\end{document}

你知道为什么会发生这种情况吗?

答案1

由于您并没有真正说明您对当前解决方案不满意的方面,因此我将尝试复制给定的图表。

\documentclass{article}
\usepackage{tikz,pgf,pgfplots}
\begin{document}
   \begin{tikzpicture}
      \begin{axis}[
         width=40em, % (xmax - xmin) / scalingFactorBetweenXAndYAxis
         height=22.5em, % ymax - ymin
         xmin=0,
         xmax=80,
         ymin=7.5,
         ymax=30,
         xtick={0,10,...,70},
         minor xtick={5,15,...,75},
         ytick={10,15,...,25},
         minor ytick={10,12.5,...,27.5},
         grid=both,
         xlabel={$t$},
         ylabel={$v$},
         axis lines=middle,
         xlabel style={at={(ticklabel* cs:1)},anchor=north east},
         ylabel style={at={(ticklabel* cs:1)},anchor=north east},
      ]
         \addplot[domain=0:80,red,line width=0.5mm,samples=500] {15*(1-e^(-x/5)) + 10}; % whatever the correct function is
      \end{axis}
   \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容