如何阴影化一条线以及如何偏移一条线?

如何阴影化一条线以及如何偏移一条线?

我是新手。有人能告诉我如何 (1) 阴影化一条线和 (2) 如何偏移一条线吗?

我有一个非常简单的图表,在此处输入图片描述

这是有限元分析中使用的网格,我已经使用 tikz 构建了一个网格,我对它很满意。但现在我想改进它!阴影效果表示它是“固定墙”,第二层网格线应该与第一层墙线偏移。

这是我生成网格的脚本。(您不需要遵循此脚本。您可以忽略此脚本,两层网格线对我来说就足够了。)

\begin{tikzpicture}
[
    scale=1,
    every node/.style={scale=0.5},
    x=0.1cm,y=0.1cm
]
\usetikzlibrary{calc}

\usetikzlibrary{arrows,patterns}


\draw ( 0.0, 0.0)--( 8.0, 0.0)--(16.0, 0.0)--(22.0, 3.0)--(26.5, 6.5)--(30.0,14.5)--(33.0,16.2)--(36.0,14.5)--(39.5, 6.5)--(44.0, 3.0)--(50.0, 0.0)--(58.0, 0.0)--(66.0, 0.0);
\draw (0.0,8.5)--(8.0,8.8)--(14.2,9.1)--(17.9,10.0)--(22.5,12.0)--(27.6,17.6)--(32.2,19.7)--(38.4,17.6)--(43.5,12.0)--(48.1,10.0)--(51.8, 9.1)--(58.0, 8.8)--(66.0,8.5);
\draw (0.0,17.3)--(6.2,18.5)--(11.2,18.8)--(14.6,19.0)--(21.9,19.9)--(28.4,22.5)--(35.0,25.0)--(37.6,22.5)--(44.1,19.9)--(51.4,19.0)--(54.8,18.8)--(59.8,18.5)--(66.0,17.3);
\draw (0.0,30.0)--(6.2,30.0)--(11.2,30.0)--(14.6,30.0)--(21.9,30.0)--(28.4,30.0)--(35.0,30.0)--(37.6,30.0)--(44.1,30.0)--(51.4,30.0)--(54.8,30.0)--(59.8,30.0)--(66.0,30.0);
\draw ( 0.0, 0.0)--( 0.0, 8.5)--( 0.0,17.3)--( 0.0,30.0);
\draw ( 8.0, 0.0)--( 8.0, 8.8)--( 6.2,18.5)--( 6.2,30.0);
\draw (16.0, 0.0)--(14.2, 9.1)--(11.2,18.8)--(11.2,30.0);
\draw (22.0, 3.0)--(17.9,10.0)--(14.6,19.0)--(14.6,30.0);
\draw (26.5, 6.5)--(22.5,12.0)--(21.9,19.9)--(21.9,30.0);
\draw (30.0,14.5)--(27.6,17.6)--(28.4,22.5)--(28.4,30.0);
\draw (33.0,16.2)--(32.2,19.7)--(35.0,25.0)--(35.0,30.0);
\draw (36.0,14.5)--(38.4,17.6)--(37.6,22.5)--(37.6,30.0);
\draw (39.5, 6.5)--(43.5,12.0)--(44.1,19.9)--(44.1,30.0);
\draw (44.0, 3.0)--(48.1,10.0)--(51.4,19.0)--(51.4,30.0);
\draw (50.0, 0.0)--(51.8, 9.1)--(54.8,18.8)--(54.8,30.0);
\draw (58.0, 0.0)--(58.0, 8.8)--(59.8,18.5)--(59.8,30.0);
\draw (66.0, 0.0)--(66.0, 8.5)--(66.0,17.3)--(66.0,30.0);



\end{tikzpicture}

答案1

带剪辑:

代码

\documentclass[tikz,border=3mm]{standalone}

\begin{document}

\newcommand{\mypath}{(0.0,0.0) -- ( 8.0, 0.0) -- (16.0, 0.0) -- (22.0, 3.0) -- (26.5,6.5) -- (30.0,14.5) -- (33.0,16.2) -- (36.0,14.5) -- (39.5,6.5) -- (44.0,3.0) -- (50.0,0.0) -- (58.0,0.0) -- (66.0, 0.0)}

