0

How to add options to \Begin {Scope} like [fill=..., shading angle, top color, bottom color]?

\begin {scope}[color=OrangeD]
\draw [-] plot[smooth, tension=.7] coordinates {(-5.25,1) (-5.15,1.15) (-4.8,1.3) (-4.6,1.6) (-4.3,1.7) (-4.05,2.05) (-3.75,2.1)};
\draw [-](-3.9,2.3) node (v2) {} -- +(0.55,-0.05) -- +(0.5,-0.65) -- +(0.35,-0.45) node (v1) {};
\draw [-] plot[smooth, tension=.7] coordinates {(v1) (-3.8,1.8) (-4.05,1.45) (-4.35,1.35) (-4.5,1.05) (-4.9,0.9) (-5.05,0.65)};
\draw [-](-3.75,2.1)--(-3.9,2.3);
\end{scope} 
  • \begin {scope}[color=OrangeD] \draw [-] plot[smooth, tension=.7] coordinates {(-5.25,1) (-5.15,1.15) (-4.8,1.3) (-4.6,1.6) (-4.3,1.7) (-4.05,2.05) (-3.75,2.1)}; \draw [-](-3.9,2.3) node (v2) {} -- +(0.55,-0.05) -- +(0.5,-0.65) -- +(0.35,-0.45) node (v1) {}; \draw [-] plot[smooth, tension=.7] coordinates {(v1) (-3.8,1.8) (-4.05,1.45) (-4.35,1.35) (-4.5,1.05) (-4.9,0.9) (-5.05,0.65)}; \draw [-](-3.75,2.1)--(-3.9,2.3); \end{scope} – Marwa Hashem Dec 12 '17 at 11:01
  • The color is working but order "fill" is not. – Marwa Hashem Dec 12 '17 at 11:01
  • 1
    instead of placing code in comments, please edit it into your question. (that will, among other things, preserve linebreaks.) also, a compilable example (which is desirable as it allows helpers to experiment rather than inventing something that may not be relevant) begins with \documentclass and ends with \end{document}. – barbara beeton Dec 12 '17 at 18:46
  • Welcome to TeX.SX! Please provide a compilable document, not just a fragment as a comment. You could edit your question. – Bobyandbob Dec 13 '17 at 9:39
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – user36296 Dec 25 '17 at 12:33
3

If you do \begin{scope}[color=orange,fill=blue], that sets the default colors for drawing and filling. But it does not mean that all the paths will be drawn and filled. Take the example below, as no additional options are given to the path macros, \draw just draws the rectangle, \fill just fills it, while \filldraw does both. Note that I used draw=orange, not just orange.

output of code

\documentclass[border=5mm]{standalone} 
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin {scope}[draw=orange,fill=blue,ultra thick]
\draw     (0,0)  rectangle ++(1,0.5) node [below right] {\texttt{\textbackslash draw}};
\fill     (0,-1) rectangle ++(1,0.5) node [below right] {\texttt{\textbackslash fill}};
\filldraw (0,-2) rectangle ++(1,0.5) node [below right] {\texttt{\textbackslash filldraw}};
\end{scope} 
\end{tikzpicture}
\end{document}

You can make all those three act the same, by doing

\begin {scope}[
  every path/.append style={draw=orange,fill=blue},
  ultra thick,xshift=3cm]
\draw     (0,0)  rectangle ++(1,0.5) node [below right] {\texttt{\textbackslash draw}};
\fill     (0,-1) rectangle ++(1,0.5) node [below right] {\texttt{\textbackslash fill}};
\filldraw (0,-2) rectangle ++(1,0.5) node [below right] {\texttt{\textbackslash filldraw}};
\end{scope} 

Note the difference here, that the colour settings are added to the every path style, which means that inside the scope, \draw (0,0) ... will be akin to \draw [draw=orange,fill=blue] (0,0) ..., and similar for \fill and \filldraw:

output with every path setting

If you instead of draw=orange write just orange, or color=orange, that sets the default colour to orange, but it doesn't activate drawing for all paths, so with that setting you'll get

output with orange instead of draw=orange

All three rectangles are filled because of fill=blue, the second one doesn't have a border because it is a \fill without the draw option, and the node texts are orange, because setting a colour like this affects them as well.

For your arrow, I guess you want the outline one colour and the interior of the arrow a different colour. For that you should use a single path, not multiple ones, which makes a scope unnecessary, use

\filldraw [draw=orange,fill=blue]
 plot[smooth, tension=.7] coordinates {(-5.25,1) (-5.15,1.15) (-4.8,1.3) (-4.6,1.6) (-4.3,1.7) (-4.05,2.05) (-3.75,2.1)}
 --(-3.9,2.3) node (v2) {} -- +(0.55,-0.05) -- +(0.5,-0.65) -- +(0.35,-0.45) node (v1) {}
-- plot[smooth, tension=.7] coordinates {(v1) (-3.8,1.8) (-4.05,1.45) (-4.35,1.35) (-4.5,1.05) (-4.9,0.9) (-5.05,0.65)};

which gives you

blue wavy arrow with orange outline

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.