Tagged Questions

{plot} is for questions concerned with plotting data or functions using TeX. For questions specific to the pgfplots package, use the {pgfplots} tag.

2answers
32k views

Create xkcd style diagram in TeX

The unique style of the diagrams at xkcd has an informative but nice hand-drawn touch. I guess they are actually drawn by hand but just recently on our partner site for Mathematica someone asked how ...
1answer
13k views

Bell Curve/Gaussian Function/Normal Distribution in TikZ/PGF

Can anyone tell me how to plot a gaussian function/bell curve using TikZ/PGF? I'm basically looking to implement something like PSTricks's \psGauss command.
4answers
8k views

Fill the area between two curves calculated by pgfplots

This is essentially the same question as fill the area between two curves when their coordinates are known. In that question, the curves were defined by known coordinates. I want to fill the area ...
2answers
3k views

Center nodes near coords in a stacked ybar plot

I'm trying to center the node values, at the middle of each bar, in a stacked plot. However I can only put those nodes in the top of each bar. Is it possible to move those down? To the center of each ...
2answers
7k views

Is plotting exponential graphs a known source of bugs in TikZ?

I want to plot $y = 2^x$ over a small domain. Unfortunately, even though tikz (v 2.1) seems to be able to calculate 2^{negative numbers} it is not plotting them correctly. My minimal example is: \...
2answers
5k views

Fill between two curves in pgfplots.

How to accomplish fill between two curves in pgfplots? For example, I have ... \addplot coordinates {(0,1) (1,1)}; \addplot file {something.dat}; ... and I would like to have filling between those ...
2answers
22k views

How to plot data from a CSV file using tikz and csvsimple?

