New answers tagged

0

I'm guessing that you like to have something like this: This tree is drawn by use of the forest package (dedicated to drawing tree diagrams). I also broke long text in one node into two lines: \usepackage{forest} \begin{document} \begin{forest} for tree = {draw, align=center, anchor=north, s sep=5mm, % ...


1

A drawing like this can be made in many different ways. For this particular drawing I would suggest using a \foreach loop rather than \matrix environment, as it provides more flexibility for making the contours of the bars and individual blocks. The example below can furthermore easily be scaled by changing the scale=0.7 of the whole picture and the scale=0....


3

pure tikz solution: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[ level 1/.style={level distance=1cm,sibling distance=3cm}, level 2/.style={level distance=2cm,sibling distance=2cm}, level 3/.style={level distance=1.5cm,sibling distance=2cm}, V/.style = {circle, fill,inner sep=2pt} ] \node (Root)[V,...


1

However, I’m not sure how to approach the horizontal arrows which are located in between two nodes, and their label to the left of them. The only problem is to properly position the nodes. To do that, the simpler is to add names to the nodes in your tree and to use standard tikz positioning methods to place the text and the arrows. Second of all, I’m not ...


3

One can tell tikz to use horizontal and vertical lines instead of straight ones with |-: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=0.09, xmax=0.32, ymin=0, ymax=230, ylabel=$num$, xlabel=$ratio$, height=6cm, width=8cm, grid=...


0

This answer makes the grid, saves it in a box (\mygrid) using \savebox, and places it in the middle of the page, the location of which is defined by orthogonal coordinates defined using tikzpagenodes: (current page text area.north |- current page text area.east). The showframe option is added to geometry to show the margins. \documentclass{article} \...


1

I do not know exactly what caused me to get it but I did the following path: Attempts to find solutions: It did not work "but it helped to get the solution", grateful to them too: https://tex.stackexchange.com/a/446763/178949 and https://tex.stackexchange.com/a/446853/178949. It worked (I am grateful to @Alexey Malistov) I needed to delete or not use the ...


1

Try the following: \documentclass{article} \usepackage[paperwidth=8.5in, paperheight=11.0in, margin=1.25in, includefoot]{geometry} \usepackage{tikz} \usetikzlibrary{patterns} \begin{document} \begin{figure} \centering \begin{tikzpicture} \draw[thick] (0,0) rectangle ++ (12,4); \draw[thick, fill opacity=0.5, pattern=north ...


1

Here you are! \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture}[thick] \draw[fill=cyan] (0,0)--(90:2) arc(90:-150:2)--cycle (-30:2.2) node[right]{Amount Lazzie ate}; \draw[fill=blue!50,shift={(150:1mm)}] (0,0)--(90:2) arc(90:210:2)--cycle (150:2.2) node[left]{Lazzie's Leftovers}; \end{tikzpicture} \end{document}


1

You can modify the code of pgf-pie to switch off the percentage printing. This can be done by actually modifying the source code, or by changing the code in memory during compilation of your document only. The second method is preferred, because it does not interfere with the package installation and other documents that may depend on the unmodified source. ...


3

One approach is to add the following to the optional arguments of your \begin{axis} command: xticklabel={$\pgfmathprintnumber{\tick}\%$}, Note -- following your MWE above, the axis text is in Spanish.


1

An alternative: \documentclass[tikz]{standalone} \makeatletter \tikzset{recycle path/.code=\pgfsyssoftpath@invokecurrentpath#1} \makeatother \begin{document} \begin{tikzpicture} \path[save path=\pathA] (0,1) .. controls +(1,0) and +(-1,0) .. (2,0) .. controls +(1,0) and +(-1,0) .. (4,1); \begin{scope} \clip[recycle path=\pathA] |...


3

You can use the [t] option for aligned, the p column type, and a small adjustment with \raisebox so that the top side of the figure be aligned a little higher than the base line: \documentclass[12pt]{article} \usepackage[margin=1in]{geometry} \usepackage{amsmath,array,calc,tikz} \begin{document} \noindent \textbf{Determine the average rate of change ...


3

If you just want to "nullify" the effect of a style, you can redefine it: \tikzset{dotted/.style={dashed}


2

I don't think that, typographically speaking, it's appropriate to use an aligned environment here. Instead, I believe one should use nested enumerate environments. \documentclass[12pt]{article} \usepackage[margin=1in]{geometry} \usepackage{amsmath,calc,tikz} \usepackage[shortlabels]{enumitem} \setlist[enumerate,1]{nosep} \setlist[enumerate,2]{label=\alph*....


0

This turned out to be a bug in PGF that has now been fixed.


0

When using \input to import a figure consisting of a PGFPlots axis, I found that \begingroup \pgfplotsset{every axis/.style={scale=2}} \input{tikzfig} \endgroup was the best solution to scale only the axes without changing nor the ticks nor the axes labels font.


6

just add this line with \addplot: \documentclass{article} \usepackage{pgfplots} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{axis} \addplot table { 0 90 1 72 2 57 24 -43 25 -26 26 0 27 0 }; \addplot[dashed] coordinates {(24, -50) (24,60)}; \end{axis} \end{tikzpicture} \end{document}


3

The reason is pgfplots having different (implicitly and automatically) scaling. You may draw with plain TikZ to get explicit scaling. \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture}[x=2mm,y=.4mm] \def\datapoints{ (0,90) (1,72) (2,57) (24,-43) (25,-26) (26,0) (27,0)} \draw[densely dotted] (24,-50)--(24,60); \draw[blue,...


0

You can try this... \documentclass{article} \usepackage{siunitx} \usepackage{tikz} \sisetup{ output-exponent-marker = \text{e}, exponent-product={}, retain-explicit-plus } \begin{document} \begin{tikzpicture} \node{\num{6.2e+10}}; \end{tikzpicture} \end{document}


0

Use this definition instead: \pgfplotsset{ /pgfplots/bar shift auto/.style={ /pgf/bar shift={ - \distb * \dista * 0.5*(int(3/2*\numplotsofactualtype-1)*\pgfplotbarwidth + \distb * (int(3/2*\numplotsofactualtype-1))*(#1)) + \distb * \dista * (.5+\plotnumofactualtype+int(\plotnumofactualtype/2))*\pgfplotbarwidth ...


2

Following the idea of this thread, you can set this property when using \input{} in case you generate your figure in an externate file. The following did the trick for me : \begingroup \pgfplotsset{every axis/.style={scale=2}} \input{tikzfig} \endgroup Using : \tikzset{every axis/.style={scale=2}} would also be possible but generates a warning.


4

You can find intersections and clip inside relavant rectangle to draw the dashed curve. \documentclass[tikz,border=5mm]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \draw[red,name path=A,save path=\pathA] (0,0) .. controls +(1,0) and +(-1,0) .. (2,1) .. controls +(1,0) and +(-1,0) .. (4,0); \draw[blue,name path=B,save ...


3

With two nodes and less explicit coordinations: \documentclass[margin=5pt]{standalone}% if you load tikz afterward, no need to put it as documentclass option \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing, positioning} \tikzset{mynode/.style={inner sep=0pt, minimum width=.5cm, minimum height=3cm}} \begin{document} \begin{tikzpicture}[decoration=...


2

Try to repeat some coordinates: \documentclass[margin=5pt, tikz]{standalone} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing} \begin{document} \begin{tikzpicture}[decoration={zigzag,segment length=0.4em, amplitude=.3mm}] \draw[] (0,0) edge [decorate] (0,3) (0,3) -- (0.5,3) (0.5,3) edge [decorate] (0.5,0) (0.5,0) -- (0,0); \draw[xshift=2cm]...


3

See if the following MWE (Minimal Working Example) is useful to you: \documentclass[12pt]{article} \usepackage[landscape,margin=1in]{geometry} \usepackage{tikz} \begin{document} \begin{center} \begin{tikzpicture} \def \margin {6} \foreach \i [count=\j, count=\k from 2] in {9,10,7,2,8,5,4,6,1,3} { \node [draw,circle] at (\j*36:5cm) {\i}; \draw[-...


2

Ok, I figured it out. The last line of code should be this: \draw[->,>=latex] (10*360/10+\margin:5cm) arc (10*360/10+\margin:11*360/10-\margin:5cm);


1

I recommend puting all in 1 tikzpicture, and use scope. \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture} \draw[->] (-1,0)--(1,0) node[midway,above]{stabilization}; \begin{scope}[xshift=-2.5cm] \fill (0,0) circle(3pt) node[above=1mm]{$p_i$} (.5,0) circle(1.5pt) (-.5,0) circle(1.5pt) (-1,0) circle(1.5pt); \draw (-1.5,0)--...


0

The following (a bit cleaner I hope) code is from jackal's answer without using some manually calculating options such as [bend left=20]. \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture} \tikzstyle{n}=[draw,circle,minimum size=10mm]; \path (0,0) coordinate (A) (5,0) coordinate (B) (3,3) coordinate (C) (1,4) coordinate (D); \...


0

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \usepackage{tikz} \usepgfplotslibrary{groupplots} \usepgfplotslibrary{statistics} \pgfplotsset{compat=1.3} \begin{document} \begin{tikzpicture} \begin{axis} [ boxplot/draw direction=y, xtick={1,2}, ymin={0}, ymax={890000}, ] \addplot+[color=black, ...


1

The following is a semi-automatic solution which requires to manually set the number of categories (here P1, P2, P3, so three categories). It uses an array with the bar labels (source: Abbreviated month names as tick labels in PGFplots) which is accessed using the cheat counter. The counter is increased every time an A bar coordinate is plotted. The A bar ...


3

You should load xcolor with the cmyk option so that the default color color is cmyk: \documentclass{book} \usepackage[cmyk]{xcolor} \usepackage[overprint]{colorspace} \usepackage[most]{tcolorbox} \newtcolorbox{casestudy}{enhanced,boxrule=0pt,boxsep=0pt,colframe=red,colback=yellow, sharp corners, arc=5pt, rounded corners=southwest,left=9pt,right=0pt,top=5....


2

Update Here's a very simple overprint implementation for XeLaTeX. It works with (and in fact requires) pgf. tcolorbox loads pgf so this is no problem. \documentclass{book} \usepackage[cmyk]{xcolor} \usepackage{tcolorbox} \newtcolorbox{casestudy}{% sharp corners, colback=yellow, left=0pt, right=0pt, top=0pt, bottom=0pt, before skip=0pt, after skip=0pt, ...


15

north, west, etc. refer to absolute directions of nodes, not to directions with respect to the line that you draw between your specified nodes. Furthermore, the radius of your rounds is too big, so even for the first (horizontal) connection the rounds don't turn out nicely. You might also want to create a tikz style to automate the process of drawing these ...


10

You can utilize this awesome answer by Jake. It might be a bit like using a sledgehammer to crack a nut, but it works. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc, shapes, positioning} % command by Jake https://tex.stackexchange.com/a/27185/124577 \newcommand{\convexpath}[2]{ [ create hullnodes/.code={ \global\edef\...


3

see if the following solve your problem: \begin{center} \tikzset{every picture/.append style={baseline=(current bounding box.center)}} % <--- \begin{tikzpicture} %some codes to drat the first picture. \end{tikzpicture} \quad $\xrightarrow{\text{stabilization}}$ \quad \begin{tikzpicture} %some codes to drat the second picture. \end{tikzpicture} \end{...


7

I am not particularly happy with this answer as it takes a long time to render and frame 1 and 3 is a bit dodgy (still trying to fix this) but here it is: \documentclass[tikz]{standalone} \usepackage{tikz} \usetikzlibrary{calc,intersections} \begin{document} \foreach\radius in{1,...,10}{ \begin{tikzpicture}[scale=10] \def\innerring{\radius/10-.08}...


8

A solution with "plain tikz": \documentclass{article} \usepackage{tikz} \usetikzlibrary{backgrounds,positioning} \usepackage{float} \usepackage{showframe} \begin{document} \begin{figure}[H] \centering \begin{minipage}[t]{0.45\textwidth} \begin{tikzpicture}[scale=0.6] \draw (-4,-3)rectangle (6,3); \fill[gray,...


1

You can have a much simpler code using the venndiagram package (based on TikZ): \documentclass{article} \usepackage{tikz} \usetikzlibrary{backgrounds,positioning,calc} \usepackage{venndiagram} \usepackage{float, caption} \usepackage{showframe} \renewcommand{\ShowFrameLinethickness}{0.3pt} \begin{document} {\captionsetup[figure]{skip =-1.5ex} \begin{...


2

You missed the format of the node command: \node at () {}; \documentclass{book} \usepackage{tikz} \usepackage{parskip} \begin{document} \begin{tikzpicture}[scale = 3] \draw[<->, > = stealth, thick] (-2.8, 0) -- (2.8, 0); \foreach \x in {-2, -1, ..., 2} {\draw (\x, 2pt)--(\x, -2pt);} \foreach \x in {-2,-1, ...,2} { \node at (\x cm, 0)...


6

A small variation/improvements of @ferahfeza answer: \documentclass[tikz, margin=3mm]{standalone} \begin{document} \begin{tikzpicture} \foreach \r in {0.5,1,...,2}{ \draw (0,0) circle (\r cm);} \foreach \s [count=\i from 0, count=\j] in {0.96,0.8,0.93,1,0.42,0.4,0.2,0.43} { \pgfmathsetmacro{\k}{int(Mod(\i+1,8))} \draw (0,0) -- ++ (\k*45:2) ...


1

Okay, found an easy fix; It turns out that I just need to use \foreach \time in {0,1,2,3,4,5,6,7,8,9}{ \draw (1,\time,1) -- (0,\time,0) -- (0,\time+1,1) -- (0,\time,2); } instead...


Top 50 recent answers are included