\begin{tikzpicture}
[   scale=0.1,
]
    \draw \mypath;
    \draw (0.0,8.5) -- (8.0,8.8) -- (14.2,9.1) -- (17.9,10.0) -- (22.5,12.0) -- (27.6,17.6) -- (32.2,19.7) -- (38.4,17.6) -- (43.5,12.0) -- (48.1,10.0) -- (51.8, 9.1) -- (58.0, 8.8) -- (66.0,8.5);
    \draw (0.0,17.3) -- (6.2,18.5) -- (11.2,18.8) -- (14.6,19.0) -- (21.9,19.9) -- (28.4,22.5) -- (35.0,25.0) -- (37.6,22.5) -- (44.1,19.9) -- (51.4,19.0) -- (54.8,18.8) -- (59.8,18.5) -- (66.0,17.3);
    \draw (0.0,30.0) -- (6.2,30.0) -- (11.2,30.0) -- (14.6,30.0) -- (21.9,30.0) -- (28.4,30.0) -- (35.0,30.0) -- (37.6,30.0) -- (44.1,30.0) -- (51.4,30.0) -- (54.8,30.0) -- (59.8,30.0) -- (66.0,30.0);
    \draw ( 0.0, 0.0) -- ( 0.0, 8.5) -- ( 0.0,17.3) -- ( 0.0,30.0);
    \draw ( 8.0, 0.0) -- ( 8.0, 8.8) -- ( 6.2,18.5) -- ( 6.2,30.0);
    \draw (16.0, 0.0) -- (14.2, 9.1) -- (11.2,18.8) -- (11.2,30.0);
    \draw (22.0, 3.0) -- (17.9,10.0) -- (14.6,19.0) -- (14.6,30.0);
    \draw (26.5, 6.5) -- (22.5,12.0) -- (21.9,19.9) -- (21.9,30.0);
    \draw (30.0,14.5) -- (27.6,17.6) -- (28.4,22.5) -- (28.4,30.0);
    \draw (33.0,16.2) -- (32.2,19.7) -- (35.0,25.0) -- (35.0,30.0);
    \draw (36.0,14.5) -- (38.4,17.6) -- (37.6,22.5) -- (37.6,30.0);
    \draw (39.5, 6.5) -- (43.5,12.0) -- (44.1,19.9) -- (44.1,30.0);
    \draw (44.0, 3.0) -- (48.1,10.0) -- (51.4,19.0) -- (51.4,30.0);
    \draw (50.0, 0.0) -- (51.8, 9.1) -- (54.8,18.8) -- (54.8,30.0);
    \draw (58.0, 0.0) -- (58.0, 8.8) -- (59.8,18.5) -- (59.8,30.0);
    \draw (66.0, 0.0) -- (66.0, 8.5) -- (66.0,17.3) -- (66.0,30.0);
    \begin{scope}
        \clip \mypath |- (0,-2) -- cycle;
        \draw[line width=1mm,densely dotted] \mypath;
    \end{scope}
\end{tikzpicture}

\end{document}

输出

在此处输入图片描述


带装饰:

代码

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\newcommand{\mypath}{(0.0,0.0) -- ( 8.0, 0.0) -- (16.0, 0.0) -- (22.0, 3.0) -- (26.5,6.5) -- (30.0,14.5) -- (33.0,16.2) -- (36.0,14.5) -- (39.5,6.5) -- (44.0,3.0) -- (50.0,0.0) -- (58.0,0.0) -- (66.0, 0.0)}

\begin{tikzpicture}
[   scale=0.1,
]
    \draw \mypath;
    \draw (0.0,8.5) -- (8.0,8.8) -- (14.2,9.1) -- (17.9,10.0) -- (22.5,12.0) -- (27.6,17.6) -- (32.2,19.7) -- (38.4,17.6) -- (43.5,12.0) -- (48.1,10.0) -- (51.8, 9.1) -- (58.0, 8.8) -- (66.0,8.5);
    \draw (0.0,17.3) -- (6.2,18.5) -- (11.2,18.8) -- (14.6,19.0) -- (21.9,19.9) -- (28.4,22.5) -- (35.0,25.0) -- (37.6,22.5) -- (44.1,19.9) -- (51.4,19.0) -- (54.8,18.8) -- (59.8,18.5) -- (66.0,17.3);
    \draw (0.0,30.0) -- (6.2,30.0) -- (11.2,30.0) -- (14.6,30.0) -- (21.9,30.0) -- (28.4,30.0) -- (35.0,30.0) -- (37.6,30.0) -- (44.1,30.0) -- (51.4,30.0) -- (54.8,30.0) -- (59.8,30.0) -- (66.0,30.0);
    \draw ( 0.0, 0.0) -- ( 0.0, 8.5) -- ( 0.0,17.3) -- ( 0.0,30.0);
    \draw ( 8.0, 0.0) -- ( 8.0, 8.8) -- ( 6.2,18.5) -- ( 6.2,30.0);
    \draw (16.0, 0.0) -- (14.2, 9.1) -- (11.2,18.8) -- (11.2,30.0);
    \draw (22.0, 3.0) -- (17.9,10.0) -- (14.6,19.0) -- (14.6,30.0);
    \draw (26.5, 6.5) -- (22.5,12.0) -- (21.9,19.9) -- (21.9,30.0);
    \draw (30.0,14.5) -- (27.6,17.6) -- (28.4,22.5) -- (28.4,30.0);
    \draw (33.0,16.2) -- (32.2,19.7) -- (35.0,25.0) -- (35.0,30.0);
    \draw (36.0,14.5) -- (38.4,17.6) -- (37.6,22.5) -- (37.6,30.0);
    \draw (39.5, 6.5) -- (43.5,12.0) -- (44.1,19.9) -- (44.1,30.0);
    \draw (44.0, 3.0) -- (48.1,10.0) -- (51.4,19.0) -- (51.4,30.0);
    \draw (50.0, 0.0) -- (51.8, 9.1) -- (54.8,18.8) -- (54.8,30.0);
    \draw (58.0, 0.0) -- (58.0, 8.8) -- (59.8,18.5) -- (59.8,30.0);
    \draw (66.0, 0.0) -- (66.0, 8.5) -- (66.0,17.3) -- (66.0,30.0);
    \draw[decoration={ticks,segment length=0.25mm,amplitude=0.3mm,raise=-0.25mm},decorate] \mypath;

