Tag Info

Hot answers tagged

6

Here's one way to do what you want. I've adapted the code from this answer: Produce a list of prime numbers to draw the differences between each pair of primes in the way your drawing showed. The command will draw the differences between the primes putting 13 primes per row by default. This can be changed, as can the vertical space each row takes up. If ...


6

This should get you started: It is drawn using tikz. It would be better to automate this a little more... \documentclass{article} \usepackage{tikz} \usetikzlibrary{shadows} \usetikzlibrary{positioning} \begin{document} \tikzset{% define the style of the nodes for drawing the squares mysquare/.style ={shape=rectangle, draw=black!40,thick, top ...


4

The origin of the canvas area is different from the origin of the plot area. A plot coordinate pair (-0.1, 0.2) inside the calc expression ($(SE) + (-0.1, 0.2)$) is transformed to canvas coordinates and added to the canvas coordinates of SE. But since the origins do not match, the result is moved by the displacement of the plot origin to the canvas origin. ...


4

Inside an axis environment, all the "normal" TikZ commands are collected when they are first encountered and only executed at a later stage when the axis is finished. At that point, the auxiliary macros contain the values for the second triangle, so the second triangle gets drawn twice and the first triangle doesn't get drawn at all. You can fix this by ...


3

According to the pgfplots reference for /pgfplots/xmin, it holds During the visualization phase, i.e. during \end{axis}, these keys will be set to the final axis limits. You can access the values by means of \pgfkeysvalueof{/pgfplots/xmin} Consequently, you only need to enclose your computation and node generation by \pgfplotsextra and your code ...


3

You have to use the axis direction cs: \coordinate (B) at ($(SE)+(axis direction cs:-0.1,0.2)$); Code: \documentclass[margin=1cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \begin{axis} [ xtick={-0.1,0,1,1.1},xmin=-0.1,xmax=1.1,xlabel=$x$, ...


1

Shift the line according its width: -.5\pgflinewidth \documentclass[border=3mm,tikz]{standalone} \begin{document} \begin{tikzpicture} \node (rect) at (0,0) [draw,minimum width=2cm,minimum height=2cm,gray]{Rectangle}; \draw[-,line width=2mm,red] ([xshift=-.5\pgflinewidth]rect.north east)--++(90:1); \end{tikzpicture} \end{document}


1

You have to use right = of (which is the syntax for positioning library) instead of right of =. \documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{shapes,arrows,positioning} \begin{document} \tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=6em] \tikzstyle{line} = [->, dashed] \begin{tikzpicture}[auto, node ...


1

Do not use \pgfnodeparttextbox in normal \anchors but only in \savedanchor, \saveddimen or \savedmacro. There is no guarantee that the box is the same as when the node has been created as the \anchor definitions are first executed and evaluated after the node has been typeset. In your case, you already have set up the appropriate macros \halftextheight and ...


1

Few issues here. First your domain is incorrect. You are drawing the circle at -0.5,-3 which is outside the view. Hence specify the max and min values for x and y. Further, for pgfplots versions up to 1.11, you have to specify the coordinates for drawing by axis cs: like (axis cs: -0.5,-3) to get the position correct. If you want it outside the box, move ...


1

You can enclose \nodeText within the same tags you find in that chapter. Here for example I used \pgfmathprintnumber[sci]{...}. But you can change it to the format you prefer.1 A note: the author of pgfplots advised not to use \pgfplotsset{compat=newest}, because if it gets updated and there are changes, it will affect your code. Better stick to a defined ...



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