# Tag Info

## Hot answers tagged tikz-graphdrawing

21

To get the exact slope without the definition of the function, you can use to[out=...,in=...] by TikZ. The following diagram may show you all about to: You want slope of the plot is −1 at some points. You can have it by to[out=135,in=-45] if you are going up, or to[out=-45,in=135] if you are going down. This can be proved by using simple trigonometry. ...

19

As detailed in the https://github.com/u-fischer/luaotfload/issues/6, pgf_lookup_and_require wrongly uses resolvers.findfile to find the graph drawing libraries when used with ConTeXt. This bug surfaced when luaotfload was upgraded which now also the resolvers.findfile function. The problem is clearly with PGF here, because resolvers.findfile is to find ...

14

The code illustrates the use of polar coordinates which make it easy to construct symmetrical graphs. \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}% [vertex/.style={circle,draw,fill=black,minimum width=1.5mm,inner sep=0mm}] \newcommand\coce{0.5}% distance of triangle corners from ...

11

You can use a decoration. The main problem is the mark at the end of path (see Tikz: decoration at path end disappears at high bend angles). \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{positioning, decorations.markings} \begin{document} \begin{tikzpicture} [very thick, decoration={markings, mark=between positions ...

11

From this question indexed letters inside circles there is a possibility also with tikz-cd. \documentclass[12pt]{article} \usepackage{tikz-cd,amssymb,mathtools} \usepackage{tikz} \newcommand\encircle{% \tikz[baseline=(X.base)] \node (X) [draw, shape=circle, inner sep=0] {\strut #1};} \begin{document} \begin{tikzcd}[column sep=huge] \encircle{A} \...

10

Answer to Edited Question This is straightforward to do with forest. I assume that with your original code, you would need to name the nodes you want to circle and then draw a circle around them, though I'm not sure. With forest, you can automatically collect nodes with particular content into a register which you then use as the basis for the circle. As ...

9

Very similar to @Ignasi's answer, the main difference being that I use bar arrows to draw the bars. This allows one to avoid having to rotate the disappearing mark by hand. \documentclass[tikz,border=3.14mm]{standalone} \usetikzlibrary{decorations.markings} \begin{document} \begin{tikzpicture} \draw[red,very thick,-Bar,postaction={decorate}, ...

9

A simple solution with the psmatrix environment (from pst-node): \documentclass[border=5pt]{standalone} \usepackage{pst-node, pst-arrow} \usepackage{auto-pst-pdf} \begin{document} \psset{arrows=-v, veearrowlinewidth=0.5pt, veearrowlength=4pt, veearrowangle=35, linewidth=0.6pt, nodesep=2pt, labelsep=1pt, rowsep=1cm} \sffamily\...

9

Because you were using \pgfmathsetmacro, which adds .0 at the end of the numbers, which get interpreted as anchors (.0 is equivalent to .east in this case). If you use \pgfmathtruncatemacro instead the lines match perfectly, as they should. \documentclass[tikz,border=3.14mm]{standalone} \begin{document} \begin{tikzpicture} \foreach \n/\a/\r in {0/0/100,...

8

I know this is not exactly what you want, but it might at least get you started. I added some resources to the code. Unfortunately, pattern density cannot be modified easily in TikZ. I would create a clipping path and draw a bunch of dots, but that might still look too perfect. Code \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,patterns,...

8

I see that you're using spring layout but it seems to me that the resulting graphic is more like distributed charges (electric charges) making me think that the spring electrical layout is more suiting. Just by using it you already see the difference in the final graph. Furthermore, to fine tune the graphic you can use the nudge=<coordinate> key (or ...

8

You have more possibilities how to start with drawing your illustration. For example with pure TikZ: \documentclass[tikz, margin=3mm]{standalone} \begin{document} \begin{tikzpicture} \draw[->] (-1,0) -- ++ (4,0); \draw[thick, red] plot[domain=0:2*pi, samples=30] (\x/pi,{sin(\x r)}); \draw[densely dashed] (0,0) -- + (0,1.5) (2,0) -- + (0,1....

7

Not overly happy with these, I think they could be simplified, but anyway, one way with clipping and layers... \documentclass[tikz,border=5]{standalone} \usetikzlibrary{backgrounds,arrows.meta} \begin{document} \begin{tikzpicture}[x=(10:4cm),y=(90:4cm),z=(225:4cm),>=Triangle] \coordinate (O) at (0,0,0); \draw [->] (O) -- (1,0,0) node [at end, right] {...

7

I think you're trying to use graphdrawing when you actually should be using the normal graph instead. The graphdrawing library is for when you have stuff that follows a structural logic but the graph itself is not of a fixed nature. Quoting Till Tantau: You do not specify where, exactly, the nodes and edges should be. This is something you leave to a ...

7

I post my answer. I hope this is helpful for you. Unfortunately I did not put the opacity. I'm sorry. \documentclass{article} \usepackage{tikz} \usepackage{mathtools} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[line cap=round, line join=round, >=Triangle] \clip(-2.19,-2.49) rectangle (2.66,2.58); \draw [shift={(0,0)}, lightgray, ...

7

\documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \x/\y/\z in {0/0/-1,4/0/-1,2/4/-1,2/1/1} { \draw[ultra thick] (\x,\y) -- (\x+1,\y) -- (\x+0.5,\y+\z)--cycle; \draw[fill] (\x,\y) circle(1.5mm); \draw[fill] (\x+1,\y) circle(1.5mm); \draw[fill] (\x+0.5,\y+\z) circle(1.5mm); } \draw[ultra thick] (0,0)--(2,4) (3,4)-...

7

Here is an option using basic tikz code, and written in a structured way. RESULT: MWE: \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning,arrows.meta} \begin{document} \begin{tikzpicture}[ %Environment Styles cell/.style={ circle, %node shape is a circle draw, %shape is drawn ...

7

Hmmh, nobody seems to want to answer this. I agree that this problem is very similar to the linked questions, but personally would not consider it a duplicate since you do not ask to take the nth root of unity, but of a different complex number with nontrivial radius and phase. \documentclass[fleqn]{article} \usepackage{tikz} \usepackage{amsmath} \begin{...

6

Do-it-for-me style, without trying to be clever: \documentclass[tikz,margin=.5cm]{standalone} \usetikzlibrary{arrows.meta} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture}[scale=.5] \tikzstyle{bluelines}=[blue] \tikzstyle{redlines}=[red] \tikzstyle{purplelines}=[purple!50!black] \tikzstyle{number}=[black] ...

6

In the second part to this answer a custom coordinate system was given. This can be used to plot the grids (albeit a bit slowly). The other requirements (not done here) involve re-orienting the x, y, and z vectors, and changing the content and positioning of the labels. \documentclass[tikz,border=5]{standalone} \usetikzlibrary{arrows} \tikzset{declare ...

6

Instead every node={align=left} in tikzpicture parameters you should say: every node/.style={anchor=west} Result: Upgrade: To my taste, regarding to you edited questions, the following solution looks nicer: \graph [tree layout, grow'=right, fresh nodes, level distance=0.5in, sibling distance=0.1in ] { 4 -&...

6

Here is the automaton drawn with the automata library. I have labeled all edges with letters to make it easier to identify them in the code, but of course you can also use something like node{\texttt{+}} or node{$+$}. \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{automata,positioning} \begin{document} \begin{tikzpicture}% [>=...

6

Modifying the code from How to draw a graph in LaTeX?, one can obtain this MWE: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} [nodePath/.style={circle,fill=yellow!40}] \node[nodePath] (n1) at (0,4) {1} edge [loop above] (); \node[nodePath] (n2) at (3,3) {2}; \node[nodePath] (n3) at (4,0) {3} edge [loop ...

6

This is not an answer but just a comment. You can do that much easier. (EDIT: fixed the water level on the left, sorry, did not pay enough attention.) \documentclass[border=3.14mm,tikz]{standalone} \begin{document} \begin{tikzpicture} \draw [double distance=0.5cm] (0.25,3) -- (0.25,0) arc(0:180:-1.5cm) -- (3.25,3); \draw [blue,line width=0.5cm] (0.25,1) -- (...

5

Since you said you know some TikZ commands, here's a starting point. Feel free to comment if you do not understand something or if you get stuck. Output Code \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \tikzset{ double/.style={shorten <= 3mm, shorten >= 2mm} } \begin{document} \begin{tikzpicture} \...

5

Replace the line \begin{tikzpicture} by \begin{tikzpicture}[every node/.style={draw}] Obtained by running lualatex on: \RequirePackage{luatex85} \documentclass[border=1mm]{standalone} \usepackage{tikz} \usetikzlibrary{graphdrawing} \usetikzlibrary{graphs} \usegdlibrary{trees} \begin{document} \begin{tikzpicture}[every node/.style={draw}] % <<<&...

5

I do not know if I fully understood your question, but here is a solution. Certainly not the best. \documentclass{article} \usepackage{tikz} \usetikzlibrary{automata,arrows,calc,positioning} \begin{document} \begin{figure} \begin{tikzpicture}[roundnode/.style={circle, draw=black!60, fill=black!5, very thick, minimum size=7mm}] %Nodes \node[roundnode] ...

5

You can do at least some of this with the graph-drawing facilities. Probably, use of color classes would facilitate greater automation. However, I'm not immediately sure how to make that work and the manual is extremely vague on what is possible and how. (Or I just don't understand its approach - I admit to finding the graph-drawing stuff almost entirely ...

Only top voted, non community-wiki answers of a minimum length are eligible