please refer to the answer of how to draw a process flow figure?
Now I want to change the line of "and->path1" to the dashed line, i added [style=dashed], unfortunately it doesn't change, why?
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\tikzset{level 1/.style={level distance=1.5cm, sibling distance=3.5cm}}
\tikzset{level 2/.style={level distance=1.5cm, sibling distance=2cm}}
\tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}
\begin{document}
\begin{tikzpicture}[grow=down, -stealth]
\node[bag]{$(B)$}
child{ edge from parent node[right]{t}; \node[bag]{$(Rgood)$}
child{ edge from parent node[right]{and}; \node[bag]{$(and)$}
child[missing]
child{ edge from parent node[right=0.1cm][style =dashed]{it}; \node[bag]{$(path1)$}}
child{ edge from parent node[right=0.1cm]{else}; \node[bag]{$(path2)$}}
}
};
\end{tikzpicture}
\end{document}
Best Answer
It is possible to locally define a style introducing the option near the keyword
child
.The example, therefore, should become:
The result is:
For completeness, let see what happens playing with the position of options.
In the previous example, assume each time to just change the line:
1. Insert a color definition inside the
node
option.The result is:
2. Let's now shift the color definition by inserting it as option of
edge from parent
.This gives:
Although it seems the identical previous result, actually the connection is first drawn in red, then the style is override by the child definition in black. The label still remains in black.
3. Let's now shift the color definition by inserting it as option of
child
.This gives:
Once the option is put in this position, it holds for all elements.
Please, next time insert your real need in the question rather than ask it later on in the comments. Indeed, I developed the previous code to answer:
Now I want to change the line of "and->path1" to the dashed line, i added [style=dashed], unfortunately it doesn't change, why?
not:
so is there any way to make the line bettween "(Rgood)->(and)" dashed while the line between "(and)->path1" remains the same, that is to say, not dashed?
A workaround for that is: