TikZ is a higher-level drawing language built on top of the PGF graphics framework. For questions specifically about the PGF layer use {pgf-core} instead. Both tags are possible on the same question. The tag {diagrams} is also compatible with this tag.

learn more… | top users | synonyms (3)

5
votes
2answers
2k views

LaTeX, qtree: Color and Animation for branches of a graph tree

I'm trying to do a beamer animation of a parse of a simple binary branching tree. I'd like to either use different colored branches and node labels to code the different steps of the parser and/or ...
13
votes
2answers
4k views

How to select a finite number of samples from the file when plotting using pgfplot

I have a datafile containing thousands of points of which I need to plot only the first 100 points. How to do this using pgfplots? I tried the following with no effect. \begin{axis}[
xlabel=k,
...
3
votes
1answer
2k views

how to plot a sequence of numbers (not co-ordinates as such) using pgfplots

I have a data file containing a sequence of numbers, to be plotted against integers starting from 1. So the x co-ordinate is the row number of the data in the file. How to plot this data using ...
4
votes
2answers
2k views

Options to change a path on a elegant way in TikZ

I'm building a figure of a finite state automate. However the edge of F to C seems to make the image less readable. Using bend options doesn't solve the problem. is there a way to solve this problem? ...
5
votes
1answer
529 views

A looping edge with “shorten >=…” that is symmetrical and points toward the node

The "shorten >=" option in TikZ causes a change in the shape of the Bezier curve. With a looping edge for example, it makes the loop asymmetrical (node A in the picture). I could make it symmetrical ...
6
votes
1answer
1k views

Horizontal bar-charts in PGFPlots: “point meta” messes with alignment

I'm drawing a rather unusual bar-chart to display the results of a small survey. The axis of the chart extends in both the negative and the positive domain. However, there is no zero and all values ...
6
votes
3answers
5k views

Configuring node placement and width with TikZ, overlapping nodes

I've created a simple feedback structure but cannot cause the utmost right block not to overlap with the circle. I've tried altering this block's width with minimum width and text width, but it ...
11
votes
1answer
492 views

Branching lines in TikZ without antialiasing/subpixel artifact?

Is there a way to properly branch a line into several lines in TikZ? Simply adding paths creates a darkening artifact where the paths overlap: \begin{tikzpicture}[very thin,-stealth] \draw (-1, 0) ...
20
votes
6answers
17k views

How to establish node-anchor-like points on a (tikz) rectangle path (is there a better method than the one described)?

Background and desired functionality Rectangles can be drawn with tikz in a number of ways, one way of doing so is to define a rectangle node as follows: \node (rectangle) [draw, rectangle] {A ...
13
votes
2answers
7k views

How to display labels on points of a tikz plot

I'm creating a \begin{tikzpicture} - unclear if I'm working with tike or pgf or whatever honestly, but I have my data displaying perfectly using \addplot[my options] coordinates { .. my data here }. ...
3
votes
1answer
251 views

How to align macros to correct order in TikZ matrix?

How to fix the broken placement of macros in matrix? \documentclass{article} \usepackage{tikz} \begin{document} \newcommand{\macroA}{ \begin{tikzpicture} \node[minimum height=1.5cm,minimum ...
21
votes
4answers
2k views

How to draw arrows from cell to cell at the borders of a table

How can I draw arrows from cell to cell at the borders of a table? More precisely I'd like to get something like this: It would be nice to have a solution using TikZ. Edit: Since I have other ...
8
votes
2answers
909 views

Nested foreach inside a TikZ matrix for both rows and columns

I'm trying to create a matrix using nested \foreach loops. I tried following the example I found in a previous question, but I keep getting errors. Here is the code I tried to run: ...
8
votes
2answers
2k views

Is it possible to have a Bézier curve with 3 control points in TikZ?

In TikZ, it is possible to draw a Bézier curve of degree 3 with 2 control points p0, p1, p2, and p3 as follows: \draw(p0)..controls (p1) and (p2)..(p3); I am wondering whether there is a way to ...
8
votes
1answer
658 views

Access mdframed node coordinates with TikZ?

Is it possible to get a (breakable) frame like this with mdframed? Or as a more general question. Can one access the coordinates of the frame that is drawn with TikZ? With a pagebreak in it: I ...
23
votes
5answers
3k views

Lower and upper Riemann sums

I am trying to create a few images for educational purposes. Therefore I need to be able to illustrate the area under various functions, using lower and upper riemann sums (rectangles) Reason for not ...
13
votes
2answers
1k views

Draft mode in Tikz externalize hides graphics, but not without externalize

Maybe this is expected behaviour, but it's not documented in the manual, and it certainly surprised me. When you use the draft class option and use the tikz external library, all Tikz pictures are ...
11
votes
1answer
938 views

How to use \pgftransformcm and \inheritsavedanchors in a new shape (batman) from an ellipse

I try to make this shape but I have several problem. First to place the logo inside the ellipse, I used \pgftransformcm{1}{0}{0}{1}{\centerpoint} perhaps there is a better solution. I need to use ...
28
votes
3answers
7k views

Using TikZ, how to draw an elliptical arc starting from point A to point B with the origin as its center where both radii are given?

I am new to TikZ and reading its manual now. For the sake of exercises, I want to draw Batman's logo as follows: Using TikZ, how to draw an elliptical arc starting from point A to point B with the ...
16
votes
2answers
2k views

Proper nesting of tikzpicture environments: Reset all PGF values to their defaults

Sometimes, nesting tikzpicture environments seems inevitable, e.g., if you want a node to contain a TikZ picture on its own. (Is it?) However, nesting tikzpicture environments is problematic, also ...
6
votes
1answer
2k views

How to typeset a TikZ picture inside a node?

The contents of a node are drawn in text mode. Is there a way, short of introducing a tikzpicture environment, to draw a picture inside a node? Nesting tikzpicture environments is problematic, also ...
2
votes
1answer
385 views

TikZ does not use square coordinates but polar one, how to change it in order to use Cartesian coordinates?

Consider the following: \begin{tikzpicture}[thick,scale=0.8] \node (v0) at (0,0) [label=right:$\emptyset$] {}; \node (v1) at (40:-2) [label=right:$v_1$] {}; \node (v2) at (70:-1.6) ...
32
votes
2answers
8k views

How to draw a poset Hasse Diagram using TikZ?

I need to draw an Hasse Diagram using LaTeX. TikZ is the solution I would like to use. I tried with a simple structure involving trees but obviously when I need to join two nodes, it is not possible. ...
6
votes
1answer
251 views

Usage of a saved dimension in another saved dimension in a \pgfdeclareshape command

I have a question about \saveddimen usage inside of a \pgfdeclareshape command. My code is as follows: \documentclass{article} \usepackage{tikz} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ...
7
votes
2answers
1k views

Figures in Latex: TikZ vs. eps

I usually use TikZ to generate graphics in LaTeX, but a new coauthor suggested to use Inkscape and EPS files for our graphics. He thinks that we should avoid using additional packages. I never thought ...
8
votes
3answers
756 views

How to create integer labels on TikZ grid when we don't know the grid size at compile time?

I want to put integer labels on the grid. The grid size depends on the image loaded. The real scenario is to vectorize a JPG image but I need a grid label for navigation as follows ...
7
votes
5answers
2k views

TikZ Node with multiple shapes

My use case is drawing a ticked box in line with normal text like this: "Hello ☒ World." (unicode example, your mileage may vary). One solution I managed to come up with is the following rather ...
5
votes
1answer
493 views

How to connect different own TikZ macros together + default names of node

I will ask you for solution about a little bit more complex problem. Maybe it isn't so hard as it seems to be but, for me it is hard one. Let's say that i want to create four own macros \objecta, ...
4
votes
1answer
1k views

Can't find TikZ library calc

I've been googling for some time now, and can't find the manual for the TikZ library calc. All I see is people using it. Where can I find the manual or some info? Is it the same as the LaTeX package ...
17
votes
2answers
6k views

What is the preferred way of defining a TikZ constant?

I'm drawing a TikZ figure and am going to need a couple of constant that I could easily change between compilations, e.g. a main radius, a proportion, a number of lines, etc. What is the preferred way ...
5
votes
1answer
445 views

What does the colon in Tikz coordinates mean?

\draw (0,0) -- (60:.75cm) arc (60:180:.75cm); What does the colon in (60:.75cm) mean? Normally, I'd define a normal point there.
3
votes
2answers
1k views

latex code for graphing rational function

I've seen in TikZ and pgf Manual for version 1.18 a code for graphing some functions but it does not provide an example for a rational function. Can someone help me graph $x+\frac{1}{x}$?
3
votes
1answer
566 views

tabular as matrix

I have the attached figure and I need to have arrows from the entries of the table on the right-hand-side (one which says Dimensions List DL) to nodes of the tree. I think the best way to do this is ...
6
votes
1answer
761 views

How to “fix baselines” in tikz nodes?

I want to define nodes which are shapes with some text in it using \ce{} from the mhchem package. How would I go around ensuring the baselines are the same between nodes, right now it shifts if I use ...
7
votes
2answers
1k views

How can I draw irregular shading area with tikz?

How can I draw with tikz the irregular shaded area and (similarly?) the irregular frame around nodes like the ones in the image?
9
votes
2answers
3k views

Is it possible to apply a style to all (tikz) rectangles?

I know that it's possible to apply styling to all tikz nodes or paths, as in the following example: \tikzset{ every node/.style={ text=red }, every path/.style={ ...
5
votes
3answers
623 views

How to scale and clip a path at the same time?

Again, i started a question here, and i found the solution. But i think this method maybe useful for others. The problem: i exported the TikZ code of one path from Inkscape; then, i wanted to use it ...
6
votes
1answer
419 views

Pass options to the scope that is internally created by preaction

In the reply to this question on shadows, it was suggested to use the backgrounds library so that the shadow of one object doesn't overlap another object drawn previously. If I understand the ...
4
votes
3answers
1k views

Tikz,PGFplots: drawing in node's cs placed on plot

I'm trying to place some arrows which should be placed alongside the graphs. I place nodes on the graph using node[pos=0.2,above] (point1) {} Then I want to draw in that coordinate system \draw ...
23
votes
2answers
3k views

Is there a way to compile tikz graphics outside a document?

As my document grows, so does the number of drawings. I am using PGF/TikZ and each drawing is what is enclosed between \begin{tikzpicture} and \end{tikzpicture}. Every time the document is compiled, ...
3
votes
1answer
466 views

Grid customized

I would like to build a grid such as the figure shown below where each grid point is surrounded by some of the two curves that describe below. First curve: an outline around the point forming a ...
6
votes
1answer
2k views

TikZ: Large arrow tips at the end of smooth curves

I have problems with adding a large arrow tip to smooth curves. It works perfect with straight lines, but as soon as I use the edge command, the arrow tips are added to the beginning of the curve ...
36
votes
2answers
5k views

How can I draw an arc from point A -> B on a 3D sphere in TikZ?

I'm basing myself on http://www.texample.net/tikz/examples/spherical-and-cartesian-grids/ and now I need to add a arc from point P to Q. What I was able to get so far: ...
6
votes
3answers
2k views

tikz connection label and node distance

Is it possible to have tikz automatically determining the distance between two nodes based on a third node used to connect them? For instance, in the following picture the arrow used to connect the ...
11
votes
4answers
1k views

Tikz, tangent between two circles

I am trying to create the image below Here is my code \documentclass[10pt,a4paper]{article} \usepackage{tikz,tkz-euclide} \begin{document} \center \begin{tikzpicture} \tkzDefPoint(0,0){O} ...
19
votes
1answer
503 views

What are most important variables set at the beginning of a tikzpicture? of a scope?

I asked a lot of questions about nested tikzpicture environments and if I agree with Andrew and Martin that nesting TikZ pictures isn't a good idea, it's interesting to know why. I gave some examples ...
7
votes
1answer
1k views

Mathematica code into TikZ code

In my search to understand the creation of a guilloche and in relation to my post Recreating a guilloche with TikZ, I came about the code below, Guilloche[a_, b_, c_, d_, e_, f_] := ...
41
votes
5answers
2k views

How do we Draw a Bird in LaTeX

Yes, it's that time of the month again. It's time for somebody to ask how we can draw X in LaTeX. This time I'm asking the question and X is a bird. The reason why I'm interested in this question is ...
5
votes
2answers
5k views

Axis tick numbers overlap in TikZ

The following code can be used to create a TikZ plot: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[% view={0}{90}, scale only axis, ...
7
votes
1answer
264 views

Why do some arguments in a macro need to be preceded by \noexpand?

I keep on studying the use of nested tikzpicture environments (sorry) and I discover the next problem. I'm not sure but it sounds like a problem with "fragile" commands. Perhaps, the problem is the ...