0

For the parabolic plot shown in the MWE below. I need to replace the fill pattern (represented by the blue lines) with arrows pointing downwards towards the black line.

\documentclass{article}
\usepackage{amsmath} 
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[help lines,step=0.5](0,0) grid(15,24);
\draw[thick,color=black] (0,12) -- (12,12);
\begin{scope}[shift={(0,12)}]
\draw[pattern=vertical lines,pattern color=blue, domain=0:12] plot (\x, {(0.075*2)*(4*\x/12)*(12-\x)});
\draw[thick,color=red, domain=0:12] plot (\x, {(0.075*2)*(4*\x/12)*(12-\x)});
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}

Compilation Output

Other packages offer hatching patterns similar to that I mentioned above, but they deal with linear plots and not parabolic ones, I extracted the macros from such packages and placed it below:

1- stanli package:


    %------------------------------------------------
%       lineload
%------------------------------------------------
%           \lineload{type}{initial point}{end point}[initial force value][end force value][force interval]
%               [initial force value][end force value][force interval] are optional
%
%           and accordingly for type 3      
%
%           \lineload{type}{initial point}{end point}[initial force value][end force value][lineload distance from inital point][force interval]
%               [initial force value][end force value][lineload distance from inital point][force interval] are optional
%
%           and accordingly for type 4      
%
%           \lineload{type}{initial point}{end point}[force interval][force length]
%               [force interval][force length] are optional