Here is a minimal example : \begin{filecontents*}{data.csv} a,b,c,d 1,4,5,1 2,3,1,5 3,5,6,1 4,1,4,9 5,3,4,7 \end{filecontents*} \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{...
1answer
1k views

Pgfplots: plot graph inside table

I would like to plot a table with a graph inside it. I am trying to use this example as a guide. This is the current hand-constructed version. UPDATE: I don't have enough reputation to answer my ...
1answer
1k views

Plot functions and their point of intersection

We are plotting three functions as follows \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[enlargelimits=false] \addplot[domain=0:1,blue] {(1-x)/5}; \...
1answer
2k views

Drawing timeline

I have a dataset which consists of repeating events over time. Each event takes an arbitrary amount of time. I could plot this using gnuplot but am unable to produce correct keys because of the ...
1answer
421 views

proper tool for charts in tex

I have scanned data graphics in a large ms written in TeX (of course). For copyright reasons I need to redraw these. My publisher may (sadly) decide not to use my source directly, so will need access ...
1answer
787 views

plotting the sequence x_n using tikz

I want to plot the sequence x_1 = \sin(pi root(2)) x_2 = \sin(pi root(6)) x_3 = \sin(pi root(12)) In short my x_n = sin( pi root(n^2 + n)). I want to plot this as an animation as n goes to ...
2answers
3k views

Plot reciprocal function with tkiz

I need to plot f(x) = 1 / x in LaTeX and am trying to with Tikz. I haven't found a way to set the vertical range, so the values go out of bound around x=0. Using gnuplot directly doesn't seem to be ...
2answers
4k views

Animated plotting with LaTex?

I am not a LaTeX pro, that's why I don't know if the following is possible and how I could do it. I have a graphic (a plot, jpg) and it shows a time series. I know in PowerPoint it is possible that ...
1answer
1k views

How to have linked axes on plots?

I plot infrared spectra in many reports and I display the energy units in two ways, wavenumbers $cm^{-1}$ on the bottom x-axis and wavelength (nm) on the upper x-axis. The relationship is X(nm)=...
5answers
4k views

How to plot x^(1/3)?

I tried to export my Geogebra graphs into tikz-code. In General it works fine, but plot x^1/3 doesn't work: \documentclass[10pt]{article} \usepackage{pgf,tikz} \usetikzlibrary{arrows} \pagestyle{...
5answers
420 views

4answers
771 views

tikz/pgfplot — always same distance between marks

Is there a way to get for all tikz-plots in one LaTeX document the same distance between the plot marks, ie the distance between the marks should be independent of sample size. It would be really ...
2answers
255 views

Why does a plot of a reciprocal function using pgfplots look wrong?

I am trying to plot the function 1/x^2 but the result is obviously wrong, here is how it looks like here is the code \begin{center} \begin{tikzpicture} \begin{axis}[ %xlabel=$x$, ...
3answers
449 views

How do I draw graphs?

I'm new to Latex and I think I am going to use it for my physics classes in school. I have found a really good template: https://www.sharelatex.com/templates/journals/aip/ (I use sharelatex) which is ...
1answer
798 views

How can I restrict pgfplots plot to an interval manually?

OK, I've plotted these graphs but am unable to stretch the second one, so that they both have the same values on the vertical lines drawn from one to another. I've tried to set domain=0:2200 for both ...
1answer
2k views

TikZ: Replacing the values (labels) on x-axis with names

I managed to create a simple linear plot with pgfplots-manual (chapter 4.5.1) Now I want to replace the values of x-axis (1,2,3,4) with text, e.g.Test A, Test B, Test C, Test D. How can I do such a ...
1answer
147 views

How to draw the graph of function x+y=100

Following is the code for drawing the graph of x+y=4. Now i am thinking to draw the graph of x+y=100 for that what are the necessary changes in the given codes. \documentclass[12pt,a4paper]{article} \...
1answer
306 views

Creating performance profiles

A performance profile is a kind of plot used in the optimization community; here below is an example from http://www.gamsworld.com/performance. For an introduction, see Section 22.4 of Higham and ...
1answer
83 views

Graph with multiple Y axes

How do I create a graph multiple Y axes(more than 2) stacked one over the other with a common X axis? See attached figure. Each zero in y direction represents the beginning of new y axis.
3answers
219 views

How to do a chart with stacked bars, lines and “sections”

The problem I need a chart like this (this was made in Libreoffice + some gimp): Its caracteristics are bassically: Some stacked bars (if it is a stacked area, better) with its Y axis at the ...
2answers
3k views

Draw polarized light

I was trying to draw something like that Searching through the net to see if it already exists in tikz I came accross in texample.net the following image which looks a lot like what I want to draw. ...
3answers
4k views

How can I make plots with TikZ which look like the new Mathematica 9 plots

The new Mathematica 9 is out! I would love to know how to make similar plots to the one's advertized, particularly the following: and Here is a simple plot to get started. %& -shell-escape \...
1answer
373 views

Plot with magnifying glass, with a different plot in it

I would like to magnify a function plot, but in the magnified area I would like to draw a different plot. As an example, I edited an image taken from another discussion on TeX Stack Exchange I have ...
1answer
4k views

Plot non-continuous function with TikZ

How can I plot a non-continuous function with TikZ (using continuous lines for continous stretches of the function and dashed lines for discontinuities)? Does anybody know an efficient method?
4answers
2k views

What is the easiest way to plot a function and its tangent lines at the turning points?

I want to plot graphs like this and embed them as Tikz or Pstricks code in my handouts. I know that there are software such as Ipe, LaTeXDraw etc. But none of them can satisfy me. Because Ipe doesn't ...
2answers
559 views

How to draw this particular Mexican hat potential?

I know there are some other mexican hat questions here, but none of the answers seems complete to me. I would like to draw the following figure with TikZ with similar axis and labeling. How can one do ...
2answers
699 views

Plot basic complex transformation in LaTeX

I want to first draw a shaded region on a xy-plane: 0≤x 0≤y≤π and then the image of the above region mapped onto a uv-plane by the transformation f=exp(z), i.e. the shaded region: exp(0)...