配列に放物線をプロットできない

配列に放物線をプロットできない

次の 2 つのTikZ環境では、同様の表示が得られるはずです。私は、それぞれ直交平面上にある放物線のグラフを 5 つ取得し、環境外の各グラフの左上隅に a.)、b.)、c.)、d.)、または e.) のラベルを付けようとしていますTikZ

最初の表示では、axis 環境のオプションを使用して、最初のプロットに名前を付けたりplot1、を使用して最初のプロットに対して 2 番目のプロットを移動したりしますat={($(plot1.east)+(1cm,0)$)}。ラベル a.)、b.)、c.)、d.)、e.) を配置すること以外は、必要な表示です。2 番目は、adjustboxパッケージを使用します。各グラフが大きすぎるため、各直交平面上の放物線が不自然にシフトされています。グラフは必要な配列で表示され、ラベル a.)、b.)、c.)、d.)、e.) は正しく配置されているように見えます。

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{adjustbox}
\usepackage{mathtools}

\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\noindent This is the left margin. \vskip1.25mm

\begin{tikzpicture}
  \begin{axis}[name=plot1,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {5*x^(2)};
  \end{axis}
  \begin{axis}[name=plot2,at={($(plot1.east)+(1cm,0)$)},anchor=west,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {-5*x^(2) + 3};
  \end{axis}
  \begin{axis}[name=plot3,at={($(plot1.south)-(0,1cm)$)},anchor=north,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
  ]
    \addplot[samples=201,domain=-3:3,blue] {-5*(x^(2) - x)};
  \end{axis}
  \begin{axis}[name=plot4,at={($(plot2.south)-(0,1cm)$)},anchor=north,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {5*(x^(2) + x)};
  \end{axis}
    \begin{axis}[name=plot5,at={($(plot3.south)-(0,1cm)$)},anchor=north,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-6,ymax=6,
    restrict y to domain=-6:6,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {-5*x^(2) - 0.5)};
  \end{axis}
\end{tikzpicture}


\vfill
\pagebreak


\noindent This is the left margin. \vskip1.25mm

a.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]
\addplot[samples=201,domain=-3:3,blue] {5*x^(2)};\end{axis}
\end{tikzpicture}}
%
b.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {-5*x^(2) + 3};\end{axis}
\end{tikzpicture}}
%
c.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {-5*(x^(2) - x};\end{axis}
\end{tikzpicture}}
%
d.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {5*(x^(2) + x)};\end{axis}
\end{tikzpicture}}
%
e.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {-5*x^(2) - 0.5};\end{axis}
\end{tikzpicture}}
\hspace{\fill}

\end{document}

答え1

1 つの解決策は、tikzpicture 環境のスケール オプションを使用してプロットのサイズを縮小することです。グラフの位置がずれる理由を調べていません。プロット領域とプロットされたグラフの不一致を注意深く確認する必要があります。

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{adjustbox}
\usepackage{mathtools}

\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

a.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.25]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]
\addplot[samples=201,domain=-3:3,blue] {5*x^(2)};\end{axis}
\end{tikzpicture}}
%
b.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.25]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {-5*x^(2) + 3};\end{axis}
\end{tikzpicture}}
%
c.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.25]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {-5*(x^(2) - x};\end{axis}
\end{tikzpicture}}
%
d.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.25]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {5*(x^(2) + x)};\end{axis}
\end{tikzpicture}}
%
e.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.25]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (0,9) +(0,0.5) node[above right] {$y$} -- (0,-9) -- +(0,-0.5);
\draw[draw=gray!30,latex-latex] (-3,0) +(-0.5,0) -- (3,0) -- +(0.5,0) node[below right] {$x$};
\begin{axis}[hide axis]\addplot[samples=201,domain=-3:3,blue] {-5*x^(2) - 0.5};\end{axis}
\end{tikzpicture}}
\hspace{\fill}

\end{document}

ここに画像の説明を入力してください

