使用自定义形状标记交叉点(TikZ)

使用自定义形状标记交叉点(TikZ)

我想标记\path和之间的交点curve之间的交点。我的圆很好。但我的三角形有问题。三角形表示曲线的方向,它是一种箭头。也许帮助您理解我在说什么。

这是我的 MWE。为了方便,我注释了错误部分。

\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{shapes, arrows.meta, intersections}
\def\trigl{iscoceles triangle[width=1.4mm, rotate=-3]}
\begin{document}
    \begin{tikzpicture}
        \draw[-stealth] (0,0) -- (6.7,0) 
            node[right]{$x$}; %x-axis
        \draw[-stealth] (0,0) -- (0,3) 
            node[above]{$y$}; %y-axis
        \draw [thick, name path=curve1,{Circle[length=1.4mm]}-{Circle[length=1.4mm]}]
            (0.2,1) .. controls (2,.6) and (2.7,.6) .. (2.9,1.5) 
                    .. controls (3.1,2.7) and (4,3) .. (6.5,1.8);
        \path [name path = line1] (1,0)--(1,3.5) (1.4,0)--(1.4,3.5) (2.3,0)--(2.3,3.5) (2.7,0)--(2.7,3.5) (2.93,0)--(2.93,3.5) (3.25,0)--(3.25,3.5) (3.6,0)--(3.6,3.5) (4.4,0)--(4.4,3.5) (5.3,0)--(5.3,3.5) (5.7,0)--(5.7,3.5);
        \fill [name intersections={of=curve1 and line1, name=i}]
        \foreach \s in {1,2,3,4,6,7,8,9,10}{(i-\s) circle (2pt)};
%       \fill [name intersections={of=curve1 and line1, name=i}] {(i-5) \trigl (2pt)};
    \end{tikzpicture}
\end{document}

答案1

node只需通过regular polygon sides=3(如果它是多边形)或circle或等改变形状square,而不是定义新形状。如果其方向不是您想要的,您也可以通过rotate=30或任意量旋转它。

\documentclass[tikz, border=1mm]{standalone}
\usepackage{amsmath}
\usepackage{bm}
\usetikzlibrary{shapes, arrows.meta, intersections}
\begin{document}
    \begin{tikzpicture}
        \draw[-stealth] (0,0) -- (6.7,0) 
            node[right]{$x$}; %x-axis
        \draw[-stealth] (0,0) -- (0,3) 
            node[above]{$y$}; %y-axis
        \draw [thick, name path=curve1,{Circle[length=1.4mm]}-{Circle[length=1.4mm]}]
            (0.2,1) .. controls (2,.6) and (2.7,.6) .. (2.9,1.5) 
                    .. controls (3.1,2.7) and (4,3) .. (6.5,1.8);
        \path [name path = line1] (1,0)--(1,3.5) (1.4,0)--(1.4,3.5) (2.3,0)--(2.3,3.5) 
       (2.7,0)--(2.7,3.5) (2.93,0)--(2.93,3.5) (3.25,0)--(3.25,3.5) (3.6,0)--(3.6,3.5) 
       (4.4,0)--(4.4,3.5) (5.3,0)--(5.3,3.5) (5.7,0)--(5.7,3.5);
        \fill [name intersections={of=curve1 and line1, name=i}]
        \foreach \s in {1,2,3,4,6,7,8,9,10}{(i-\s) circle (2pt)};
       \path [name intersections={of=curve1 and line1, name=i}] (i-5) node[regular 
      polygon,regular polygon sides=3, fill,inner sep=1pt] {};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容