Hot answers tagged

34

An example for Venn diagrams with transparency by Till Tantau and Kjell Magne Fauske, from the TikZ Example gallery: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes,backgrounds} \begin{document} \pagestyle{empty} \def\firstcircle{(0,0) circle (1.5cm)} \def\secondcircle{(60:2cm) circle (1.5cm)} \def\thirdcircle{(0:2cm) circle (1.5cm)} \begin{...


31

Version 1.10 of pgfplots has been released just recently, and it comes with a new solution for the problem to fill the area between plots. Note that the old solution is still possible and still valid; this here is merely an update which might simplify the task. In order to keep the knowledge base of this site up-to-date, I present a solution based on the ...


24

Here's a set of steps I took to get gnuplottex working in Windows. I'm running TeX Live rather than MiKTeX, so let me know if this doesn't work. First, you need to install gnuplot. The binary I used was taken from this page. When installing it, the only change from the default I made when following the installer was to select "Add application directory to ...


23

I took a look into the gnuplot manual and may have found what you are looking for: set key above vertical maxrows 1 setting the key to vertical and then specifying the maximum number of rows to 1 sets all keys in one row. Since the key might then be too long to be fully displayed you might need to play with width: This code #!/usr/bin/env gnuplot set key ...


22

EDIT Starting with pgfplots 1.14, you can draw filled contour plots by means of builtin methods in pgfplots: \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer,patchplots} \pgfplotsset{compat=1.14} \begin{document} \begin{tikzpicture} \begin{axis}[ domain = 1:2, %y domain = 0:90, y domain = 74:87.9, view = {...


22

Using TikZ and pgfplots the best option is adding ycomb to your plot, as follows: \documentclass{article} \usepackage{tikz,pgfplots}%http://www.ctan.org/pkg/pgf http://www.ctan.org/pkg/pgfplots \begin{document} \pgfplotsset{ standard/.style={%Axis format configuration axis x line=middle, axis y line=middle, enlarge x limits=0....


21

When using MikTeX, you need to load gnuplottex with the [miktex] option. Note that you might be better off using the pgfplots package, which generates plots completely within LaTeX (or uses gnuplot as its backend). This integrates the plots much better into the document, since the same font and rendering is used for the text and the plot. It also makes it ...


20

You can use the gnuplot command set print "<filename" to open a new file, and then write the parameters into that file using print Ymax,EC50,nH. If you use set fit errorvariables;, the standard errors will be available as Ymax_err, EC50_err and so on. You can then use \pgfplotstableread{<filename>}<table macro> to read the file, and access the ...


20

First off, if you are plotting 15,000 points one has to wonder what exactly you are trying to visualize. With so many points the "signal" or "point" of your graphic is likely to be lost in all the "noise". Have you considered applying some sort of statistical analysis to your data in order to identify and emphasize trends? For example, this plot (produced ...


20

(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 solutions of the differential equation dx/dt=DU(x) (or -DU(x), it doesn't matter). In the following code I use the scpiy.integrate.odeint function to solve the ...


18

To get LaTeX in labels or legends in Gnuplot, you need to use one of the terminals that produce LaTeX code. For example, you could use the latex terminal: set terminal latex set out 'plot.tex' plot [-5:5] [-1.5:1.5] sin(x+pi) title "$\\sin(x+\\pi)$" set out That will produce a plot.tex file that includes the plot using basic TeX statements. You can ...


18

The first function \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot,pst-node} \begin{document} \psset{xunit=.5} \begin{pspicture}(-1,-.5)(16.5,2) \psaxes[Dy=.5]{->}(0,0)(-.9,0)(16,1.5)[$n$,0][$l[n]$,90] \curvepnodes[plotpoints=16]{0}{15}{t 1}{A} \psset{linecolor=red} \multido{\i=0+1}{\numexpr\Anodecount+1}{\psline{-o}(...


16

In the past EPS was a good format to use for plots because it stored vector graphics. It doesn't make sense to save plots as raster images. However, nowadays PDF, which is kind of the successor of PS, is the better format. It also supports vector graphics, font inclusion and also raster images. Because it is binary it normally takes much less space than EPS ...


16

Asymptote contour3 package draws 3D surfaces described as the null space of real-valued functions of (x, y, z). Note that the images here are rendered into raster format (png). % impsurf.tex : % \documentclass[10pt,a4paper]{article} \usepackage{lmodern} \usepackage{subcaption} \usepackage[inline]{asymptote} \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]...


15

While tikz can do basic graphs, you should use pgfplots for graphing: As hpesoj626 commented, sometimes it is better to have the axis lines in the middle. This also shows some of the other options that pgfplots provides: Code: \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[scale=1.0] \begin{axis} \...


15

Another possibility: filled contours with Asymptote, MWE: % fcontour.tex: \documentclass{article} \usepackage[inline]{asymptote} \usepackage{lmodern} \begin{document} \begin{figure} \begin{asy} import graph; import contour; import palette; defaultpen(fontsize(10pt)); size(14cm,8cm,IgnoreAspect); pair xyMin=(1,74); pair xyMax=(3,86); real f(real x, real y) ...


14

The set ylabel command can be given an optional x or y position offset. Beware though, for me, Gnuplot 4.4 gave errors relating to a missing semicolon. The older Gnuplot 4.2.4 worked fine. For example: set ylabel "angels" 5 For Gnuplot 4.4, use the keyword "offset". For example: set ylabel "angels" offset 2


14

If you define your function using \def\<function macro>(#1){\pgfmathparse{...#1...}, you can use the function in all the applications you mentioned by saying \<function macro>(x) or \<function macro>(x-1), or \<function macro>(2.4). This will work both when using Gnuplot and when using straight PGFplots: \documentclass[border=5pt]{...


14

With PSTricks (If you don't mind to make a try): \documentclass[pstricks]{standalone} \usepackage{pst-func} \begin{document} \begin{pspicture}(-2,-2)(2,2) \psaxes{<->}(0,0)(-1.5,-1.5)(1.5,1.5)[$x$,0][$y$,90] \psplotImp[ linecolor=red, stepFactor=0.1, algebraic, ](-1.5,-1.5)(1.5,1.5){(x^2+y^2)^3-4*x^2*y^2} \end{pspicture} \end{...


14

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 \documentclass{article} \usepackage{tikz} \usepackage{bodegraph} \begin{document} \begin{tikzpicture}[xscale=15/4] \begin{scope}[yscale=3/50] \UnitedB \semilog{...


12

Here is what I did to get gnuplot working on a Mac. (You need to use the Terminal for this.) Goto GNU Plot on Sourceforge and download the source code. This should unzip in a folder gnuplot-4.6.0 in your Downloads folder. Open a Terminal window and issue the following commands: (hit the return key after each; the last three commands will produce quite a ...


12

Plotting heatmaps with gnuplot and LaTeX with small file size Basically, there are two different ways to draw heatmaps with gnuplot: Plotting with image Plotting with pm3d and splot Both have their advantages and disadvantages, and which one should use also depends on the actual data structure. The following terminals allow typesetting text with LaTeX ...


12

This happens because there are no valid samples in the first half of your plot. gnuplot by default uses 100 samples, starting with the first number in the sampling range and dividing the range equally in linear space. That means that in your case, you have samples at 0, 41.4, 82.8, etc. The first sample evaluates to NaN because of the division by zero in ...


11

You must tell gnuplot to use log scale too … \documentclass[11pt]{article} \usepackage{pgfplots} \begin{filecontents}{test.dat} 2 12 5 55 10 96 20 135 50 144 100 147 200 147 500 146 \end{filecontents} \begin{document} \begin{figure}[h!t] \centering \begin{tikzpicture} \begin{axis}[ xmode=log, ymode=linear, axis x line*=bottom, ...


11

User defined constants: \const{HalfCanvas}{1.5}% half of canvas width or height \const{InitAngleD}{30}% initial angle \const{MainR}{1}% main radius \const{ChildR}{2}% child radius \documentclass{beamer} \usepackage{pstricks-add} \usepackage[nomessages]{fp} \def\const#1#2{% \expandafter\FPeval\csname#1\endcsname{round(#2:3)}% \...


11

For diagrams you will get the best results when using vector graphics. Both gnuplot and matplotlib can export to vector graphics; file formats for vector graphics are e.g. eps or pdf or svg (there are many more). As you are using pdfLaTeX, you should choose pdf as output format, because it will be easy to include in your document using the graphicx ...


10

There's a venn package on CTAN: "Creating Venn diagrams with MetaPost." Example code (from README): draw_venn_two(true,false,true,false) shifted (2in,1in); draws a diagram with the outer box shaded, with the first circle but not the second unshaded, with the intersection of the two shaded, and with the second circle but not the first unshaded. That is, ...


10

Remarks The paths with the arrows inside needed some extra attention, but on this great site I found a way to do it, of course :-). For more see this post: TikZ: How to draw an arrow in the middle of the line? The picture in your post I recreated the picture in your post with TikZ. Implementation \documentclass[tikz]{standalone} \usetikzlibrary{...


10

This happens because the lengths of the quiver arrows are taken into account when calculating the axis range. The arrow that starts at (-2,0) has a non-zero length, the tip lies slightly to the left, so the axis range is increased so the full arrow is visible. To limit the axis range to the function domain, set xmin=-2, xmax=2, ymin=-2, ymax=2. I would ...


10

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 period 0.11. #! /usr/bin/env python3 # import math import numpy as np import scipy as sp t1 = np.arange(0.0, 100.0, 1e-3) y1 = np.sin(2*math.pi*t1/10) + 0.2*...


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