\end{tikzpicture}

\end{document}

输出

在此处输入图片描述


带有倾斜线条:

代码

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\newcommand{\mypath}{(0.0,0.0) -- ( 8.0, 0.0) -- (16.0, 0.0) -- (22.0, 3.0) -- (26.5,6.5) -- (30.0,14.5) -- (33.0,16.2) -- (36.0,14.5) -- (39.5,6.5) -- (44.0,3.0) -- (50.0,0.0) -- (58.0,0.0) -- (66.0, 0.0)}

\begin{tikzpicture}
[   scale=0.1,
]
    \draw \mypath;
    \draw (0.0,8.5) -- (8.0,8.8) -- (14.2,9.1) -- (17.9,10.0) -- (22.5,12.0) -- (27.6,17.6) -- (32.2,19.7) -- (38.4,17.6) -- (43.5,12.0) -- (48.1,10.0) -- (51.8, 9.1) -- (58.0, 8.8) -- (66.0,8.5);
    \draw (0.0,17.3) -- (6.2,18.5) -- (11.2,18.8) -- (14.6,19.0) -- (21.9,19.9) -- (28.4,22.5) -- (35.0,25.0) -- (37.6,22.5) -- (44.1,19.9) -- (51.4,19.0) -- (54.8,18.8) -- (59.8,18.5) -- (66.0,17.3);
    \draw (0.0,30.0) -- (6.2,30.0) -- (11.2,30.0) -- (14.6,30.0) -- (21.9,30.0) -- (28.4,30.0) -- (35.0,30.0) -- (37.6,30.0) -- (44.1,30.0) -- (51.4,30.0) -- (54.8,30.0) -- (59.8,30.0) -- (66.0,30.0);
    \draw ( 0.0, 0.0) -- ( 0.0, 8.5) -- ( 0.0,17.3) -- ( 0.0,30.0);
    \draw ( 8.0, 0.0) -- ( 8.0, 8.8) -- ( 6.2,18.5) -- ( 6.2,30.0);
    \draw (16.0, 0.0) -- (14.2, 9.1) -- (11.2,18.8) -- (11.2,30.0);
    \draw (22.0, 3.0) -- (17.9,10.0) -- (14.6,19.0) -- (14.6,30.0);
    \draw (26.5, 6.5) -- (22.5,12.0) -- (21.9,19.9) -- (21.9,30.0);
    \draw (30.0,14.5) -- (27.6,17.6) -- (28.4,22.5) -- (28.4,30.0);
    \draw (33.0,16.2) -- (32.2,19.7) -- (35.0,25.0) -- (35.0,30.0);
    \draw (36.0,14.5) -- (38.4,17.6) -- (37.6,22.5) -- (37.6,30.0);
    \draw (39.5, 6.5) -- (43.5,12.0) -- (44.1,19.9) -- (44.1,30.0);
    \draw (44.0, 3.0) -- (48.1,10.0) -- (51.4,19.0) -- (51.4,30.0);
    \draw (50.0, 0.0) -- (51.8, 9.1) -- (54.8,18.8) -- (54.8,30.0);
    \draw (58.0, 0.0) -- (58.0, 8.8) -- (59.8,18.5) -- (59.8,30.0);
    \draw (66.0, 0.0) -- (66.0, 8.5) -- (66.0,17.3) -- (66.0,30.0);
    \draw[decoration={border,segment length=0.3mm,amplitude=0.8mm,mirror,angle=45},decorate] \mypath;
\end{tikzpicture}

\end{document}

输出

在此处输入图片描述

相关内容