New answers tagged

1

If you really want to, introduce spaces the breaking points and set some text width. I did not have the patience to tune the width till all \underfull and \overfull complaints disappeared. \documentclass[12pt,a4paper,oneside]{report} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} \pgfplotsset{width=14cm,compat=1.9} \pgfplotstableread[row sep=\\,col ...


0

With xfp I get this \documentclass[a4paper]{article} \usepackage{pgfplots,xfp} \begin{document} \begin{tikzpicture} \begin{axis}[% width=10cm, height=5cm, ] \addplot [x filter/.code={\fpeval{1/#1}}] table[row sep=crcr]{% 665.123474243553 50.0709210000000\\ 665.124802332690 49.6678125000000\\ 665.126130403923 49.7686245000000\\ 665.127458480460 ...


2

You can disable/overwrite the global no markers setting by providing suitable options to every axis plot post style which can either be added to the axis or the \addplot options. % used PGFPlots v1.16 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{ every axis/.append style={ label style={font=\small}, ...


0

Please try with the below code and must run in LuaLaTeX to get the output: \documentclass{article} \usepackage{pgfplots,tikz} \usetikzlibrary{matrix,calc,arrows,shapes,positioning} \usepgfplotslibrary{groupplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{groupplot}[group style={group size= 2 by 1},height=6cm,width=6cm,xmin=0....


0

I guess the easiest way to align the plots vertically is to simply make use of the groupplots library. (Please note that there currently seems to be a bug when symbolic coords are used in a groupplot. That is why I needed to use a different approach to provide the data. And because I anyway was "forced" to restate the data I also switched them from ...


3

This is a reply to a comment by @Faekynn. Since it is too long for a comment, it is a community wiki answer, which I will be happy to delete. % used PGFPlots v1.16 \documentclass[border=5pt]{standalone} \usepackage{filecontents} \begin{filecontents*}{filename.txt} 20 0.01 1.0261 40 0.01 1.0622 60 0.01 1.0572 100 0.01 1....


1

Converting comment to answer. You can mention the xticks manually like this: xtick={0.01,0.03,...,0.20}, so that only odd ticks will be shown. Result: \documentclass[margin=3mm]{standalone} \usepackage[english,spanish]{babel} % multilenguaje \usepackage{pgfplots} \usetikzlibrary{babel,positioning} \pgfplotsset{compat=1.16,width=0.98\linewidth} \...


1

I guess that one gets this result because the parameters are not properly initialized, i.e. they are far away from the (optimal) result. To get the desired result you could either use the parameters of a linear fit you got from another program or you could use gnuplot to calculate a proper fit. (If you comment the initialization of the fit parameters you'll ...


0

Try replacing stack negative=on previous with stack negative=separate. But note that one of the negative values is very close to zero. You will not be able to see it in the graph.


0

FreeBSD has it's own implementation of make which is not fully compatible with the GNU implementation; the makefile generated by the externalize library is using more than the POSIX feature set of make. Using the GNU make provided by FreeBSD the command gmake, the command gmake -f mwe.makefile generates the following output mkdir -p "./" touch "mwe-figure0....


1

I personally don't like stating coordinates to the \addplot command, because this is much harder to write as a table and also doesn't allow easy manipulation of the data. So I converted your coordinates to a table and then applied the scaling of the values to both, i.e. the y values and the y error values. % used PGFPlots v1.16 \documentclass[border=5pt]{...


2

Apart from the fact that your document did not compile, you confused the slope with the offset. \pgfplotstableregressiona is the slope and \pgfplotstableregressionb is the offset. If you correct that, you get \documentclass[12pt,letterpaper]{article} \usepackage[letterpaper, margin = 1 in]{geometry} \usepackage[spanish, es-tabla]{babel} \usepackage[utf8]{...


4

Edit: Now I notice to late that other answer has added the same solution for xtick labels as I try proposed :-(. So only some off-topic suggestions ... I would design your diagram with use of the filecontents package and reduced number of decimal digits for y values to four (to my opinion they still provide satisfactory accuracy): \documentclass[margin=...


5

1. Scale the x-ticks scaled x ticks = base 10:2, 2. Change the number format xticklabel style={ /pgf/number format/fixed, /pgf/number format/precision=2}, 3. Reduce the number of xticks. List only the needed xtick labels xtick={0.00,0.02,...,0.12}, OR, increase xtick distance (as commented by Stefan Pinnow) xtick distance=0.02, Code \documentclass[...


2

I asked on the dvipdfmx list and Shunsaku Hirata confirmed my suspicion that it is a dvipdfmx failure. A similar problem can be shown with this smaller example: \documentclass{article} \begin{document} \special{pdf:bcolor [0]} \special{pdf:code q 1 0 0 rg 1 0 0 RG} text in red \special{color push gray 0} %switch back to black Text in black. \special{color ...


3

You have wrong defined addplot. Try: \documentclass{standalone} %\usepackage{comment} \usepackage{pgfplots} \pgfplotsset{compat=1.14} %\usetikzlibrary{patterns} %\usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture} \begin{axis}[xmax = 10, ymax = 10, legend pos = south east] \addplot [<->, red, thick] coordinates {(0,0) (9,9)}...


2

Workaround. Use \pgfplotsset{axis line style={color=black}} instead.


1

With units library you can achieve this by using: change y base, y SI prefix=milli, Note that I have increased the error value (10x) so that it will be visible. LaTeX source \documentclass[border=3mm]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{units} \begin{document} \begin{tikzpicture} \begin{axis} [ title=no scaling, ymin=0, ...


0

In my opinion, that figure can be drawn with plain TikZ. We can change scaling as we wish. \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture}[yscale=.5,xscale=1.7] \foreach \i/\itext/\ivalue in {1/one/9.81,2/two/4.82,3/three/4.78,4/four/10.03} \draw[blue,line width=4mm] (\i,0) node[below,black]{\itext}--+(90:\ivalue); \...


1

Just for fun, a short code with pstricks: \documentclass[x11names, svgnames, border=6pt]{standalone} \usepackage{fourier} \usepackage{pst-plot} \usepackage{auto-pst-pdf} \begin{document} \psset{algebraic, xunit=2, yunit=1.5, arrowinset=0.12, arrowsize=4pt, linejoin=1, plotstyle=curve, plotpoints=200}% \newpsstyle{gridstyleA}{gridlabels=0pt, gridcolor=...


1

I guess you thought way to complicated. Just adapt domain y according to ymin/ymax and you get the desired result ... % used PGFPlots v1.16 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{document} \begin{tikzpicture} \begin{axis}[ view={50}{50}, width=\axisdefaultwidth, height=...


1

I think that if you substitute every y per 10^y in the equation you can get a more similiar result, see this: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{axis} [scale = 1, xlabel = {$\sigma$}, xmin = -10, xmax = 10, ylabel = {$\omega$}, ymin = 1e-1, ymax = 1e1, ...


2

I have adapted my simpler answer for this scenario. It relies on the use of lualatex, enabled shell-escape, and the manual tuning of some parameters in the script. These parameters are ycols is the number of columns with (different) y-data of the same length at the beginning of the file. In this case 1. It can be zero, then the y output data counts from 1 ...


1

I think you misunderstand @user121799 (aka @marmot). Everything works as it should. To convince you I added an axis background color and show the result below in the first image which is the result of the following code. When you are sure you don't need the space to all four directions which would still be in the axis "box" then you can adapt the bounding ...


1

I guess the simplest way to achieve what you want is to simply add overlay to the legend style options. This prevents that the legend is accounted for in the determination of the bounding box. % used PGFPlots v1.16 \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{figure}[h] \centering \begin{tikzpicture} \begin{...


2

Do you looking for the following? (red lines designate text borders) For this you only need to add to tikzpicture the option trim axis left, trim axis right: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.16} %---------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{...


2

In principle your idea to add the connecting lines is right, but does not work, because the outliers are drawn on an invisible line and thus the position is calculated on this line instead of the "index of the point". For details I refer to section 4.17.2 on page 356 of the PGFPlots manual (v1.16). To circumvent this problem you can move the "outliers" to ...


6

With \pgfmathsetlengthmacro\MajorTickLength{...} you just created a length and stored some value to it, but you never applied that value somewhere. So by adding major tick length=\MajorTickLength to the axis you will get your disired result. Please note that I heavily simplified your code -- as M. Al Jumaily did in his answer as well -- to achieve the same ...


7

On page 342 from the manual (version 1.16), it introduces every minor tick/.append style={...} and every major tick/.append style={...} options for customization. You need to use minor tick length = something and major tick length= something inside. I have condensed your code into a minimal example. PS You don't need \pgfmathsetlengthmacro\MajorTickLength{.....


1

Instead of adding another \addplot command to draw an/the error bar(s) -- this adds the bar you don't want, you need to add the "error bar" stuff to each of the previous \addplot command. To not repeat yourself over and over again you can also add these options to the axis options. For details have a look at the comments in the code. % used PGFPlots v1.16 \...


8

A PSTricks solution only for either fun or comparison purposes. \documentclass[pstricks,border=12pt,12pt]{standalone} \usepackage{pst-plot} \def\f{x+x*(x-4)*(x-8)/10} \begin{document} \begin{pspicture}[algebraic](-.75,-.5)(10,11) \psaxes[ticks=none,labels=none]{->}(0,0)(-.5,-.5)(10,11)[$k_t$,-90][$k_{t+1}$,180] \psplot[linecolor=red,linewidth=2pt]{0}{8....


8

Here is a solution using declare function to define f, using \edef to draw in a \foreach via axis cs: (cf. p.548, pgfplots manual) and using remember and evaluate to calculate and memorize the values of k and f(k). \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \pgfplotsset{compat=newest} % see: https://tex....


1

You have to add option unbounded coords=jump for the plots. Short example: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.16}% <- added! \usepackage{filecontents} \begin{filecontents}{performance.data} x Italy Ireland 1 NaN 63.99 27 245.139 67.175 39 221.219 65.245 214 NaN 65.15 242 165.268 63.88 263 168.554 66 \end{...


0

I recommend using plain TikZ for plotting ordinary functions, to get the best picture as you like, in particular, adding some node at the center south of the current picture. \documentclass[tikz,border=5mm]{standalone} \usepackage{amsmath} \begin{document} \begin{tikzpicture}[yscale=.4,xscale=.7] \draw[->] (-3,0)--(6,0) node[below]{$x$}; \draw[->] (0,-...


3

This is because of enlargelimits, but on the right axis y doesn't start at 0. So with a slight modification you will get the desired result. For that see the comments in the code. % used PGFPlots v1.16 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{ my axis style/.style={ ybar, enlarge x limits=...


2

Basically, this seems to be the problem of reordering the matrix data into a vector. The easiest solution is certainly to save the data in a format suitable for pgfplots. But it is also possible to reorder the data with the help of a lua script. I have adapted another answer of mine tackling the same problem, but with a slightly different data structure. \...


3

As pointed out in some comments, this is possible with lua. My script assumes data ordered as follows, whitespace-delimited only. This is basically as asked in the question. The indentation in the first line is optional. y1 y2 x1 z11 z12 x2 z21 z22 x3 z31 z32 The script reads the data, stores it in tables and writes the tables in an output file ...


3

Basically you have the right option, but in the wrong place. axis equal, just like for example width and height, is an option that belongs to the axis environment, not to an individual plot. (Think about it, it doesn't make sense to have two plots in the same axis, where only one plot has axis equal.) So you need \begin{axis}[equal] not \addplot +[axis ...


3

The image defines a bounding box, just place the text to the south of this bounding box. I anchor it to the north so that the text does not overlap the image. \node[anchor=north] at (current bounding box.south) {\ovalbox{one function}}; \documentclass{article} \usepackage{pgfplots} \usepackage{fancybox} \begin{document} \begin{tikzpicture} \...


2

One can rewrite the input touchstone file with the help of a luascript if the document is compiled with lualatex. The lua code can be called from inside the .tex file. Since this lua script writes a new data file, enabling -shell-escape is required for this solution. As mentioned in the question, no action is required for one- and two-port files (*.s1p and *...


4

For completeness one more example :-). Using pgplots: \documentclass[margin=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \usepgfplotslibrary{fillbetween} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \begin{axis}[axis lines = middle, axis line style={-latex}, xmin=-0.3, xmax=8, ...


10

Note #1: your MWE is not complete: it requires the pgfplots package and the intersections TikZ library. Note #2: to avoid warnings, you must add the fill between/on layer=main option. First Version You can use a clip operation to limit the effect of the \tikzfillbetween macro: \documentclass{standalone} \usepackage{tikz,pgfplots} \usetikzlibrary{arrows,...


2

Your best bet is to construct the list of samples as a macro, in this case \mylist. I had one heck of a time figuring out what sequences like {2,...,3} were supposed to accomplish. You should always include at least one extra point to establish the spacing. BTW, never use #1^2 for #1*#1 when doing calculations. They are not the same! \documentclass[...


2

Simple Answer For me, the colorbar sampled looks the same as the piecewise-constant version. The only difference is that it is viewed correctly in the programs I tried so far. Code is as follows (pay attention that the number of samples must be 1 larger than the number of constant pieces before!) \documentclass{standalone} \usepackage{pgfplots} \...


1

Can't you just make a new (normal) axis and repeat the use of \addplot graphics? A groupplot makes aligning them easy. You just need to make sure that ymin/ymax is set correctly. (The whitespace between colorbar and axis is from colorbar.pdf, so better cropping should fix that.) \documentclass[border=5mm]{standalone} \usepackage{pgfplots} % loads tikz ...


5

You have added those numbers with the nodes near coords options. The purpose of that option is precisely to add things like the y-values above plot points/bars. The other part is mostly a matter of setting the axis limits. You need ymin=0 to make the y-axis start at zero, and change enlargelimits to enlarge x limits so the axis limits are extended only in ...


Top 50 recent answers are included