修改 PGF-Tikz 区间图

修改 PGF-Tikz 区间图

我将其写为中心区间图。有些东西我想添加,但不幸的是我不能添加。这些额外的内容是:

  1. d(x,y)躺在蓝色箭头上

  2. $rayon$躺在红色箭头上

  3. 更改箭头样式

  4. 扩大$a,c,x,b$$d(x,y)$

  5. 我使用软件编写了参数化,如果有人可以直接绘制这些弧而不需要这些荒谬的方程式,我愿意学习。

\documentclass[10pt]{article}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}

 \begin{tikzpicture}
 \draw[stealth-stealth] (-7,0) node[below]{$-\infty$} -- (7,0) node[below]{$\infty$};
 \draw foreach \X in {-5,-4,...,5} {(\X,.1) -- (\X,-.1) node[below=0.2em]{$\X$}};
  \draw [line width=1pt] (-5,0)-- (5,0);
\draw [shift={(0,0)},line width=1pt,dash pattern=on 1pt off 1pt,color=red]  plot[domain=3.14:3.9,variable=\t]({1*5*cos(\t r)+0*5*sin(\t r)},{0*5*cos(\t r)+1*5*sin(\t r)});
\draw [shift={(0,0)},line width=1pt,dash pattern=on 1pt off 1pt,color=blue]  plot[domain=0:1.15,variable=\t]({1*2.48*cos(\t r)+0*2.48*sin(\t r)},{0*2.48*cos(\t r)+1*2.48*sin(\t r)});
\draw [line width=1pt,color=red,<->] (0,0)-- (-4,-3);
\draw [line width=1pt,color=blue,<->] (0,0)-- (2.3,0.87);
\begin{scriptsize}
\draw [fill=black] (-5,0) circle (1.5pt);
\draw[color=black] (-4.98,0.22) node {$a$};
\draw [fill=black] (5,0) circle (1.5pt);
\draw[color=black] (5.02,0.22) node {$b$};
\draw [fill=red] (0,0) circle (2pt);
\draw[color=black] (0.0,0.22) node {$\LARGE{c}$};

\draw [fill=blue] (2.48,0) circle (2.5pt);
\draw[color=black] (2.64,0.2) node {$\LARGE{x}$};
\draw[color=black] (-1.5,-1.56) node {${{rayon}}$};
\draw[color=black] (1,0.7) node {${d(x,c)}$};
\end{scriptsize}
  \end{tikzpicture}
\end{document}

这是截图 在此处输入图片描述

答案1

也许是这样的?

\documentclass[10pt]{article}
\usepackage{tikz}
\pagestyle{empty}
\begin{document}

\begin{tikzpicture}
 \draw[stealth-stealth] (-7,0) node[below]{$-\infty$} -- (7,0) node[below]{$\infty$};
 \draw foreach \X in {-5,-4,...,5} {(\X,.1) -- (\X,-.1) node[below=0.2em,font=\scriptsize]{$\X$}};
 \draw [line width=1pt] (-5,0)-- (5,0);
 \draw [line width=1pt,dash pattern=on 1pt off 1pt,color=red] (180:5) arc(180:225:5);
 \draw [line width=1pt,dash pattern=on 1pt off 1pt,color=blue] (0:2.48)   arc(0:65:2.48);
 \draw [line width=1pt,color=red,stealth-stealth] (0,0)-- (215:5) node[midway,below,sloped,node font=\large] {$d(x,c)$};
 \draw [line width=1pt,color=blue,stealth-stealth] (0,0)-- (20:2.48) node[midway,above,sloped,node font=\large\itshape] {rayon};
 \draw [fill=black] (-5,0) circle[radius=1.5pt] node[above=1pt,font=\LARGE]{$a$} (5,0) circle[radius=1.5pt] node[above=1pt,font=\LARGE]{$b$};
 \draw [fill=red] (0,0) circle[radius=2pt] node[above=2pt,font=\LARGE] {$c$};
 \draw [fill=blue] (2.48,0) circle[radius=2.5pt] node[above right=1.5pt,font=\LARGE] {$x$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

替代 ...

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta}

\usepackage{mathrsfs}

\begin{document}
    \begin{tikzpicture}[
dot/.style = {circle, fill, inner sep=2pt, 
              node contents={}},
lbl/.style = {text=black, sloped},
every label/.append style = {text=black}
                        ]
% axis
\draw[stealth-stealth] (-7,0) node[below]{$-\infty$} -- (7,0) node[below]{$\infty$};
% ticks
\foreach \X in {-5,-4,...,5} 
{
\draw (\X,.1) -- (\X,-.1) node[below=] {$\X$};
}
% interval
\draw[line width=1pt] (-5,0) node[dot,label=$a$]
                   -- ( 5,0) node[dot,label=$b$];
% blue arc and vector
\draw[very thick,dotted,blue]   (2.48,0) node[dot,label=below:$x$] arc (0:30:2.48);
\draw[very thick,blue,-Stealth] (0,0) -- node[lbl,above] {$d(x,c)$}  (2.3,0.87);
% red arc and vector
\draw[very thick,dotted,red]    (-5,0) arc (180:225:5);
\node[dot, red, label=$c$];
\draw[very thick,red,-Stealth]  (0,0) -- node[lbl,above] {$\mathit{rayon}$} (-4,-3);
    \en*emphasized text*d{tikzpicture}
\end{document}

在此处输入图片描述

相关内容