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)

2
votes
1answer
263 views

Vertical TikZ arrow anchored to the center of the target

Consider this example: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[left] at (0,0) (Source) {Source}; \draw [very thick, ->] (0.15,-0.02) -- ...
5
votes
1answer
250 views

Remember picture is positioned too high

I want a word in a normal paragraph to be later pointed at by a callout. The MWE below actually achieves this, except, the word is shifted up. What is an elegant way to solve this, so that the word ...
8
votes
3answers
278 views

Align tikz arrow with x-height character

A TeX arrow is seemingly vertically centered with the height of an x-character, in this case the final e: \documentclass{article} \begin{document} Source $\rightarrow$ Target \end{document} A ...
4
votes
1answer
116 views

How to colour scatter points and create legend entries based on a data type column

Say I have a file like this: \documentclass{standalone} \usepackage{pgfplots,filecontents} \begin{filecontents*}{data} 1 10 type1 2 25 type2 3 75 type2 4 100 type3 5 150 type3 \end{filecontents*} ...
5
votes
1answer
394 views

Bigger arrowhead

I am using the tikzlibrary decorations.markings to put arrowhead on arbitrary places on some lines. My code is the following: \begin{tikzpicture}[arrowmark/.style 2 args={decoration={markings,mark=at ...
3
votes
1answer
233 views

Align itemize bullet within tikz environment

When putting a tikzpicture environment inside an itemize environment, the bullet point is not correctly aligned with the tikz picture. In this case, "correct" means that the bullet should be ...
8
votes
3answers
848 views

atan2 does not work with pgfplots

Trying to plot the amplitude and argument of two sine waves in terms of their amplitudes and phases using pgfplots, An error appears while compiling the atan2 function (supported by pgfmath). Here is ...
3
votes
3answers
112 views

unaligned tikz nodes

I am trying a picture with following code : \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,shapes, positioning,intersections} \begin{document} \begin{tikzpicture}[node ...
2
votes
1answer
175 views

“indirect” variables in foreach

I'm trying to draw three "graphs" which are rectangles situated side-by-side. Each has four points to be placed on them. These four points are the "scores". Using a foreach loop is a natural for the ...
2
votes
2answers
2k views

draw round/rectangular bracket embracing nodes in tikz

I know how to draw a curly bracket with the following code: \draw[decorate,decoration={brace,amplitude=5},-] (0.8,-0.75) -- (0.8,0.75); But now I want to draw a round bracket, or a rectangular one. ...
4
votes
2answers
171 views

Different Directed graph

I need to do a graph similar to the one in the picture above but I don't know how to do the horizontal lines without the arrow, or the vertical arrow. The best I could do is the following: ...
6
votes
3answers
178 views

Correct use of \pgfmathaddtocount \pgfmathsetcount inside a \foreach cycle

I think the picture give the general idea and also i fell like i can smell the solution but definitely can't grasp it... I think that the counter may help me because i guess it allow to increment by ...
2
votes
1answer
164 views

How to plot a 2-Graph (Königsberg Graph, Euler)

I want to plot a 2-graph, the Königsberg graph. I've got this: V={A,B,C,D} the set of vertices E={e1={A,B}, e2={A,B}, e3={A,D}, e4={C,D}, e5={B,C}, e6={B,C}, e7={B,D}} the set of nodes (axis, aristas) ...
4
votes
1answer
564 views

Tangent to circle given point on circle

I've been able to draw tangent lines to a circle at a given point on the circle, and I've done so in two ways (using the calc library, and using the /tikz/turn feature). But I must admit I don't ...
3
votes
1answer
214 views

Tikz - Rotated Gaussian

I would like to plot a rotated curve (gaussian) but I've got no idea how. I searched in the internet and found that I have to define the gaussian curve because it's not included. But how can I plot ...
5
votes
1answer
189 views

Tikz animation never stop compiling

Why this MWE does never stop compiling generating tons of pdf pages ? \documentclass[french,xcolor=dvipsnames,9pt]{beamer} \usepackage{tikz} \usetheme{Warsaw}\usecolortheme{wolverine} ...
6
votes
1answer
1k views

How to automatically draw a graph?

Is there a simple package for which I can input an abstract graph and it returns a drawing? A similar question was asked in 2010, it did not receive any answers relevant to my question. I want no ...
1
vote
0answers
696 views

Tikz Externalize [closed]

I'm having some issues with externalising my tikz images. I'm using the following preambel with -shell-escape enabled using lualatex: \documentclass[print]{adelaide-mecheng-thesis} % for splitting ...
1
vote
1answer
492 views

Connecting points on graph via dotted lines

How could I connect these points with dotted, vertical lines? \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[axis lines=center] \addplot [only ...
5
votes
1answer
105 views

Passing stack data to tikz node names

I'm trying to use a stack data structure (as discussed here: Push/Pop or save a length/dimension?) to store the various names of a set of tikzmark node names (as discussed in tikzmark manual) scatted ...
3
votes
1answer
640 views

Displaying two graphs adjacent to each other with their x-axes aligned

How do I align the following two graphs so that their x-axes are aligned? In both graphs, the top of the y-axis is higher than I want. It seems to be at a height between 13 and 14. How do I get ...
4
votes
3answers
712 views

Moving a tick mark

I would like to move the tick mark -2 on the x-axis from its usual spot to above the x-axis. I drew a dashed line from (-2,0) to (-2,-4) and I don't want it drawn over this tick mark. ...
24
votes
3answers
975 views

Automatically generate graphics which shows light diffusion on a rough surface

I just want to make an image like this (using tikz or pstricks) of light reflexion and diffusion: What I am interested in is, how this can be done (semi)-automatically via tikz or pstricks: ...
3
votes
1answer
201 views

How to curve a Tikz node?

This is a very simple question. Is it possible to add a "curve" effect to a node? Consider a simple rectangle node: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} ...
3
votes
0answers
271 views

How to scale hatch in tikz figure in LaTeX?

I have ellipses with hatch. I want to use lines or bricks hatch but more rare than default. I can change spread between lines in this way Custom and built in TikZ fill patterns. It worked, but it's ...
15
votes
3answers
1k views

Dash pattern that starts with space

I often draw vectors, that are half full and half dashed (the other part of vector is "invisible" (see MWE below). Usually I draw two lines separately (I don't know any other method). ...
4
votes
1answer
141 views

One line drawn longer than another line on the same Cartesian plane

Why are the two lines drawn to different lengths? The slanted line should be shortened a bit - maybe by 2ex - and the vertical line should be lengthened to obtain the same height that the slanted ...
9
votes
1answer
351 views

fill the interior of a randomly constructed closed path

I am not sure how to proceed in filling the interior of a randomly generated (via a random decoration) path. I began with code given in the answer to this question and worked on it since the basic ...
8
votes
1answer
242 views

How to draw Area Charts [duplicate]

I want to draw an area chart, something like this I dont know how to fill the area with colors, here is what I have \documentclass{standalone} \usepackage{pgfplots} \usepackage{xcolor} ...
6
votes
1answer
197 views

specify the amount of tilt when shading in tikz

Consider the following example: \documentclass[border=5pt]{standalone} \usepackage{tikz} ...
7
votes
2answers
292 views

Labeling a slant asymptote

I am using TikZ and pgfplots for the first time. (I am using it so that I can send class notes to students in a Calculus class that I am teaching.) I have a graph with a slant asymptote. Before I can ...
12
votes
1answer
396 views

Draw Tikz highlighting on the background of text

I was recently referred to Cool Text Highlighting in LaTeX for Tikz highlighting-underlining. I've managed to modify Antal answer to my needs but I can't seem to achieve the following: I'd like the ...
2
votes
1answer
101 views

alignment of different elements inside and outside matrix in tikz

I am facing issues in getting the different elements of the following tikzpicture at correct positions. I think the problem arises because the width of elements within the matrix differs. ...
1
vote
2answers
302 views

Unable to set the text and its pin in correct orientation in Tikz pie chart

I am modifying the pie chart, which is available here. In case of small slices, text inside the pie chart overlaps to each other. So I am trying to write the text and value outside the chart. Below is ...
2
votes
1answer
306 views

Tikz Chains with one side of the leftmost node, thickbold

Good morning everybody. This is actually the first time I write here, so thanks to anyone who is going to reply. I am writing my undergraduate thesis and I am currently stuck at drawing a Turing ...
1
vote
3answers
140 views

Plot of a function [duplicate]

I was trying yesterday to plot the function f(x)=1/x , 1<=x<=2 and f(x)=x , x<=0. I was using the pgf plot, but the code was not working and since it was getting on my nerves I just deleted ...
2
votes
2answers
469 views

Drawing and labeling asymptotes

How do I label the asymptotes for the rational function y=(x+1)/(x-1)? I copied the code \draw[dashed,latex-latex] ({{1,0}}|-{{axis description cs:1,1}}) -- ({{1,0}}|-{{axis description cs:1,0}}) from ...
3
votes
1answer
138 views

more precision on the barplot pgfplots

I would like to change the graph to show the 14.047 is less than 15, more decimal precision \documentclass[12pt,a4paper,onecolumn, openright]{report} \usepackage{xcolor} \usepackage{pgfplots} ...
2
votes
0answers
30 views

tikz: number precision when incrementing by 0.01 [duplicate]

When I increment the y axis by 0.01, the numbers encounter a rounding error for some weird reason. \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \foreach \y in {0.01, 0.02, ...
5
votes
1answer
668 views

tikz: scaling the y axis

I would like to scale the y axis so that my plot isnt microscopic on the y axis. However, when I use yscale = x where x is some number, the image and the circles are distorted. I would like to ...
1
vote
0answers
155 views

How to plot a diamond shape ball in LATEX [closed]

Let d:M \to \mathbb{R} be defined by d(X,Y)=|x_1-y_1|+|x_2-y_2| where X=(x_1,x_2), Y=(y_1,y_2) \in \mathbb{R}^2. This is called the Manhattan metric. Plot the unit open ball B with center at the point ...
1
vote
1answer
176 views

Labeling a vertical asymptote written upwards (only using pgfplots)

I would like the code that instructs TikZ to plot the asymptotes to the graph for the rational function y=(x^{2})/(x^{2}-9). What is the code for plotting these lines as a dashed lines with ...
5
votes
0answers
155 views

\coordinate intersection does not work appropriately in TikZ [closed]

I was trying to use TikZ to sketch some graph but something weird happened. I was trying to use "intersection" to get the coordinate of the intersection of two lines, but strangely, there is always ...
7
votes
3answers
745 views

How can I plot the F distribution

I wish to plot the F distribution by declaring its density function. However with the following code I get an error saying that fdst has not been declared: \documentclass[border=5mm]{standalone} ...
4
votes
1answer
222 views

Why is a path overflowing in a TikZ picture

In the following path, there is a small overflowing of the stroke (1,1) --++(0,-1) beyond the stroke (0,0)--++(2,0). It seems to be because I use a path in my second expression and that the following ...
5
votes
3answers
487 views

How to plot hyperbola giving the foci and the fixed differene distance using TikZ

Given the two foci coordinates $(x_1,y_1)$ and $(x_2,y_2)$ of the hyperbola and the fixed difference distance, how I can draw it using TikZ? Here a brief explanation:
3
votes
2answers
113 views

Getting non-sense edges in my tree, or, how to get labels on edges

I have the following code. If I remove the edge commands, everything is fine. I suppose the problem is that my nodes have the same contents, but I can't avoid this obviously. Bad code: ...
2
votes
1answer
230 views

How can I renew /pgfplots/xmin (and the other 3 values) after a coordinate transformation?

I use "hybrid" coordinates made out of \ymin and raw x- and y-values. It's pretty comfortable to use, thanks to Gonzalo: \newcommand{\getpgfkey}[1]{\pgfkeysvalueof{/pgfplots/#1}} ...
2
votes
1answer
524 views

Half filled circle marker

How can I draw a half filled circle on my axis. I would like the marker to be at the origin and be filled on the left half of the circle. \documentclass[12pt,]{article} \usepackage{graphicx} ...
3
votes
2answers
338 views

Fitting the asymptotes and graph of a function onto the pictured Cartesian plane using pgfplots

I would like the code that instructs TikZ to plot the asymptotes to the graph for the rational function y=(x+2)/(x-1). What is the code for plotting these lines as a dashed lines with arrowheads? (I ...