Hot answers tagged

22

Like this? \documentclass[tikz]{standalone} \usepackage{tikz} \begin{document} \foreach \angle in {0,10,...,360} { \begin{tikzpicture} % fill circle and plot \fill[blue!50] (-1,0) arc (0:\angle:1) -- (-2,0) -- cycle; \fill[blue!50] plot[smooth,domain=0:\angle] (pi/180*\x,{sin(\x)}) |- (0,0); % draw connection \draw (-2,0) +(\angle:1) ...


19

I couldn't resist, so here's a solution using pgfplots (and some tikz), plus arara for creating the .gif animation. Output Click for bigger size Code % arara: animate: {density: 160, delay: 8} \documentclass[tikz]{standalone} \usepackage{amsmath,amssymb} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \usepgfplotslibrary{fillbetween} \begin{document} ...


14

My answer consists of three parts. Step 1: decorate segments First, we would like to replace every segment by a dumbbell: This could be done, as the title suggests, by defining a decoration and applying it. So we may write \pgfdeclaredecoration{dumbbells}{initial} { \state{initial}[width=0pt,next state=depict one]{ \egroup % set up ...


7

So the problem with the code is that \subnode is never defined. You can get it defined by loading the tikzmark library. However, \newcommand\tikzmark... will then fail as the library defines the standard \tikzmark command. This problem can be avoided by simply choosing a different macro name, such as \mytikzmark. You cannot, however, use \mytikzmark or ...


6

A simple foreach can do it: \documentclass[tikz,border=2mm]{standalone} \begin{document} \begin{tikzpicture} \draw[->] (0,-1)--++(90:4); \draw[->] (-1,0)--++(0:12); \coordinate (aux) at (0,0); \foreach \i in {1,-1,1,1,1,-1,1,-1,-1,1,-1} \draw[->] (aux)--++(1,\i) coordinate (aux); \end{tikzpicture} \end{document}


5

For commutative diagrams I always use tikz's \matrix command together with matrix of math nodes. This gives an easy way of placing the nodes of your diagram into an array and then drawing lines between the nodes. To use this you need to have \usetikzlibrary{matrix} in your preamble. The basic idea is something like this: \begin{tikzpicture}[auto] ...


5

An example with tikz-cd. Output Code \documentclass{article} \usepackage{tikz-cd} \begin{document} \[\begin{tikzcd}[row sep={6mm,between origins},column sep={1cm,between origins}] hom_{D}(a,a) \arrow[rrrr, "\tau_{a}"] \arrow[ddd, "{hom_{D}(a,f)}", swap] & & & & Ta \arrow[ddd, "Tf"] \\ & 1_{a} \arrow[rr, |->] \arrow[d, ...


5

I didn't so much make it thinner as make the triangle bigger. Note: without setting inner sep=0pt the node was actually wider than the strip, causing a slight gap at the bottom. \documentclass[tikz]{standalone} \usetikzlibrary{shapes.geometric} \tikzset{my polygon/.style={regular polygon,regular polygon sides=#1,minimum size=4cm}} ...


5

You're not passing a set of options but something that contains a set of options. The error message is a bit misleading, because the expansion takes place when issuing the error, so it appears you have passed the right options. No key-value based package performs expansion when absorbing key-value pairs, because it could be disastrous. So the solution is to ...


5

You mean something like this? The arrows.meta library is not strictly necessary unless you want to use one of the new arrow tips. In that case, replace -{Straight Barb[length=5pt,width=5pt]} with ->. Output Code \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture} % axes ...


5

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 ...


5

This answer offers two solutions, one with pgfplots and one with tikz. pgfplots This would be much easier to do with pgfplots, you don't need to draw everything manually. Output Code \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \begin{axis}[ ...


5

Fill the empty cell: \documentclass{article} \usepackage{tikz} \usepackage{booktabs} \usetikzlibrary{calc} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};} \newcommand{\DrawBox}[3][]{% \tikz[overlay,remember picture]{ \draw[black,#1] ($(#2)+(-0.5em,2.0ex)$) rectangle ($(#3)+(0.75em,-0.75ex)$);} } ...


5

The simplest way is write matrix as TikZ matrix and add desired column frame and note to it: \documentclass[11pt]{book} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{tikz} \usetikzlibrary{arrows.meta,bending,matrix,positioning} \begin{document} \begin{equation} \begin{tikzpicture}[ node distance=1mm and 0mm, baseline] ...


5

As you have named the coordinates, just loop over their names: \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows,calc} \begin{document} \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm] \clip(-0.5,-1) rectangle (5.5,3.5); % defining coordinates \coordinate (1) at (0,0); \coordinate (2) at ...


4

Another interpretation of "half dashed": \documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations.pathreplacing,calc} \tikzset{draw half paths/.style 2 args={% decoration={show path construction, lineto code={ \draw [#1] (\tikzinputsegmentfirst) -- ($(\tikzinputsegmentfirst)!0.5!(\tikzinputsegmentlast)$); \draw [#2] ...


4

The lines do end at the nodes, you have to consider that nodes have some padding (inner sep, outer sep), and lines are drawn to the edge of the node, not the center. Add draw to the node options and you'll see this: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (4,2) node(p1)[draw,label={[label ...


4

This answer will focus on the funnel object, at least for the moment. Changes: Fixed funnel shapes. Removed one \foreach statement and included it in the previous one. Better node positioning. Output Code \documentclass{article} \usepackage[margin=2cm]{geometry} \usepackage{pgfplots} \definecolor{myellow}{RGB}{228,212,0} ...


4

This is a simple typo \arrow{r}{\iota} Not \arrow[r]{\iota}


4

A straightforward solution is add two small nodes placed inside "domain1" and "domain2" node: For above picture I define subelement style for small nodes. Beside this, I move node distance to common parameter in tikzset, slightly change it (that result is more similar to shoved image in question), for all nodes with rectangle shape use style element. And ...


4

First \visible command is from beamer not tikz. you can do that with a third variable \anim inside \foreach loop to control apparence of edges. Code \documentclass{beamer} \usepackage{tikz} \begin{document} \begin{frame} \centering \begin{tikzpicture} [scale=.5,auto=left,minimum size=2mm,inner sep=0pt,outer sep=0pt,every ...


4

This kind of groups can be easily drawn with a matrix of nodes. Following code shows this option: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{arrows,matrix,positioning} \begin{document} \begin{tikzpicture}[ field/.style={draw, rounded corners, minimum height=8mm, anchor=center, align=center}, frame/.style={matrix of nodes, column ...


3

The main mistake is that you use axis y line=center which implies that the axis should go through 0, or in the case of a log axis through 1. When you change this to axis y line=left and at least the xmin value, you should get the desired result. But then the ylabel is positioned left in the middle (again). This can be modified using the ylabel style key. ...


3

Edit: This solution in comparison with your MWE differ in the following: in preamble is added \pgfplotsset{compat=1.13}, so in the notation of node and drawing coordinates can be omitted axis cs: added are TikZ libraries \usetikzlibrary{calc,positioning} for determination of nodes coordinates the ymax in both axes are changed from 500 to 200 and 8000 to ...


3

If you want to repeat some tikzpicture or part of it, pics are a good option. Following code shows how to use them. A pic is declared to draw your original graph, and this pic is used inside several tikzpictures distributed within a tabular where fisrt column is a multirow. As you can see, array pic only draws part of the graph which can be completed with ...


3

The problem is that the inner sep and line width do not change with the font. The solution is to define a length that does change proportionately with the font. I chose the height of \mathstrut, but almost anything will do. Also, by drawing the circle separately, you can adjust its size and the size of the contents ($r$) separately. ...


3

For the lines, you can use \pgfextra and draw lines using the node's anchors. For the label, you can use a label as an argument for the style. Output Code \documentclass[tikz]{standalone} \usetikzlibrary{calc,arrows,shapes.geometric,positioning} \tikzset{ element/.style={ draw, thick, node distance=1.5cm, minimum ...


3

Some notes: I ignored the warnings when possible because your document has a lot, especially underfull \hbox and overfull \hbox. The first one means that you have maybe inserted a line break where the line had no content, such as writing \\\\, the second one means that your content exceeds the page margins. I removed most of the content from your example ...


3

I am not very familiar with the datavisualization of tikz. So I recreated your picture with pgfplots. \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ height=6cm, width=13cm, axis lines=middle, grid=both, domain={-360:360}, ymin=-1.3, ...


3

Concerning your example, there are some issues: A \matrix already creates nodes, so I don't think that nesting nodes is advisable. You need to enclose each \item inside curly braces when inside a \matrix, like: \item{<content goes here>} For coloring a cell, use |[fill=<color>]| Output Code \documentclass{article} ...



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