放物線を表示する別の方法を以下に示します。他の可能性を確認するには、axis 環境のオプションに関する pgfplots マニュアルを参照するだけで十分です。

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{adjustbox}
\usepackage{mathtools}

\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}
\noindent This is the left margin. \vskip1.25mm

a.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\begin{axis}[grid=none,
      mark = none, 
      xmin = -3, ymin = -45,
      xmax = 3,ymax = 45,
      axis lines*=middle,
      enlargelimits=upper,
      clip=false]
\addplot[samples=201,domain=-3:3,blue] {5*x^(2)};\end{axis}
\end{tikzpicture}}
%
b.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\begin{axis}[grid=none,
      mark = none, 
      xmin = -3, ymin = -45,
      xmax = 3,ymax = 45,
      axis lines*=middle,
      enlargelimits=upper,
      clip=false]
\addplot[samples=201,domain=-3:3,blue] {-5*x^(2) + 3};\end{axis}
\end{tikzpicture}}
\par
c.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\begin{axis}[grid=none,
      mark = none, 
      xmin = -3, ymin = -45,
      xmax = 3,ymax = 45,
      axis lines*=middle,
      enlargelimits=upper,
      clip=false]
\addplot[samples=201,domain=-3:3,blue] {-5*(x^(2) - x};\end{axis}
\end{tikzpicture}}
%
d.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\begin{axis}[grid=none,
      mark = none, 
      xmin = -3, ymin = -45,
      xmax = 3,ymax = 45,
      axis lines*=middle,
      enlargelimits=upper,
      clip=false]
\addplot[samples=201,domain=-3:3,blue] {5*(x^(2) + x)};\end{axis}
\end{tikzpicture}}
\par
e.) \adjustbox{valign=t}{\begin{tikzpicture}
%These commands plot the second parabola on the Cartesian plane.
\begin{axis}[grid=none,
      mark = none, 
      xmin = -3, ymin = -45,
      xmax = 3,ymax = 45,
      axis lines*=middle,
      enlargelimits=upper,
      clip=false]
\addplot[samples=201,domain=-3:3,blue] {-5*x^(2) - 0.5};\end{axis}
\end{tikzpicture}}

\end{document}

ここに画像の説明を入力してください

コードの前半を使用した図。

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{adjustbox}
\usepackage{mathtools}

\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\noindent This is the left margin. \vskip1.25mm
\begin{tikzpicture}
  \begin{axis}[name=plot1,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {5*x^(2)};
    \node at (axis cs:-4.5,14) [anchor= north west] {a.)};
  \end{axis}
  \begin{axis}[name=plot2,at={($(plot1.east)+(1cm,0)$)},anchor=west,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {-5*x^(2) + 3};
    \node at (axis cs:-4.5,14) [anchor= north west] {b.)};
  \end{axis}
  \begin{axis}[name=plot3,at={($(plot1.south)-(0,1cm)$)},anchor=north,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
  ]
    \addplot[samples=201,domain=-3:3,blue] {-5*(x^(2) - x)};
    \node at (axis cs:-4.5,14) [anchor= north west] {c.)};
  \end{axis}
  \begin{axis}[name=plot4,at={($(plot2.south)-(0,1cm)$)},anchor=north,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-9,ymax=9,
    restrict y to domain=-9:9,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {5*(x^(2) + x)};
    \node at (axis cs:-4.5,14) [anchor= north west] {d.)};
  \end{axis}
    \begin{axis}[name=plot5,at={($(plot3.south)-(0,1cm)$)},anchor=north,height=5cm,width=5cm,
    axis lines=middle,
    xmin=-3,xmax=3,samples=201,
    xlabel=$x$,ylabel=$y$,
    ymin=-6,ymax=6,
    restrict y to domain=-6:6,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    xtick={\empty},ytick={\empty},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
    ]
    \addplot[samples=201,domain=-3:3,blue] {-5*x^(2) - 0.5)};
    \node at (axis cs:-4.5,9) [anchor= north west] {e.)};
  \end{axis}
\end{tikzpicture}

\end{document}

ここに画像の説明を入力してください

関連情報