Hot answers tagged

19 votes
Accepted

How to draw force lines onto an equipotential contour plot using TikZ?

(The answer is inspired by the jaytar's comment) You can use pythontex for that. Note that if your potential function is U(x) then the field lines are orthogonal to its level curves, so they are ...
Sergei Golovan's user avatar
15 votes
Accepted

Plot a transfer function in latex

You can use de the bodegraph package (https://www.ctan.org/pkg/bodegraph) http://www.texample.net/tikz/examples/bode-plot/ for your example first : the plot of the amplitude and phase diagrams \...
rpapa's user avatar
  • 12.3k
12 votes

Plot large data

When treating big vector data like this, I fear a lot the possibility of having (undetected) visual aliasing. Consider for example a sinusoidal signal with period 10 (arbitrary units), with a noise of ...
Rmano's user avatar
  • 40.3k
8 votes
Accepted

How to plot abs(sin(x)) with gnuplottex

What happens is that gnuplot is sampling the x-axis. It means that it does not compute the function for all the possible points in the interval [-2*pi:2*pi] but only a finite number of points. The ...
M. P.'s user avatar
  • 268
8 votes
Accepted

How to plot function sin(x)^2 / x^2

As commented by @daleif, the problem is that the trigonometric functions in pgfplots are defined with the argument in degrees, not in radians. So you are calculating the function really near zero, and ...
Rmano's user avatar
  • 40.3k
7 votes
Accepted

Graphs of Implicit Curves using Tikz, gnuplot, and LaTeXIt

In order to run gnuplot from within pdflatex, you have to pass the -shell-escape option. Go to the preferences of LaTeXIt and choose the “Typesetting” tab; next to the pdflatex box there's the icon ...
egreg's user avatar
  • 1.1m
7 votes
Accepted

Using tikz/pgf and gnuplot with lualatex

\write18 shell escape does not work by default for newer luatex, the shellesc package puts it back, this works for me: \RequirePackage{luatex85,shellesc} \documentclass{article} \usepackage{tikz} \...
David Carlisle's user avatar
7 votes
Accepted

pgfplots/gnuplot: How to find the curve-fitting function passing through certain points and plot it?

You can use \addplot gnuplot to do the curve fitting using the gnuplot backend, which allows you to use different domains for fitting and plotting the function. It also allows you to fit non-linear ...
Jake's user avatar
  • 232k
7 votes

How to plot function sin(x)^2 / x^2

A PSTricks solution for comparison purpose only. \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot} \def\f{(sin(x)/x)^2} \psset { yunit=4cm, xunit=.5cm } \begin{...
Display Name's user avatar
  • 46.9k
7 votes

Plot a function of two variables equal 0

@Superuser27 is correct about the missing *. Additionally, I don't understand why you're using \addplot3. Finally, that's not a function. \documentclass{article} \usepackage[margin=0.5in]{geometry} ...
JPi's user avatar
  • 13.6k
6 votes

Plot a transfer function in latex

If its a one time thing, you can do it manually (the hard way). Odd powers contribute to imaginary part and even powers contribute to real part; with alternating signs. Now take the square root of the ...
AJN's user avatar
  • 932
6 votes

Plot a transfer function in latex

Try: \documentclass[border=3mm, tikz, preview ]{standalone} \usepackage{pgfplots} \pgfplotsset{width=8cm,compat=newest} \begin{document} \begin{...
Zarko's user avatar
  • 296k
6 votes

Using pgfplots and gnuplot and compiling with output-directory

Digging around in the files, mentioned in @anonymous' comment, to find out what to patch, I spotted the following pgf-key. It can simply be overwritten in the preamble of the document. \usepackage{...
Johannes Jendersie's user avatar
6 votes
Accepted

How can I draw the probability density function a truncated normal distribution?

Because gnuplot knows the error function (erf), you can use the raw gnuplot function of PGFPlots to do what you want. Because I don't know the truncated normal distribution function, I am not 100% ...
Stefan Pinnow's user avatar
6 votes
Accepted

3d interactive image using gnuplot

Asymptote (http://asymptote.sourceforge.net/) is what you are after. It produces interactive 3D models in the PRC format which are eventually embedded using the media9 LaTeX package. See Sect. 7 of ...
AlexG's user avatar
  • 54.6k
6 votes
Accepted

Scatterplot with trendline with curve fitting equation of polynomial of degree 3

There were a few mistakes in your Gnuplot code. I'm no expert, but on comparing with Adding values to pgfplot legend and testing a bit: You need a semi-colon between each of the variable declarations,...
Torbjørn T.'s user avatar
6 votes

pgfmath / gnuplot: How to use gnuplot for complicated calculations?

gnuplot is more for plotting but you could use expl3's floating point instead: \documentclass{article} \usepackage{xfp} \begin{document} \newcommand{\x}{0.02} \edef\y{\fpeval{2*11000*(1 - 1.40576 - ...
David Carlisle's user avatar
5 votes
Accepted

gnuplottex package not working anymore

It's an oversight of gnuplottex: if no gnuplot diagram is processed, the file <jobname>.gnuploterrors is not produced, so the final code for displaying errors fails to find it. 203 \...
egreg's user avatar
  • 1.1m
5 votes

Gravitational/electric field with tikzpicture

It is quite easy in pgfplots, which is based on tikz, since the plot is made by two analytically defined contour plots as pointed out in the PDF from @Jeremie's comment. Only the singularity handling ...
crateane's user avatar
  • 2,207
5 votes

File not found while using \input for gnuplot figures

gnuplot's epslatex terminal creates two files fig_name.tex and fig_name.eps. You have to call fig_name.tex from your main file with \input{fig_name}, but this one will load fig_name.eps with an \...
Ignasi's user avatar
  • 136k
5 votes

How to plot abs(sin(x)) with gnuplottex

Just for laughs, here is straight LaTeX \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=-2*pi,xmax=2*pi, ...
daleif's user avatar
  • 54k
5 votes

Gnuplot terminal

For some nice vectorised graphics in ones latex I use gnuplot like this with cairolatex output set term cairolatex pdf set output "data.tex" plot 'data.csv' using 1:2 with lines, And then I use the ...
Federico Spaghetti's user avatar
5 votes

Draw illustration uniform convergence

Do you want something like this? I'm not sure what exactly you are trying to do. (Usually things which look like this get plotted either using TikZ or pgfplots.) \documentclass[border=10pt]{...
cfr's user avatar
  • 196k
5 votes
Accepted

Draw illustration uniform convergence

Like this? \documentclass[tikz, border=2mm]{standalone} \usetikzlibrary{decorations.pathreplacing, positioning, quotes} \begin{document} \begin{tikzpicture}[auto,...
Zarko's user avatar
  • 296k

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