為函數建立漸近線摘要圖

為函數建立漸近線摘要圖

我希望該圖類似於以下內容:

在此輸入影像描述

但是,我製作的圖與此描述不符 T2 這是我的嘗試

\documentclass[]{article}
\usepackage[left=.5cm,right=.5cm,top=3cm,bottom=1cm]{geometry}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{esvect}
\usepackage{ifthen}
\usepackage{stmaryrd}
\usepackage{xspace}
\usepackage{mathtools}

\newcommand{\lm}[2]{\displaystyle{\lim_{{#1}\to {#2}}}}

\begin{document}

\begin{center}
\begin{tikzpicture}
\node[rectangle, draw=brown, fill=brown!75, minimum height=1cm, minimum width=5cm, rounded corners] (1) {$\lm{x}{\infty}f(x) = a$};
\node[rectangle, draw=brown, fill=brown!75, minimum height=1cm, minimum width=5cm, rounded corners, right= 1cm of 1] (2) {$\lm{x}{\infty}f(x) = \infty$};
\node[rectangle, draw=brown, fill=brown!75, minimum height=1cm, minimum width=5cm, rounded corners, right= 1cm of 2] (3) {$\lm{x}{a}f(x) = a$};
\node[rectangle, draw=cyan, fill=cyan!50, minimum height=1cm, minimum width=5cm, rounded corners, below left= 1cm and 0cm of 2] (4) {$\lm{x}{\infty}\left[f(x) - (ax - b)\right] = 0$};
\node[rectangle, draw=cyan, fill=cyan!50, minimum height=1cm, minimum width=4cm, rounded corners, right= 1mm of 4] (5) {$\lm{x}{\infty}\dfrac{f(x)}{x} = a \ ; \ a \neq 0$};
\node[rectangle, draw=cyan, fill=cyan!50, minimum height=1cm, minimum width=3cm, rounded corners, right= 1mm of 5] (6) {$\lm{x}{\infty}\dfrac{f(x)}{x} = \infty$};
\node[rectangle, draw=cyan, fill=cyan!50, minimum height=1cm, minimum width=3cm, rounded corners, right= 1mm of 6] (7) {$\lm{x}{\infty}\dfrac{f(x)}{x} = 0$};
\node[rectangle, draw=cyan, fill=cyan!50, minimum height=1cm, minimum width=3cm, rounded corners, below left= 1cm and -2cm of 5] (8) {$\lm{x}{\infty}\left[f(x) - ax\right] = b$};
\node[rectangle, draw=cyan, fill=cyan!50, minimum height=1cm, minimum width=3cm, rounded corners, right= 1mm of 8] (9) {$\lm{x}{\infty}\left[f(x) - ax\right] = \infty$};
\node[rectangle, draw=green, fill=green!50, minimum height=5cm, rounded corners, below left = 1cm and 2cm of 8] (10) {
\begin{minipage}{2.5cm}
$(C_f)$ admet une \\ asymptote horizontale \\ d'équation $y=a$ \\ au voisinage de $\infty$
\end{minipage}};
\node[rectangle, draw=green, fill=green!50, minimum height=5cm, rounded corners, right = 1mm of 10] (11) {
\begin{minipage}{2.5cm}
$(C_f)$ admet une \\ asymptote oblique \\ d'équation $y=ax+b$ \\ au voisinage de $\infty$
\end{minipage}};
\node[rectangle, draw=green, fill=green!50, minimum height=5cm, rounded corners, right = 1mm of 11] (12) {
\begin{minipage}{2.5cm}
$(C_f)$ admet une \\ branche parabolique \\ de direction la droite \\ d'équation $y=ax$ \\ au voisinage de $\infty$
\end{minipage}};
\node[rectangle, draw=green, fill=green!50, minimum height=5cm, rounded corners, right = 1mm of 12] (13) {
\begin{minipage}{2.5cm}
$(C_f)$ admet une \\ branche parabolique \\ de direction l'axe des ordonnées \\ d'équation $y=ax$ \\ au voisinage de $\infty$
\end{minipage}};
\node[rectangle, draw=green, fill=green!50, minimum height=5cm, rounded corners, right = 1mm of 13] (14) {
\begin{minipage}{2.5cm}
$(C_f)$ admet une \\ branche parabolique \\ de direction l'axe des abscisses \\ d'équation $y=ax$ \\ au voisinage de $\infty$
\end{minipage}};
\node[rectangle, draw=green, fill=green!50, minimum height=5cm, rounded corners, right = 1mm of 14] (15) {
\begin{minipage}{2.5cm}
$(C_f)$ admet une \\ asymptote verticale \\ d'équation $x=a$
\end{minipage}};
\draw[blue, very thick,-latex] ([xshift=-2cm]1.south) -- ([xshift=-1cm] 10.north);
\draw[blue, very thick,-latex] ([xshift=2cm]3.south) -- ([xshift=1cm] 15.north);
\draw[blue, very thick,-latex] ([xshift=-1mm]2.south) -- (4.north);
\draw[blue, very thick,-latex] (2.south) -- (5.north);
\draw[blue, very thick,-latex] ([xshift=1mm]2.south) -- (6.north);
\draw[blue, very thick,-latex] ([xshift=3mm]2.south) -- (7.north);
\draw[blue, very thick,-latex] (5.south) -- (8.north);
\draw[blue, very thick,-latex] (5.south) -- (9.north);
\draw[blue, very thick,-latex] (4.south) -- (11.north);
\draw[blue, very thick,-latex] (8.south) -- (11.north);
\draw[blue, very thick,-latex] (9.south) -- (12.north);
\draw[blue, very thick,-latex] (6.south) -- (13.north);
\draw[blue, very thick,-latex] (7.south) -- (14.north);
\end{tikzpicture}
\end{center}

\end{document}

答案1

這是一種方法,盡可能重複使用您的方法。然而,對於放置來說,還有更好、更一致的替代方案。至少這是一個更好的起點。

請遵循flow of changes我的評論:

% ~~~ REFACTORING ~~~~~~~~~~~~
% * commented out unsused packages
% * defining styles to simplify code (you can still remove or vary all those \\)
% * adjusted code indenting and formatting for better visibility of what's going on
% * tried \def vs. \newcommand, which seems to be a bit faster during compile
%   (Tikz seems to prefer TeX-notation here)
% * demonstrated refactoring for the connectors: (2) -- (4), (5) -- (8)

The styles與顏色、尺寸等相關的內容可以進一步重構,但目前已經夠好了。輪班也是如此。

Please look up所有這些細節同時存在pgf手冊

For the brown row我採用了你的方法,簡化了轉變,即替換你的選擇權(這導致瞭如上所述的錯誤)。

For the other ones方法有所不同:

  • 將第一個(最左邊)放在\node絕對位置
  • 將它們從東到西放置,中間有一些xshift,在XSBL等中定義。

The text in the green boxes可以通過text width=和在 Tikz 中更好地控制align=,請參閱pgf手冊。在我的方法中它們\\不再是必需的,但您仍然可以使用它們來更好地控製文字流。

The changes for the connectors我示範了lines(2) -- (4)(5) -- (8),留下詳細的調整給你:

  • 第一個是直接的,
  • 第二個需要一個中間點,以相對座標給出
  • !向下移動和圓角半徑可能會導致偽影!

The key syntax here正在使用極座標<node name>.<angle>。例如,採用節點 (2),從該節點中心和角度(或在航海術語中比西稍遠一點)(2.185)輻射光束,直到它與節點的邊界相交。185deg這樣您就可以按照您想要的方式移動起點和終點。

Lots is left for you從調整的角度來看,主要是:

  • 的轉變XSBXSBL以及XSG
  • 每個節點的極角
  • 也許是左節點的絕對位置

Putting an arrow midway是可能的,但需要一些裝飾,這在大多數情況下會增加編譯時間。你真的需要它嗎?

Finally從一開始就進行乾淨的編碼並盡可能頻繁地重構總是一個好主意。

結果

% ~~~ REFACTORING ~~~~~~~~~~~~
% * commented out unsused packages
% * defining styles to simplify code (you can still remove or vary all those \\)
% * adjusted code indenting and formatting for better visibility of what's going on
% * tried \def vs. \newcommand, which seems to be a bit faster during compile
%   (Tikz seems to prefer TeX-notation here)
% * demonstrated refactoring for the connectors: (2) -- (4), (5) -- (8)

\documentclass[]{article}
\usepackage[left=.5cm,right=.5cm,top=3cm,bottom=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}    % <<<
%\usepackage{tkz-euclide}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
%\usepackage{esvect}
%\usepackage{ifthen}
%\usepackage{stmaryrd}
%\usepackage{xspace}
%\usepackage{mathtools}

%\newcommand{\lm}[2]{\displaystyle{\lim_{{#1}\to {#2}}}}
\def\lm#1#2{\displaystyle{\lim_{{#1}\to {#2}}}}

\begin{document}

\begin{center}
 \begin{tikzpicture}[
    DIM/.style={ minimum height=1cm, minimum width=5cm, rounded corners},
    A/.style={draw=brown, fill=brown!75,DIM},
    B/.style={draw=cyan,  fill=cyan!50, DIM,minimum width=3cm},
    C/.style={draw=green, fill=green!50, minimum height=5cm, 
              rounded corners,align=center,text width=25mm},
    XSB/.style ={xshift=73mm},
    XSBL/.style={anchor=west,xshift=2mm},   
    XSG/.style ={anchor=west,xshift=4mm},
    ARR/.style ={blue, very thick,->,rounded corners=16pt},
    > = {Stealth},  
 ]
    % ~~~ brown row ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[A,anchor=west] (1) at (0,0)         {$\lm{x}{\infty}f(x) = a$};
    \node[A] (2)             at ([XSB] 1)     {$\lm{x}{\infty}f(x) = \infty$};
    \node[A] (3)             at ([XSB] 2)     {$\lm{x}{a}f(x) = a$};
    
    % ~~~ 1st blue row ~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[B,anchor=west]      (4) at (2,-3)   {$\lm{x}{\infty}\left[f(x) - (ax - b)\right] = 0$};
    \node[B,XSBL] (5) at (4.east) {$\lm{x}{\infty}\dfrac{f(x)}{x} = a \ ; \ a \neq 0$};
    \node[B,XSBL] (6) at (5.east) {$\lm{x}{\infty}\dfrac{f(x)}{x} = \infty$};
    \node[B,XSBL] (7) at (6.east) {$\lm{x}{\infty}\dfrac{f(x)}{x} = 0$};
    
    % ~~~ 2nd blue row ~~~~~~~~~~~~~
    \node[B,anchor=west]      (8) at (4,-6)   {$\lm{x}{\infty}\left[f(x) - ax\right] = b$};
    \node[B,XSBL] (9) at (8.east) {$\lm{x}{\infty}\left[f(x) - ax\right] = \infty$};
    
    % ~~~ green row ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[C,anchor=west] (10) at (0,-12){
                                $(C_f)$ admet une  asymptote horizontale  
                                d'équation $y=a$ \\ au voisinage de $\infty$};
    \node[C,XSG] (11) at (10.east) {
                                $(C_f)$ admet une \\ asymptote oblique \\
                                d'équation $y=ax+b$ \\ au voisinage de $\infty$};
    \node[C,XSG] (12) at (11.east) {
                                $(C_f)$ admet une \\ branche parabolique \\ 
                                de direction la droite \\ d'équation $y=ax$ \\ 
                                au voisinage de $\infty$};
    \node[C,XSG] (13) at (12.east) {
                                $(C_f)$ admet une \\ branche parabolique \\ 
                                de direction l'axe des ordonnées \\ d'équation 
                                $y=ax$ \\ au voisinage de $\infty$};
    \node[C,XSG] (14) at (13.east) {
                                $(C_f)$ admet une \\ branche parabolique \\ 
                                de direction l'axe des abscisses \\
                                d'équation $y=ax$ \\ au voisinage de $\infty$};
    \node[C,XSG] (15) at (14.east) {
                                $(C_f)$ admet une \\ asymptote verticale 
                                \\ d'équation $x=a$};
    
%   % ~~~ connectors ~~~~~~~~~~~~~~~~
    \draw[ARR] ([xshift=-2cm]1.south) -- ([xshift=-1cm] 10.north);
    \draw[ARR] ([xshift=2cm]3.south) -- ([xshift=1cm] 15.north);
    
    % ~~~ TO DO: rework all other \draw's like this one: ~~~~~~~~~
    \draw[ARR] (2.185) -| (4.20);
    
    \draw[blue, very thick,-latex] (2.south) -- (5.north);
%   \draw[blue, very thick,-latex] ([xshift=1mm]2.south) -- (6.north);
%   \draw[blue, very thick,-latex] ([xshift=3mm]2.south) -- (7.north);

    \draw[ARR] (5.230) -- ++(0,-.6) -| (8.north);


%   \draw[blue, very thick,-latex] (5.south) -- (9.north);
%   \draw[blue, very thick,-latex] (4.south) -- (11.north);
%   \draw[blue, very thick,-latex] (8.south) -- (11.north);
%   \draw[blue, very thick,-latex] (9.south) -- (12.north);
%   \draw[blue, very thick,-latex] (6.south) -- (13.north);
%   \draw[blue, very thick,-latex] (7.south) -- (14.north);
 \end{tikzpicture}
\end{center}

\end{document}

相關內容