# Tag Info

2

I present two similar solutions below. Both have to do with layers. In the "simple" solution you load set layers and then can assign the layer where you want to have what using the on layer feature. In the "bit more complicated" solution we define a new layer set based on the standard layers set. In that we move the axis lines layer (...

1

You just need a line style for axis line style e.g. an arrow with a myarrow tip. Like this: \documentclass{standalone} \usepackage{pgfplots} \usetikzlibrary{arrows.meta} \pgfplotsset{compat=newest} \tikzset{ myarrow/.style={>={Computer Modern Rightarrow[scale length=1.5]}}, } \begin{document} \begin{tikzpicture} \draw[->, myarrow] (0,0) -- (0,3); ...

0

I have not been able to find a single definition of the arrow tip that works for all three situations, but here's a work-around in which I simply define a second style: \documentclass{standalone} \usepackage{pgfplots} \usetikzlibrary{arrows.meta} \pgfplotsset{compat=newest} \tikzset{ myarrow/.style={>={Computer Modern Rightarrow[scale length=1.5]}}, ...

3

Just for comparison here is a version in Metapost and the luamplib package. Compile with lualatex. \documentclass[border=5mm]{standalone} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(1); numeric r, n; r = 1cm; n + 1 = 4; path xx, yy, C[]; xx = (left--right) scaled ((n+2)*r); yy = xx ...

2

THE RAW SOLUTION: THE DELTOID Here's a quick solution in plain TikZ, using parametric definition of a deltoid (with b=3a): \documentclass[tikz,border=3.14159mm]{standalone} \begin{document} \begin{tikzpicture} \draw[cyan,very thin] (-4,-4) grid (4,4); \draw[->] (-4,0) -- (4,0); \draw[->] (0,-4) -- (0,4); \draw (0,0)...

2

Your style myarrow tells tikz to draw the arrow from left to right. In both of the following specifications, <-,myarrow ->,myarrow myarrow comes last and overwrites -> or <-. What you probably want is to change only the arrow tip. For this, use >={Computer Modern Rightarrow[scale length=1.5]} either in the definition of myarrow \tikzset{...

2

You should type \tikzset{myarrow/.style={-Computer Modern Rightarrow[round]}} instead of \tikzset{myarrow/.style={>={Computer Modern Rightarrow[round]}}}. \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \usetikzlibrary{arrows.meta} \pgfplotsset{compat=newest} \tikzset{myarrow/.style={-Computer Modern Rightarrow[round]}} %<--- edit \...

2

The problem is that the function is very steep (infinitely so) around the cusp --- it is not defined for x<sqrt(7.00569) and then it jumps up abruptly. Now, plotting between 2 and 10, even with 200 steps, you will find values for a point where the function does not exist and after that another one that have a value. But the probability to get exactly the ...

5

Since you already have some reputation you should know, that it would be nice to have a minimal (not) working example (MWE), because sometimes the root cause of an error can be found in the preamble (or somewhere else). Besides that we -- the helpers -- than can immediately start with solving the problem instead of first guessing the missing parts ourselves. ...

1

I think the problem is that you added a samples key. If you comment it, it should work properly. Just in case, I force X to have the value of -1 by using samples at key. Just in case I misunderstood what you wanted, the resulting image is as follows, with the "linear" arrowsd at x=1. Is that correct? And the MWE: \documentclass[11pt]{article} \...

1

The following uses xfp for the actual calculation, and \pgfmathsetmacro with the options /pgf/fpu=true and /pgf/fpu/output format=sci applied locally to ensure the input number format is understandable for xfp (as pgfmath uses a custom internal number representation when the FPU is used, which isn't understood by xfp). The \romannumeral is used to ensure ...

2

This is a small cheat with TikZ's library shading. I don't know how to rotate rainbow's colors. % with Nguyen Quang Dung \documentclass[tikz,border=5mm]{standalone} \usetikzlibrary{shadings} \begin{document} \begin{tikzpicture} % decorations \def\a{1.1} \def\b{.03} \draw[gray,nodes={black,scale=.5}] (0,-\a) node[below]{$0$} node[below=4mm]{$x$} (1,-1-\b)--(...

2

Simply combining the colormaps seems to work ... % used PGFPlots v1.17 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{ colormap={corr2D}{ rgb255=(0,0,102); rgb255=(0,0,255); rgb255=(0,255,255); rgb255=(255,255,255); rgb255=(255,255,0); rgb255=(255,0,...

1

We also not know which function you like to have. Edit: it seems that you like to approximate function showed on added image it is not clear, if you also like to have filled as is shown on image, so I limited myself only to curve of function one possible way to draw this function is to estimate coordinates of all extremes of showed function, collect them as ...

1

Very strange question indeed. Your code is wrong, you might prefer this one: \documentclass[a4paper,10pt]{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.3} \begin{document} \begin{figure}[h] \begin{center} \begin{tikzpicture} \begin{axis}[ grid=both, grid style={line width=.1pt, draw=gray!40}, axis lines=left, ylabel=y, xlabel=x] ...

0

You can make use of the x expr feature (and friends) to accomplish that. Please have a look at the code how to explicitly use it. (Please note that I removed everything unrelated from your code.) % used PGFPlots v1.17 \begin{filecontents}{data.txt} Ax By 1 0.5 2 -1 3 1.5 \end{filecontents} \documentclass[border=5pt]{standalone} \usepackage{...

1

Is that what is needed ? \begin{filecontents}{data.txt} Ax By 1 0.5 2 -1 3 1.5 \end{filecontents} \documentclass[10pt]{article} \usepackage{pgfplotstable} \usepackage{pgfplots} \newcommand{\mydataOAA}{data.txt} \begin{document} \hspace*{-3cm} \begin{tikzpicture}[scale=1.9] \begin{axis}[ %scaled y ticks=base 10:6, %x dir=reverse, %y dir=...

1

\documentclass[tikz,border=3.14159mm]{standalone} \newcommand{\DSB}[1]{ \def\xa{3} \def\ya{0} \def\xb{1} \def\yb{2} \def\xc{0} \def\yc{1.7} \def\tang{.4} % \def\curve{ (#1-\xa,\ya) .. controls ++ (2*\tang,0) and ++ (-\tang,0) .. (#1-\xb,\yb) .. controls ++ (.5*\tang,0) and ++ (-\tang,0) .. (#1,\...

2

I came with this, with a similar approach but without any fancy package. \documentclass[tikz,border=3.14159mm]{standalone} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture}[line width=.75pt] \def\xa{5.5} \def\ya{.2} \def\xb{1.8} \def\yb{2} \def\xc{0} \def\yc{1.3} \def\tang{.7} \def\curve{ ...

4

With approximation of your function by controls macro: \documentclass[margin=3mm]{standalone} \usepackage{pgfplots} % had to be instead tikz \pgfplotsset{compat=1.17} \usetikzlibrary{arrows.meta, patterns, pgfplots.fillbetween} % <--- \begin{document} \begin{tikzpicture}[>=Straight Barb, ...

0

I am not sure how to directly create such a cycle list. But you can create a style that incorporates the cycle list and than call it in the axis options. % used PGFPlots v1.17 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} \pgfplotsset{ colormap/Set1, % define a style that incorporates ...

1

Well, i will give it a try. First i modified your input file by adding a header (for better understanding what's going on). \begin{filecontents}[overwrite]{test.txt} x y z 1000 1000 1.29403 ... \end{filecontents} Then i dived into the documentation of pgfplotstable and also used the search function. So in the end: will this work ...

0

I found the solution: It was not te data, it was the name of the .tex file which caused the error. I renamed it (test pic 3.tex -> testpic3.tex) and now it works as expected.

2

You weren't very specific so I present only two solutions to your problem. The advantage over Rmano's answer is, that it works for any \addplot command, i.e. not only for the ones that plot a given function. For details, please have a look at the comments in the code. % used PGFPlots v1.17 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \...

1

As mentioned in Manual/automatic line breaks and text alignment in TikZ nodes, if you have e.g. align=left in the node options you can use \\ to add line breaks. In your case that means yticklabel style={align=right} for the ticklabels, and nodes={align=left} inside the legend style for the legend entries. \documentclass{article} \usepackage{pgfplots} \...

0

A first attempt but without the actually data (surprise). But i think you get the idea. \documentclass[tikz]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} \begin{document} \begin{tikzpicture} \begin{groupplot}[ group style={ group size=3 by 3, horizontal sep=5mm, vertical sep=5mm, xlabels at=edge bottom, ...

0

I should answer myself here. The totcounter package is incompatible with pgfplot and I solved the issue by using xassoccnt. Define the counter: \NewTotalDocumentCounter{countername} Step like any other counter: \stepcounter{countername} Read the counter: \TotalValue{countername}

0

Welcome to TeX.SE! Your symbolic x coords are not defined in \mydataC table (as notified you error's message) . So, it is not clear, what you like to achieve by defining your symbolic x coords. X-coordinates labels? If so, this is wrong approach. To me is somehow logical, that you after the following: which is produced by: \documentclass[border=5pt]{...

3

Next time, please post a complete example --- a lot depends on your preamble. Anyway, I think that you are looking for this: \documentclass[border=10pt]{standalone} \usepackage{tikz} \usepackage{pgfplots}\pgfplotsset{compat=1.16} \usetikzlibrary{arrows.meta,positioning,calc} \begin{document} \begin{tikzpicture} [declare function = {f(\x) = -0.05*\x^3 -0.5*\x^...

0

Here's a solution in pgfplots (a little weirdness in the coordinate names...): \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis} [ view={140}{30}, xmin=-1.1,xmax=1.2,ymin=-1.1,ymax=1.2,zmin=-1.25,zmax=1.3, width=12cm,height=12cm, axis equal, axis ...

2

Here you go ... \documentclass[tikz]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{semilogxaxis}[ title={Execution Time Using Varying Array Sizes }, xlabel={Array Length}, ylabel={Execution Time [milliseconds]}, xmin=0, xmax=1000000, ymin=0, ymax=30, xtick={0,1000,10000,100000,1000000}, ytick={0,5,10,15,20,25,30}, ymajorgrids=...

0

This is as far as I got. I tried using axis x discontinuity but there is no way to place it into the right position. It wants to go to the right of 0, or to the left of xmax if negative. I also ran into some bugs regarding the axis environment and shifting. If you put the axis into a scope and shift the scope, the only thing moved is the legend. If you ...

2

You cannot make coordinates text so small that they will not overlap. As solution can be beside reducing their font size also rotate it: \documentclass[border=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \begin{document} \begin{tikzpicture}[ every label/.style = {font=\tiny, inner sep=2pt, rotate=30, anchor=west}, dot/.style =...

0

Personally i find the use of groupplots much more appealing. Also for two y-axes within one plot environment please see this thread. \documentclass[letterpaper,11pt,english]{article} \usepackage{subcaption} \usepackage{graphicx} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} \pgfplotsset{compat=1.15, small} \begin{document} \begin{figure}[htb] ...

2

The idea is to align the origins of all the tikzpictures by using a common cell size. First we determine the distances to the bounding box for each picture, then we add extra points to produce a common bounding box for each picture. The resulting cell size is far too large for the page. Some savings can be obtained by doing each column separately, but it ...

3

You should specify the step to fill the list. Otherwise it is set to 1. This is from pgfmanual. Normally, when a list item ... is encountered, there should already have been two list items before it, which where numbers. Examples of numbers are 1, -10, or -0.24. Let us call these numbers x and y and let d := y − x be their difference. Next, there should ...

4

Got it! I used the fact that $x^(1/3)=(x/abs(x))*(abs(x))^(1/3)$. In that case, it compiled perfectly! \documentclass{report} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[->] (-4,0) -- (4,0) node[right]{$x$}; \draw[->] (0,-4) -- (0,4) node[above]{$y$}; \draw[domain=-2:2, samples=100, blue] plot(\x, {((((\x)^(3)-(\x)^(2)))/(abs(((\x)^(3)-...

6

A pstricks solution: \documentclass[svgnames, border=3pt]{standalone} \usepackage{pst-plot} \usepackage{auto-pst-pdf} \begin{document} \psset{unit=2cm, algebraic, arrowinset=0.12, arrowsize=3pt, linejoin=1, showorigin=false} \begin{pspicture*}(-2.6,-2.6)(2.6,2.6) \psaxes[linecolor=LightSteelBlue, tickcolor=LightSteelBlue, arrows =->, ticksize=2pt -2pt, ...

0

I think pgfplots assumes that columns in data files are separated by a space by default, and you seem to have comma separated columns. Try using \addplot[color=black] table[col sep=comma]{dicloro.txt}; instead of \addplot[color=black] file{dicloro.txt};. This will by default use the first column for the x-values, and the second column for the y-values.

4

Here are two Asymptote solutions for comparison with TikZ or pgfplots incoming answers as you are expected. Asymptote has built-in cubic root function, so just go straight with it // http://asymptote.ualberta.ca/ unitsize(1cm); import graph; real f(real x) {return cbrt(x^3-x^2);} //<<< the cubic root function path g = graph(f,-2,2,n=1000,operator -...

1

Welcome to TeX:SE! The following MWE (Minimal Working Example): \documentclass[border=3.141592mm]{standalone} %graph and diagrams \usepackage{pgfplots} \pgfplotsset{compat=1.17} %remember this line or the graph wont work \usetikzlibrary{automata,positioning} \usepackage{amsmath} \usepackage{siunitx} \begin{document} \begin{tikzpicture} \begin{axis}[...

1

Put all the axis environments in the same tikzpicture, and position the axes relative to the other using the at key, some shifting, and the various origin anchors. For example, for the FourierA axis, use at={(RectA.right of origin)}, xshift=1cm, anchor=left of origin, Those anchors are described in section 4.19 Alignment options of the pgfplots manual. ...

2

You can set the position with xlabel style={at={}}. The left of the plot is current axis.left of origin. MWE: \documentclass{article} \usepackage{pgfplots} \begin{document} % http://pgfplots.sourceforge.net/gallery.html \begin{tikzpicture} \begin{axis}[ axis lines = middle, xlabel = {x label}, xlabel style={at={(current axis....

2

There are several different approaches one could take. I'm assuming here you also want the numbers, and add the new labels using extra x ticks and labels. There are just a few extra lines in the axis options, see also the comments in the code. \documentclass{scrartcl} \usepackage{pgfplots} \usepgfplotslibrary{statistics} \pgfplotsset{compat=1.8} \begin{...

2

You can have a look at standalone package where you can have varieties of the externalization process via mode option as quoted from the documentation. \documentclass{article} \usepackage[subpreambles=false]{standalone} \begin{filecontents*}{myplot.tex} \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \...

2

Just add the domain to the functions \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \begin{tikzpicture} \begin{axis}[axis lines=center, xlabel=$x$, ylabel=$y$, xmin=-1, xmax=2, ymin=-1, ymax=2.5, xtick distance=1] \addplot[name path=A, thick, black, samples=20, domain=-1:2]{x} node[pos=0.61, right]{$y=x$}; \...

Top 50 recent answers are included