Is it possible to change the line style in a tikz figure in the same \draw command?  I am looking for something like:  \documentclass[tikz]{standalone} \begin{document}     \begin{tikzpicture}         \draw[style1] (0,0) -- ++(1,0)  **CHANGE STYLE** -- ++(1,0);     \end{tikzpicture} \end{document}   The main motivation is that I don't want to loose the relative coordinate as I go on with a long \draw command.
113827
Is it possible to draw thick curve between (2,2) (4,3). Remaining portion must be thin.  \documentclass{article} \usepackage{tikz}  \begin{document} \begin{tikzpicture} \draw [blue] plot [smooth] coordinates {(0,0) (2,2) (4,3) (5,5) (0,10)}; \end{tikzpicture} \end{document}
57728
I'd like to draw vertical/horizontal lines over the entries of a column/row in an array. I find the method to draw horizontal lines at . But when I used the same way to draw the vertical lines. It didn't look well. My codes are:  \usepackage{tikz} \usetikzlibrary{calc} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};} \newcommand{\DrawLine}[3][]{% \begin{tikzpicture}[overlay,remember picture]     \draw [#1] ($(#2)+(0,0.6ex)$) -- ($(#3)+(0,0.6ex)$); \end{tikzpicture}% }%  \begin{displaymath} \left[ \begin{array}{cccc} \tikzmark{11}{15} &amp; 0 &amp; \tikzmark{13}{0} &amp;0\tikzmark{14} \\ 0 &amp; 50 &amp; 20 &amp; 25 \\ 35 &amp; 5 &amp; 0 &amp; 10\\ \tikzmark{41}{0} &amp; 65 &amp; \tikzmark{43}{50} &amp; 65 \end{array} \right]. \DrawLine[black,thick]{11}{14} \DrawLine[black,thick]{11}{41} \DrawLine[black,thick]{13}{43} \end{displaymath}   The result looks like     But the result I want is     Does anyone know how to fix this? Thank you.
86390
Why doesn't the pos = x option work when the node is used in the plot command?  \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}   \draw plot[domain = 0:2, samples = 100] ({\x}, {(\x)^2}) node[pos = 1.1]    {\(y = x^2\)}; \end{tikzpicture} \end{document}   In this picture, f_{quad} is my node that should be at pos = 1.1.    Additionally, it doesn't matter what I make pos equal to.  It is always at the origin.
116398
I need to change the default axes arrowheads size of pgfplots when using the option axis lines=center. Following , I tried this code:  \documentclass{standalone} \usepackage{pgfplots} \usetikzlibrary{arrows, decorations.markings}  \begin{document} \begin{tikzpicture} \tikzstyle{myaxis} = [decoration={markings, mark=at position 1 with {\arrow[ultra thick]{latex'}}},                       postaction={decorate}, shorten &gt;=0.4, line width=0.02pt]; \begin{axis}[axis lines=center, axis line style={myaxis}] \end{axis} \end{tikzpicture} \end{document}   but it doesn't work as I would expect, since the axes lines aren't drawn at all.  Could you help me? Thanks,  Luigi
22304
Hi All: I have a code snippet below which works beautifully and was provided by someone on this list to me a while back.  But now I want to change it so that I draw one long rectangle instead of the adjacent five boxes. The text inside the rectangle should just be at the far right of it and could say $Y^{*}_{whatever}$. I'm thinking that I need to define a rectnode instead of a squared node with different things in it.  But I don't understand how to make it the same length as the length of the boxes and in the same position. &quot;minimum size&quot; currently inside the definition of squarednode isn't making sense to me. EDIT: I have edited this question by including a handwritten drawing in order to express the fact that I need the rectangles to line up with the horizontal axis as shown. So, the first rectangle travels from 0 to 5. The second rectangle travels from 1 to 6, etc all the way to the 6th rectangle travelling from 5 to 10. Also, all the rectangles should be the same width and length even though it may not seem that way by the picture. I also don't need a y-axis. Thanks and I'm sorry for not being clearer the first time.  \begin{tikzpicture}[ squarednode/.style={draw=black, minimum size=9.9mm}, y=1.5cm ]    %boxes      \draw (0.5, 5.5) node[squarednode] {$X_{1}^{*}$};     \draw (1.5, 5.5) node[squarednode] {$X_{2}^{*}$};     \draw (2.5, 5.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 5.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 5.5) node[squarednode] {$X_{5}^{*}$};                  \draw (1.5, 4.5) node[squarednode] {$X_{2}^{*}$};     \draw (2.5, 4.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 4.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 4.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 4.5) node[squarednode,dashed] {0};      \draw (2.5, 3.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 3.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 3.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 3.5) node[squarednode,dashed] {0};     \draw (6.5, 3.5) node[squarednode,dashed] {0};          \draw (3.5, 2.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 2.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 2.5) node[squarednode,dashed] {0};     \draw (6.5, 2.5) node[squarednode,dashed] {0};     \draw (7.5, 2.5) node[squarednode,dashed] {0};          \draw (4.5, 1.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 1.5) node[squarednode,dashed] {0};     \draw (6.5, 1.5) node[squarednode,dashed] {0};     \draw (7.5, 1.5) node[squarednode,dashed] {0};     \draw (8.5, 1.5) node[squarednode,dashed] {0};          \draw (5.5, 0.5) node[squarednode,dashed] {0};     \draw (6.5, 0.5) node[squarednode,dashed] {0};     \draw (7.5, 0.5) node[squarednode,dashed] {0};     \draw (8.5, 0.5) node[squarednode,dashed] {0};     \draw (9.5, 0.5) node[squarednode,dashed] {0};                      \end{tikzpicture}
43216
I have the following tikz code  % compilation command: pdflatex --jobname=Diag-f1 Diag.tex \documentclass{book} \usepackage{tikz} \pgfrealjobname{Diag} \begin{document} \beginpgfgraphicnamed{Diag-f1} \begin{tikzpicture}[node distance=3em] \node(G)[rectangle,fill=red!5,draw=red,text width=5cm]{}; \node(H)[below of=G]{H}; \node(H1)[left of=H]{H1}; \node(H2)[right of=H]{H2}; \draw[-&gt;](G.south)-|(H1.north); \draw[-&gt;](G.south)--(H.north); \draw[-&gt;](G.south)-|(H2.north); \end{tikzpicture} \endpgfgraphicnamed \end{document}     but I am not happy with the two arrows going from G.south to H1.north and H2.north. Because of the -| command, there is a spurious horizontal line. How can I achieve the same result without this annoying horizontal line? \draw[-&gt;](G.south)--(H1.north); is not a solution. There are available tricks but I may have missed an obvious solution here.
92083
I am using the following commands to have half-open interval in a real line:   \begin{tikzpicture}[scale=7] \draw[-&gt;, thick] (-0.1,0) -- (1.7,0); \foreach \x/\xtext in {0/8,0.2/$S_1$,0.4/$T_4$,0.6/$S_3$,0.8/$T_2$,1/$S_3$,1.2/14,1.4/$S_3$,1.6/16}     \draw[thick] (\x,0.5pt) -- (\x,-0.5pt) node[below] {\xtext}; \draw (0.2,0.5pt) node[above] {$c$}; \draw[[-), ultra thick, blue] (0.2,.01) -- (.4,0.01); \draw[(-, ultra thick, green] (0.6,.02) -- (1,0.02); \end{tikzpicture}   Now, I need to have an open-close interval, but I am not able to have that close interval at the end, using the following command:  \begin{tikzpicture}[scale=7] \draw[-&gt;, thick] (-0.1,0) -- (1.7,0); \foreach \x/\xtext in {0/8,0.2/$S_1$,0.4/$T_4$,0.6/$S_3$,0.8/$T_2$,1/$S_3$,1.2/14,1.4/$S_3$,1.6/16}     \draw[thick] (\x,0.5pt) -- (\x,-0.5pt) node[below] {\xtext}; \draw (0.2,0.5pt) node[above] {$c$}; \draw[(-], ultra thick, green] (0.6,.02) -- (1,0.02); \end{tikzpicture}   May I ask for anybody help?
82752
My simple question is how to set some text using tikz in a column e.g.  +---+ | A | | B | | C | +---+   I do not want to rotate the text so I can not use the rotate option or the set text along path method. Can give me a hint how to do it right?
58460
I was looking for a possibility to adjust the anchor of the text of a pin. Tikz does not allow this out of the box.   This question was already asked on the mailing list , Sept. 2009 without any reply till today or feature addition to pgf/tikz:  \documentclass[tikz]{standalone}  \begin{document}      \begin{tikzpicture}[          every pin/.style={anchor=west},          every pin edge/.style={anchor=west}]          \node [pin=60:test] at (0,1) {};          \node [pin={[anchor=west]60:test}] at (0,0) {};      \end{tikzpicture}  \end{document}   There is also a question with a suggested workaround here on  by defining an aligned pin style consisting of another node positioned at the end of the pin using \tikzlastnode:  \tikzset{     aligned pin/.style args={[#1,#2]#3:#4}{         pin={[inner sep=0pt,%               pin distance=#2,% new option, default = 3ex               label={[append after command={%                     node[inner sep=0pt,%                         xshift=-0.1cm,% modified, default = 0                         at=(\tikzlastnode.#3),%                         anchor=#1,%                     ]{#4}%                 }%             ]center:{}}%         ]#3:{}}%     } }   In this code, I have added a second unnamed option for pin distance within the square brackets.  MWE using the workaround showing the desired result:  \documentclass[tikz]{standalone}  \tikzset{     aligned pin/.style args={[#1,#2]#3:#4}{         pin={[inner sep=0pt,%             pin distance=#2,% new option, default = 3ex             label={[append after command={%                     node[%                         inner sep=0pt,%                         xshift=-0.1cm,% modified, default = 0                         at=(\tikzlastnode.#3),%                         anchor=#1,%                     ]{#4}%                 }%             ]center:{}}%         ]#3:{}}%     } } \begin{document} \tikz[pin distance=15mm, every pin/.style={fill=blue,text=white}] \node [circle,draw,     aligned pin={[west,3ex]0:X-Value},%     aligned pin={[west,3ex]45:Y-Value},%     aligned pin={[west,3ex]90:Z-Value}] {my circle}; \end{document}     I would like to add further options such as pin edge to adjust the style of the edge. Another addition would be xshift to finetune the position of the text (and yshift).  Is it possible to change the workaround to allow named options with default values if not specified?  Usage could look like this (without using necessarily all options):  node[aligned pin={[pin anchor=west,pin distance=1cm,pin edge={thick}]90:{txt}}]{};   If someone is interested in the implementation of the pin feature in tikz see  and do a textsearch for pin.  Update after answer by Qrrbrbirlbel:  To achieve almost the same result as my MWE use following code  % use preamble from Qrrbrbirlbel answer \begin{document}  \begin{tikzpicture}[every pin/.append style=draw, every pin edge/.style={thick}] \node[c] [ pin={[pin anchor=south west,pin edge pin anchor=south west,pin distance=6ex]90:Z-Value}, pin={[pin anchor=west,pin edge pin anchor=west,pin distance=6ex]45:Y-Value}, pin={[pin anchor=west,pin edge pin anchor=west,pin distance=6ex]0:X-Value} ] at (0,0) {}; \end{tikzpicture}  \end{document}     However, I would like to finetune the text positioning using inner sep=0 and a slight shift:  \newlength{\xshiftlength} \setlength{\xshiftlength}{0.5\widthof{Z}}   Following works:  \tikzset{   pin inner xsep/.style={tikz@pin@post/.append style={inner xsep=#1}} }   Apparently xshift cannot be added in the same way. It shifts more than only the text. How could a pin text xshift be added?
111498
I am trying to draw a special and contradictive plot : A circle with random distortions which have to remain constant regardless of how many times I build the document.  An example of what I am trying to achieve can be seen below    This figure was produced with the following code  \documentclass{standalone} \usepackage{tikz}    \usetikzlibrary{decorations.pathmorphing}   \begin{document}     \begin{tikzpicture}         % axes         \draw[ultra thin] (-2.5, 0) -- (2.5, 0);         \draw[ultra thin] (0, -2.5) -- (0, 2.5);         % undistorted sphere         \draw[ultra thin, dashed] (0, 0) circle (2.25cm);         \draw[ultra thin, dashed, -&gt;] (0:0) -- (125:2.25);         \node at (-1, 1) {$R$};         % distrorted sphere         \draw[very thick] plot[domain=0:350,smooth cycle ] (\x:2+rnd*0.5);         \draw[very thick, -&gt;] (0:0) -- (45:2.1);         \draw[ultra thin, -&gt;] (1, 0) arc (0:45:1);         \node at (1.2, 0.4) {$\theta$};         \node at (0.7, 1.25) {$R(\theta)$};     \end{tikzpicture} \end{document}   The problem with the code is that whenever I make a change to it and rebuild the document, the "distorted" circle will have a different shape, since I am using the rnd function. The reason I would like to have a constant-random shape is because I would like to denote its radius at an angle θ, therefore it has to touch the outline of the circle.  Any idea on how to achieve such a thing?
59406
Suppose I have a complex figure made ​​with TikZ. How do I use it several times without having to repeat all the commands?  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz}  \begin{document}  Base figure  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1); \end{tikzpicture}  Using base figure.  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1);   \foreach \i in {0,10,...,350}     \node at (\i:2.7) {\tiny $\i^\circ$}; \end{tikzpicture}  Using base figure.  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1);   \foreach \i in {0,10,...,350}     \draw (0,0) -- (\i:2); \end{tikzpicture}  \end{document}
34180
I would like to use tikz * and o arrows to indicate included/excluded endpoints in plots of piecewise functions, like for example the following one:    However, it seems that tikz always aligns the "tip" of the arrow with the end of the line, so that the code   \documentclass{article}  \usepackage{tikz} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture}    \draw[help lines] (-.1,-.1) grid (2.1,2.1);    \draw[thick,-*] (0,1.5) -- (1,.5);    \draw[thick,o-] (1,1.5) -- (2,.5); \end{tikzpicture} \end{document}   produces    where I would like the circles to be vertically aligned on the grid line.   Is there a parameter or code I can modify to get the desired behavior?
71248
I'm using TikZ to plotting some functions for a document. For example, I want to plot 1/(x+1). So I did something like this:  \begin{tikzpicture}[&gt;=stealth,x=3mm,y=3mm] \draw (0,5) node[above]{\fimg $y=f(x+1)=\dfrac{1}{x+1}$}; \clip (-5,-5) rectangle (5,5); \ejes[1]{-4}{4}{-4}{4} \draw[samples=100] plot(\x,{1/(\x+1)}); \end{tikzpicture}   where \ejes[style]{xmin}{xmax}{ymin}{ymax} is command, that I have defined before to draw the axes (join with \fimg). My expected output for the code below was just the function, but I get this:    So, TikZ automagically put the vertical asymptote at x=-1. That isn't a bad thing, but now I want to have some control over it. For example I want dotted lines for vertical asymptotes. How can I do that?
93691
It is apparently possible to put a TikZ drawing inside a pdfcomment (but using mbox).   Is is possible to associate only part of a drawing (e.g. a line) to a pdfcomment? Below it is the suggested code.  I am open to use other interactive packages (similar to pdfcomment) if that can solve the problem. The final goal is to associate individual curves in a pgfplot to a tooltip when dragging the mouse.  \documentclass[]{article} \usepackage{tikz} \usepackage[]{pdfcomment} \begin{document}  %ok \pdfmarkupcomment[]{     text }{     a paragraph }  % ok but needs mbox \pdfmarkupcomment[]{     \mbox{     \begin{tikzpicture}     \draw(0,0)--(1,1);     \draw(0,1)--(1,0);     \end{tikzpicture}} }{     a drawing }  %not ok (Error: Missing } inserted.) \begin{tikzpicture}     \pdfmarkupcomment[]{         \draw(0,0)--(1,1);     }{         a line     }     \draw(0,1)--(1,0); \end{tikzpicture}  \end{document}
46629
I need to draw this kind of simple sequency diagram, but I'm not very good with TikZ:    \begin{figure}[!ht] \begin{center} \begin{tikzpicture}[node distance=2cm,auto,&gt;=stealth']     \node[] (server) {server};     \node[left = of server] (client) {client};     \node[below of=server, node distance=5cm] (server_ground) {};     \node[below of=client, node distance=5cm] (client_ground) {};     %     \draw (client) -- (client_ground);     \draw (server) -- (server_ground);     \draw[-&gt;] ([yshift=-1cm]client.south) -- ([yshift=-1cm]server.south);     \draw[-&gt;] ([yshift=-1.5cm]server.south) -- ([yshift=-1.5cm]client.south); \end{tikzpicture}   I also want the lines to be straight and have text over them.
77511
I have some tikzpictures that were designed for a4 paper and that should now be used on an a0 poster. All the coordinates in the picture can be scaled up with the option scale=4, but this leaves the line widths untouched.  Can I scale the line widths, even those set directly and not using styles like thin, in the entire tikzpicture? Text contained in the picture should not be scaled by this.
48091
I'm in the following situation: Using TikZ, I have drawn a curve which is fairly simply described:  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (1,1.5) .. controls (1,2.25) and (-1,2.25) .. (-1,2)         node[pos=0,anchor=west]{-1}         .. controls (-1,1.75) and (1,1.75) .. (1,2.5)         node[pos=1,anchor=west]{0}         .. controls (1,3.25) and (-1,3.25) .. (-1,3)         .. controls (-1,2.75) and (1,2.75) .. (1,3.5)         node[pos=1,anchor=west]{1}; \end{tikzpicture} \end{document}   However, now I'd like to specify a different style for part of this curve; It happens that the part of this curve I'd like to do something special with is not easily described explicitly. In this particular case, I'd like to apply the style [(-),thick,red] to some arbitrary segment of the curve. I'm looking for an efficient and simple way to do just that.  I was hoping that there might be an option to do something along the lines of \draw[only between 0.2 and 0.8] "curve description", but I'm not aware of any such possibilities.   For extra concreteness, here is a (Paint-made) picture of something like what I'm looking for: