如何在两个特定坐标之间绘图? 线为 (1,0) 和 (5,0)
\documentclass{article}
\usepackage[margin=1.5cm,top=1cm,headheight=16pt,headsep=0.1in,heightrounded]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,shapes,positioning,intersections,quotes}
\usetikzlibrary{positioning} % <---
\begin{document}
\begin{tikzpicture}
%\path[name path=t] (1,0) to[out=90,in=180] (2,1) to[out=0,in=90] (3,0); % top arc
\draw[blue] (0,0)--++(0,1);
\draw[red] (0,1)--++(6,0);
\draw[yellow] (6,1)--(6,0);
\draw[green] (0,0)--(1,0);
\draw[orange] (6,0)--++(-1,0);
\draw[magenta] (1,0) arc
[
start angle=160,
end angle=20,
x radius=2cm,
y radius =0.5cm
] ;
\end{tikzpicture}
\end{document}
答案1
这里有一些不同的弧:
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[yshift=0cm] (1,0) to [bend right=45] (5,0);
\draw[yshift=2cm] (1,0) to [bend left=45] (5,0);
\draw[yshift=4cm] (1,0) to [out=135, in=45] (5,0);
\draw[yshift=6cm] (1,0) to [out=135, in=45, looseness=2] (5,0);
\end{tikzpicture}
\end{document}
答案2
\documentclass{article}
\usepackage[margin=1.5cm,top=1cm,headheight=16pt,headsep=0.1in,heightrounded]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,shapes,positioning,intersections,quotes,patterns,positioning} % <---
\begin{document}
\begin{tikzpicture}
\draw[gray,pattern=dots, pattern color=gray,] (0,0)--++(0,1)
to (0,1)--++(12,0)
to (12,1)--(12,0)
to (12,0)--(11,0)
to (11,0) to [bend left=-15] (1,0)
to (1,0) to (0,0);
\end{tikzpicture}
\end{document}