Tikz - 如何在不知道方程的情况下绘制以下图形。

Tikz - 如何在不知道方程的情况下绘制以下图形。

这是我想要绘制的图表。 我正在尝试绘制的图表

我迄今为止的微薄努力:

    \begin{tikzpicture}
      \begin{axis}[
        height = 4cm, width = 10cm,
        xmin=0,xmax=500,
        ymin=0,ymax=200,
        grid=both,
        grid style={line width=.1pt, draw=gray!10},
        major grid style={line width=.2pt,draw=gray!50},
        axis lines=middle,
        enlargelimits={abs=0.5},
        xtick = {0,50,...,500},
        ytick = {0,50,...,200},
        scatter/use mapped color= {draw=black},
        xlabel = Number of months,
        ylabel = Balance
    ]
    \end{axis}
    \draw (0,1.8) to [bend left=15] (6.7,0);
    \draw [dashed] (0,1.8) to [bend left=25] (6.7, 0);
    \end{tikzpicture}

答案1

如果我不得不猜测这些函数,我会押注一些被某些幂“扭曲”的椭圆弧。这是因为 0 或 400 处的斜率分别看起来是 0 或无穷大。因此我有以下建议:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[style=help lines] (0,0) grid (10,4);
\foreach \x in {0,50,...,500}
{\draw (\x/50,0)--(\x/50,-0.2) node[below]{\x};}
\foreach \y in {0,50,...,200}
{\draw (0,\y/50)--(-0.2,\y/50) node[left]{\y};}
\draw[thick,variable=\x,domain=0:90,blue] plot ({8*cos(\x)},{3*sin(\x)}); 
\draw[thick,variable=\x,domain=0:90,blue,dashed] plot ({8*pow(cos(\x),3/4)},
{3*pow(sin(\x),2/3)}); 
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

编辑:

在此处输入图片描述

\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    height = 4cm, width = 10cm,
    xmin=0,xmax=500,
    ymin=0,ymax=200,
    grid=both,
    xtick = {0,50,...,500},
    xlabel = Number of months,
    ylabel = Balance
]
\draw           (0,150) .. controls +(100, 0) and +(-50,25) .. (300,100)
                        .. controls +(50,-25) and +(-10,25) .. (400,0);
\draw [dashed]  (0,150) -- + (200,0) 
                        .. controls +(75,  0) and +(-25,30) .. (350,100)
                        .. controls +(25,-30) and +(- 5,25) .. (400,0);
\end{axis}
\end{tikzpicture}
\end{document}

另一种不同的方法(通常使用pgfplots):

\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    height = 4cm, width = 10cm,
    xmin=0,xmax=500,
    ymin=0,ymax=200,
    grid=both,
    no marks,
    xtick = {0,50,...,500},
    xlabel = Number of months,
    ylabel = Balance
]
\addplot +[domain=0:400,thick,smooth] coordinates    
    {(0,150) (100,145) (200,138) (250,125) (300,100) (350, 60) (400,0)};
\addplot +[domain=0:400,smooth, dashed] coordinates
    {(0,150) (100,150) (200,150) (250,145) (300,133) (350,100) (400,0)};
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

如果您在某处计算两条曲线,则可以添加更多坐标(现在从您的图表中或多或少可以错误地估计)。

答案3

以下是使用我们可以“读取”的点和我们可以识别的角度的方法:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}



\begin{document}




        \begin{tikzpicture}
          \begin{axis}[
            height = 6cm, width = 10cm,
            xmin=0,xmax=500,
            ymin=0,ymax=200,
            grid=both,
            grid style={line width=.1pt, draw=gray!10},
            major grid style={line width=.2pt,draw=gray!50},
            axis lines=middle,
            enlargelimits={abs=0.5},
            xtick = {0,50,...,500},
            ytick = {0,50,...,200},
            scatter/use mapped color= {draw=black},
            xlabel = Number of months,
            ylabel = Balance
            ]
            \draw (axis cs:0,150) to [in=150,out=0] (axis cs:300,100);
            \draw (axis cs:300,100) to [in=120,out=-30] (axis cs:375,50);
            \draw (axis cs:375,50) to [in=90,out=-60] (axis cs:400,0);
            \draw [dashed]  (axis cs:0,150) to [in=135,out=0] (axis cs:350,100);
            \draw[dashed](axis cs:350,100)to[out=-45, in=90](axis cs:400,0);
        \end{axis}
        \end{tikzpicture}
\end{document}

提示:(想象一个模拟时钟:3 点=0 度 9 点-180 度 12 =90 度)

然后:“in”是线条进入终点时所用的角度。“out”是线条离开起点时所用的角度。

上述角度与我们上述观看的角度有关。

输出:

在此处输入图片描述

编辑:(根据 OP 请求改进观点)

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}



\begin{document}




        \begin{tikzpicture}
          \begin{axis}[
            height = 6cm, width = 10cm,
            xmin=0,xmax=500,
            ymin=0,ymax=200,
            grid=both,
            grid style={line width=.1pt, draw=gray!10},
            major grid style={line width=.2pt,draw=gray!50},
            axis lines=middle,
            enlargelimits={abs=0.5},
            xtick = {0,50,...,500},
            ytick = {0,50,...,200},
            scatter/use mapped color= {draw=black},
            xlabel = Number of months,
            ylabel = Balance
            ]
            \draw (axis cs:0,150) to[in=175,out=0](100,146);
            \draw (axis cs:100,146)to [in=166,out=-5] (axis cs:150,140);
            \draw (axis cs:150,140)to[in=161,out=-14](axis cs:200,130);
            \draw (axis cs:200,130) to [in=153,out=-19] (axis cs:300,100);
            \draw (axis cs:300,100) to [in=139,out=-27] (axis cs:350,72);
            \draw (axis cs:350,72) to[in=126,out=-41](axis cs:375,50);
            \draw (axis cs:375,50) to [in=88,out=-54](axis cs:400,0);
            \draw [dashed]  (axis cs:0,150) to [in=180.2,out=0] (axis cs:200,149);
            \draw[dashed](axis cs:200,149)to[in=135,out=-0.2](axis cs:350,100);
            \draw[dashed](axis cs:350,100)to[out=-45, in=90](axis cs:400,0);
        \end{axis}
        \end{tikzpicture}



\end{document}

输出:

在此处输入图片描述

相关内容