\newcommandx{\lineload}[7][4=1,5=1,6=\lineloadInterval,7=\lineloadInterval]{
    \ifthenelse{\equal{#1}{1}}{     %
        \coordinate (lineloadVarA1) at ($ (#2)!\lineloadDistance!90:(#3) $);
        \coordinate (lineloadVarB1) at ($ (#3)!\lineloadDistance!-90:(#2) $);
        \coordinate (lineloadVarA2) at ($ (#2)!{\lineloadDistance +#4cm}!90:(#3) $);
        \coordinate (lineloadVarB2) at ($ (#3)!{\lineloadDistance+#5cm}!-90:(#2) $);
        \ifthenelse{\equal{#4}{0}}{}
        {
            \draw [force,->] (lineloadVarA2) -- (lineloadVarA1);
        }
        \ifthenelse{\equal{#5}{0}}{}
        {
            \draw [force,->] (lineloadVarB2) -- (lineloadVarB1);
        }
        \draw [smallLine] (lineloadVarA1) -- (lineloadVarB1) node(xline)[right] {};
        \draw [normalLine] (lineloadVarA2) -- (lineloadVarB2);
        \fill (lineloadVarA2) circle (\normalLineWidth/2);
        \fill (lineloadVarB2) circle (\normalLineWidth/2);
            \pgfmathsetmacro{\lineloadIntervalBegin}{#6/\scalingParameter}
            \pgfmathsetmacro{\lineloadIntervalStep}{#6/\scalingParameter*2}
            \pgfmathsetmacro{\lineloadIntervalEnd}{1-#6/\scalingParameter}
        \foreach \i in {\lineloadIntervalBegin,\lineloadIntervalStep,...,\lineloadIntervalEnd}
        \draw [force,->] ($(lineloadVarA2)!\i!(lineloadVarB2)$)-- ($(lineloadVarA1)!\i!(lineloadVarB1)$);
    }{}
    
    \ifthenelse{\equal{#1}{2}}{     %
        \coordinate (lineloadVarA1) at ($ (#2)+1*(0,\lineloadDistance) $);
        \coordinate (lineloadVarB1) at ($ (#3)+1*(0,\lineloadDistance) $);
        \coordinate (lineloadVarA2) at ($ (#2)+1*(0,\lineloadDistance+#4cm) $);
        \coordinate (lineloadVarB2) at ($ (#3)+1*(0,\lineloadDistance+#5cm) $);
        \ifthenelse{\equal{#4}{0}}{}
        {
            \draw [force,->] (lineloadVarA2) -- (lineloadVarA1);
        }
        \ifthenelse{\equal{#5}{0}}{}
        {
            \draw [force,->] (lineloadVarB2) -- (lineloadVarB1);
        }
        \draw [smallLine] (lineloadVarA1) -- (lineloadVarB1) node(xline)[right] {};
        \draw [normalLine] (lineloadVarA2) -- (lineloadVarB2);
        \fill (lineloadVarA2) circle (\normalLineWidth/2);
        \fill (lineloadVarB2) circle (\normalLineWidth/2);
            \pgfmathsetmacro{\lineloadIntervalBegin}{#6}
            \pgfmathsetmacro{\lineloadIntervalStep}{#6*2}
            \pgfmathsetmacro{\lineloadIntervalEnd}{1-#6}
        \foreach \i in {\lineloadIntervalBegin,\lineloadIntervalStep,...,\lineloadIntervalEnd}
        \draw [force,->] ($(lineloadVarA2)!\i!(lineloadVarB2)$)-- ($(lineloadVarA1)!\i!(lineloadVarB1)$);
    }{}

    \ifthenelse{\equal{#1}{3}}{     %
        \ifthenelse{\equal{#6}{\lineloadInterval}}
            {\renewcommand{\helpVarA}{0cm}}
            {\renewcommand{\helpVarA}{#6cm}}
        \path
            let
                \p1 = (#2),
                \p2 = (#3)
            in
                coordinate (lineloadVarA1) at ($(\p1)+1*(0,\lineloadDistance+\helpVarA)$)
                coordinate (lineloadVarB1) at ($(\x2,\y1)+1*(0,\lineloadDistance+\helpVarA)$)
                coordinate (lineloadVarA2) at ($ (\p1)+1*(0,\lineloadDistance+\helpVarA+#4cm)$)
                coordinate (lineloadVarB2) at ($ (\x2,\y1)+1*(0,\lineloadDistance+\helpVarA+#5cm)$);
        \draw [tinyLine,loosely dotted] (lineloadVarA1)--($(#2)+1*(0,\hingeRadius)$);
        \draw [tinyLine,loosely dotted] (lineloadVarB1)--($(#3)+1*(0,\hingeRadius)$);
        \ifthenelse{\equal{#4}{0}}{}
        {
            \draw [force,->] (lineloadVarA2) -- (lineloadVarA1);
        }
        \ifthenelse{\equal{#5}{0}}{}
        {
            \draw [force,->] (lineloadVarB2) -- (lineloadVarB1);
        }
        \draw [smallLine] (lineloadVarA1) -- (lineloadVarB1) node(xline)[right] {};
        \draw [normalLine] (lineloadVarA2) -- (lineloadVarB2);
        \fill (lineloadVarA2) circle (\normalLineWidth/2);
        \fill (lineloadVarB2) circle (\normalLineWidth/2);
            \pgfmathsetmacro{\lineloadIntervalBegin}{#7}
            \pgfmathsetmacro{\lineloadIntervalStep}{#7*2}
            \pgfmathsetmacro{\lineloadIntervalEnd}{1-#7}
        \foreach \i in {\lineloadIntervalBegin,\lineloadIntervalStep,...,\lineloadIntervalEnd}
        \draw [force,->] ($(lineloadVarA2)!\i!(lineloadVarB2)$)-- ($(lineloadVarA1)!\i!(lineloadVarB1)$);
    }{}
    
    \ifthenelse{\equal{#1}{4}}{     %
        \coordinate (lineloadVarA1) at ($ (#2)+1*(0,\lineloadDistance) $);
        \coordinate (lineloadVarB1) at ($ (#3)+1*(0,\lineloadDistance) $);
        \ifthenelse{\equal{#4}{1}}
            {\pgfmathsetmacro{\lineloadIntervalStep}{\lineloadInterval}
            \pgfmathsetmacro{\lineloadIntervalEnd}{1-\lineloadInterval/2}}  
            {\pgfmathsetmacro{\lineloadIntervalStep}{#4}
            \pgfmathsetmacro{\lineloadIntervalEnd}{1-#4/2}}
        \ifthenelse{\equal{#5}{1}}
            {\pgfmathsetmacro{\lineloadForceLength}{\lineloadForce}}    
            {\pgfmathsetmacro{\lineloadForceLength}{#5}}
        \foreach \i in {0,\lineloadIntervalStep,...,\lineloadIntervalEnd}
        \draw [force,->] ($(lineloadVarA1)!\i!(lineloadVarB1)$) -- ($(lineloadVarA1)!\i+\lineloadForceLength!(lineloadVarB1)$);
    }{}

}

2- structmech package

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     Command 4: UDL
% \UDL[1]{2}{3}[4]{5}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\NewDocumentCommand{\UDL}{O{N} m m O{} G{1}}{
\IfEq{#1}{F}{\def\FAC{-1}}{\def\FAC{1}}
\coordinate(A)at(#2);
\coordinate(B)at(#3);
\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}}
\let\Angle\pgfmathresult
\pgfpointdiff{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}}
\pgfmathparse{veclen(\pgf@x,\pgf@y)/28.45274}
\let\Length\pgfmathresult
\draw[\fillColor,fill=\fillColor,fill opacity=\fillOpacity](#2)--(#3)--($(#3)+(\Angle+\FAC*90:#5)$)--($(#2)+(\Angle+\FAC*90:#5)$)--cycle;
\IfNoValueTF{#4}
    {}
    {\IfStrEq{\convention}{sign}
        {\node[NOFILL]at($(#2)!.5!(#3)+(\Angle+\FAC*90:1.2*#5)$)[rotate=\Angle]{$#4$};}
        {\StrLeft{#4}{1}[\SS]\IfStrEq{\SS}{-}
            {\node[NOFILL]at($(#2)!.5!(#3)+(\Angle+\FAC*90:1.2*#5)$)[rotate=\Angle]{$\StrDel[1]{#4}{-}$};}
            {\node[NOFILL]at($(#2)!.5!(#3)+(\Angle+\FAC*90:1.2*#5)$)[rotate=\Angle]{$#4$};}
        }
    }
\foreach\x in{0,.1,.2,...,1}{
\coordinate(C)at($(#2)!\x!(#3)$);
\IfNoValueTF{#4}
    {\draw[<-](C)--++($(\Angle+\FAC*90:#5)$);}
    {\IfStrEq{\convention}{sign}
        {\draw[<-](C)--++($(\Angle+\FAC*90:#5)$);}
        {\StrLeft{#4}{1}[\SS]\IfStrEq{\SS}{-}
            {\draw[->](C)--++($(\Angle+\FAC*90:#5)$);}
            {\draw[<-](C)--++($(\Angle+\FAC*90:#5)$);}
        }
    }
};
}
\makeatother

3- As for pst stru package/library, I don't think it is recomended is such case

5
  • "Other packages" other than what? I do not know these packages, and you do not explain how they are relevant for your question!? – hpekristiansen Nov 25 '20 at 20:18
  • @hpekristiansen, First, as I mentioned bove, since many do not know such packages thus I did not use them in the MWE. Second, regarding their relevance to the question above, here is an example with stanli "Structural aanlysis package = Stanli package (renamed in the last update)" texample.net/tikz/examples/transversal-loads, also see page "5" of this manual ftp.ntua.gr/mirror/ctan/graphics/pgf/contrib/structmech/doc/… – Silva Nov 25 '20 at 20:39
  • If you want to achieve the result using the stanli TikZ Library, then you should start a new question. I do not know this libary, and can not help. This library is not relevant for your current question. – hpekristiansen Nov 25 '20 at 20:52
  • I only placed the "macros" from such packages as an aid no more. – Silva Nov 25 '20 at 21:00
  • Before you pasted your "aid", you already got two answers and you have not explained why they are not useable. I do not think that you will get more answers, as it is very unclear what you want. – hpekristiansen Nov 26 '20 at 11:18
3

I do not think that you can get an arrow pattern without manipulating PGF code. Why not just draw the arrows yourself? - like this:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[help lines,step=0.5](0,0) grid(15,24);
\draw[thick,color=black] (0,12) -- (12,12);
\begin{scope}[shift={(0,12)}]
\foreach \x in {0.2 ,0.4 , ...,11.8}
   \draw[thick, blue, ->] (\x, {(0.075*2)*(4*\x/12)*(12-\x)}) -- (\x,0);
\draw[thick,color=red, domain=0:12] plot (\x, {(0.075*2)*(4*\x/12)*(12-\x)});
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}

Pattern with arrows

1
  • That is quite a good suggestion, to be honest, I modelled this example using tikz package so that anyone can get what I mean. However, Other paclages shown in this post tex.stackexchange.com/questions/561524/…, they offer hatching pattern but only for linear loads. Regarding hatching patterns, I added the code of the macros in each of those packages above, but I doubt if you can get use of it. – Silva Nov 25 '20 at 20:00
4

If you use a path picture, you do not need to know the parametrization of the boundary. The distance between the lines is stored in vline pars/d, which is set to 3mm in the code below, and the arrow style is just the argument of the vlines style that got added here.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc}
\tikzset{vlines/.style={path picture={
\path let \p1=($(path picture bounding box.east)-(path picture bounding box.west)$),
\p2=(path picture bounding box.north east),
\n1={int(scalar(\x1/\pgfkeysvalueof{/tikz/vline pars/d}))},
\n2={0.5*(\x1-\n1*\pgfkeysvalueof{/tikz/vline pars/d})} in
foreach \xyz in {0,...,\n1} {
([xshift=\n2+\xyz*\x1/\n1]path picture bounding box.north west) edge[#1]
([xshift=\n2+\xyz*\x1/\n1]path picture bounding box.south west)
}
;
}},vline pars/.cd,d/.initial=3mm}
\begin{document}
\begin{tikzpicture}
\draw[help lines,step=0.5](0,0) grid(15,24);
\draw[thick,color=black] (0,12) -- (12,12);
\begin{scope}[shift={(0,12)}]
\draw[domain=0:12] 
plot (\x, {(0.075*2)*(4*\x/12)*(12-\x)});
\draw[vlines={blue,-latex},thick,color=red, domain=0:12] plot (\x, {(0.075*2)*(4*\x/12)*(12-\x)});
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.