如何绘制带有非数字刻度的数轴?

如何绘制带有非数字刻度的数轴?

我想检查是否可以绘制一条与所示类似的数字线。如果可以,我该怎么做?谢谢!

在此处输入图片描述

        \begin{tikzpicture}[



            letter/.style={circle, minimum size=5pt, inner sep=0, outer sep=0, fill=black, label=below:#1},

            number/.style={fill=white, pos=.5}
            ]

            \draw (0,0) --
                node(A)[letter=$0$,pos=.1]{}
                node(B)[letter=$\mu$,pos=.2]{}
                node(C)[letter=$\bar{c}$,pos=.7]{}
                node(D)[letter=$d$,pos=.9]{}
                  (8,0)
            ;

            \draw[ultra thick] (0.8,0) -- (5.6,0);    

        \end{tikzpicture}

答案1

一个简单的解决方案pstricks

\documentclass[border=3pt]{standalone}
\usepackage{pstricks-add, auto-pst-pdf}%

\begin{document}

\begin{pspicture}
\psline(0,0)(10,0)
\dotnodes[dotstyle=|, dotscale= 1.5 4](1,0){O}(3,0){M}(7,0){C}(9,0){D}
\psset{labelsep=8pt, linejoin=1}
\nput{-90}{O}{$ 0 $}
\nput{-90}{M}{$ \mu $}
\nput{-90}{C}{$ \bar c $}
\nput[labelsep = 7pt]{-90}{D}{$ d $}
\pnodes[0,-0.8](1,0){O1}(7,0){C1}
\psbrace[braceWidthInner=5pt, braceWidthOuter=3pt, braceWidth=0.8pt, rot=90, nodesepA=-2pt, nodesepB=8pt,](O1)(C1){$ a $}
\end{pspicture}

\end{document} 

在此处输入图片描述

带有连接的变体ncbar和更简单的代码:

\documentclass[border=3pt, svgnames]{standalone}
\usepackage{pstricks-add, auto-pst-pdf}%

\begin{document}

\begin{pspicture}
\everypsbox{\strut}\psset{linejoin=1}
\psline(0,0)(10,0)
\dotnodes[dotstyle=|, dotscale= 1.5 4](1,0){O}(3,0){M}(7,0){C}(9,0){D}
\nput{-90}{O}{$ 0 $}
\nput{-90}{M}{$ μ$}
\nput{-90}{C}{$ \bar c $}
\nput{-90}{D}{$ d $}
\ncbar[linecolor=Tomato, nodesep=0.7, angle =-90]{*-*}{O}{C}\ncput*{$ a $}
\end{pspicture}

\end{document} 

在此处输入图片描述

答案2

开始之前:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\foreach \x/\y in {0/0, 1/\mu, 4/\bar{c}, 5/d}
 \draw[ultra thick] (\x,0.25) -- (\x,-0.25) node[below]{$\y$};
\draw[ultra thick] (-0.5,0)--(5.5,0);
\end{tikzpicture}
\end{document}

在此处输入图片描述

有关详细信息,请参阅For more information, seepgf/tikz 手册

相关内容