{pgfplots} is a package for creating 2D and 3D plots of mathematical functions and numerical data, using the PGF graphics framework. For questions about the inbuilt plotting functionality of TikZ/PGF, use {tikz-pgf} instead.

learn more… | top users | synonyms

4
votes
1answer
52 views

Problems with pgfplot and multiple graphs

I've been trying to do this there's a few days and the following code was the best that I got until now. This is supposed to be one graph; Because I say axis y line=none the last three "blocks" of ...
3
votes
1answer
81 views

How to approach the drawing of this sort of scatter plot?

I'm trying to plot a data set that contains the results of some benchmarks across a number of tools on a set of input files. The problem is that there are more than 3000 test cases and I need to ...
3
votes
2answers
103 views

Dimension too large with \pgfmathsetmacro

I want to define varafterglowepsdown, varafterglowa and varafterglowb and use them in a tikz function like this: \newcommand{\varafterglowepsdown}{0.0001} ...
1
vote
1answer
61 views

How to draw stacked area chart

I want to plot a stacked area chart. Stacked area chart => All values get stacked and the areas under the lines get's colored. Something like this: My data in a minimalistic example: ...
2
votes
1answer
41 views

Forget used ticks

This is a follow-up question of pgfplot dateplot discrete dates on axis, which is answered by Peter Grill. The solution for plotting discrete dates is to use only unique dates. However, when making ...
4
votes
1answer
50 views

Producing x and y-intersections automatically

How does one produce a picture of a function (say, a polynomial) and indicate the $x$- and $y$-intercepts automatically? I have some code that produces 1 of the $x$-intercepts and the $y$-intercept, ...
2
votes
1answer
41 views

How to add two waveforms in pgfplots

In my example code given below, I have two plots. I wanted to add a third and fourth plot that is the sum and then product of the original two plots. Is there a simple way to do this in pgfplots? ...
3
votes
1answer
87 views

Bar diagram strange behaviour

My code is: \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[title = some title, xbar, y axis line style = { opacity = 0 }, ...
4
votes
2answers
41 views

Alignment of nodes with \addplot table

In the MWE below, I would like the nodes to align vertically. Giving them the same pos doesn't seem to do that. I can try to align them by adjusting the pos using trial and error but this is tedious, ...
4
votes
1answer
62 views

pgfplots layer issue

I'm trying to define my own layer set which enables plots above gridlines, but below the axis lines, ticks, etc. I've made the MWE based on chapter 4.27.2 of the pgfplots manual. However it's not ...
3
votes
0answers
90 views

Position of y axis with pgfplots

I am currently trying to create a plot with pgfplots and can't seem to properly position the y axis like I want to. Here's my MWE: \documentclass{standalone} \usepackage{pgfplots} ...
2
votes
0answers
62 views

Blurred colormap using matlab2tikz to export Matlab imagesc picture

I'm using matlab2tikz to export imagesc figures into TikZ/pgfplots code. This process gives me a TikZ file and a rasterized png version of the image with colours matching the colourbar at the time of ...
4
votes
1answer
124 views

How to create a date and time plot with TikZ and pgfplots

What I want to achieve is a graph, which shows the working hours per day. Input should be the triple of date, arrival time and leaving time. The x-axis holds the dates and the y-axis shows the working ...
7
votes
1answer
87 views

pgfplots - disable smoothness

I am using following pgfplots to draw a simple function: \begin{center} \begin{tikzpicture} \begin{axis}[ domain=-4:4, xscale=2.25,yscale=1.125, xmin=-4, xmax=4, ymin=-2, ymax=2, ...
1
vote
1answer
81 views

pgfplots ybar - how to adjust spacing between sets of data

I would like to plot some data in a bar chat using ybar. The data corresponds to years on the x-axis. Now, for some years I have three data values to plot and for others only one value. The problem is ...
1
vote
0answers
53 views

PGFPlots generates extra margin with restricted x axis and two y coordinates in standalone class

I noticed that there are cases where pgfplots package makes undesirable (to me at least) margins. The conditions I've found is as follows: use standalone class use y coordinate on the right side ...
3
votes
1answer
79 views

Scatter Plot with Marginal Dot Diagram

I want to create a scatter plot that has marginal dot diagrams. I can find plenty of help on how to construct a scatter plot with marginal histograms, but not with marginal dot diagrams. Something ...
4
votes
1answer
56 views

Misplaced nodes near coords in stacked ybar plot

I have this stacked ybar plot and having trouble to proper align the nodes near the coords. It works fine on all bar but the one with offset 65. I already tried \ifnum as @Jake suggested here: How can ...
3
votes
0answers
42 views

How to fill an area outside spheres?

The problem is the same as explained in my previous question: How to fill an area outside circles?. The only difference that now I need to fill the green area in three-dimensional space, i.e., the ...
0
votes
0answers
34 views

Regression on a portion of the graph with columns

Based on the MWE of this question, I want to apply the regression only to a portion of the graph as in this other question, but not just the last portion. I want to do regression on the beginning so ...
1
vote
1answer
40 views

Change xlabel and remove title from pgfplots plot

I got the Tex file. But it is not compiling due to error \pgfplotsset{width=12cm,compat=1.12}. A minute change I want. A graph is all right but I want to replace the caption of X- axis namely " ...
6
votes
1answer
100 views

PGFplots: Logarithmic scale showing 1020 insteead of 1024?

I am trying to make a plot with a base-2 logarithmic axis and everything is turning out great, except that the labels are 32, 64, 128, 256, 512, and 1020. The last one should be 1024. I assume that ...
0
votes
1answer
70 views

Drawing a graph in latex? [duplicate]

I need help with this code It is my first time using latex \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{graphicx} \usepackage{listings} \usepackage{pgfplots} ...
4
votes
1answer
48 views

pgfplots ignores xmin/xmax with 'axis equal' option

It seems that if I set axis equal option with pgfplots, the xmin and xmax options are not obeyed. The MWE below yields: Note that the ymin and ymax are as desired in both cases, but the limits on ...
8
votes
2answers
260 views

How to fill an area outside circles?

I have the following code: \documentclass[tikz,margin=15pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \usetikzlibrary{pgfplots.fillbetween} \begin{document} \begin{tikzpicture} ...
4
votes
1answer
130 views

Drawing function in tikzpicture

I have to draw function with \plot but it says "Dimension too large", this is my code: \begin{tikzpicture} \begin{axis}[grid=major, xmin=0, xmax=3, ymin=-1.5, ymax=1.5, xlabel=$t$, ylabel=$x(t), ...
27
votes
6answers
2k views

Given a list of primes, how can I plot π(x)?

Given an arbitrarily-long list of primes (or any sequence, I suppose), I'd like to calculate and plot the pairs (x, count of numbers in my list less than or equal to x) Bonus points for skipping ...
1
vote
1answer
44 views

Axis lines=center and label placement together with compat=newest

Consider the following example: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{ axis lines=center, %compat=newest } \begin{document} \begin{center} \begin{tikzpicture} ...
1
vote
1answer
63 views

pgfplot discrete integers on axis

With pgfplot when plotting data over a small range of integers, some integers are shown multiple times to "fill" the horizontal axis. I wonder if it is possible to show only discrete integers. Since I ...
1
vote
1answer
60 views

pgfplot dateplot discrete dates on axis

With pgfplot using dateplot when plotting data over a small date range, some dates are shown multiple times to "fill" the horizontal axis. I wonder if it is possible to show only discrete dates. Since ...
2
votes
2answers
45 views

annotate plot with linear line

In my code below, I wanted to add a linear dashed line like this: Here is my code: \documentclass[varwidth]{standalone} \usepackage{filecontents} \usepackage{graphicx} \usepackage{tikz} ...
1
vote
0answers
32 views

y-label shows up twice in pgfplot when the bm package is used?

Can you tell me if it is possible to remove this extra y-label so that it looks cleaner? In my code below, I get the y-label showing up twice like: Here is my code: ...
1
vote
1answer
66 views

TeX capacity exceeded using pgfplots with/without externalization

The following MWE compiles (for me) \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{external} \tikzexternalize[prefix=figures/externalized/] ...
4
votes
1answer
45 views

justify legend enteries in pgfplots

I wanted to know how I can go about left aligning the legend enteries in my pgfplot. This is the effect I would like to have: Here is my code: \documentclass[tikz]{standalone} ...
5
votes
3answers
304 views

Plot a transfer function in latex

I wanted to know how I can go about plotting a simple bode magnitude transfer function in LaTeX. This is the function that I would like to have the Magnitude response plotted: Be aware that the ...
7
votes
2answers
246 views

How do I color in two different colors one square function?

I need to color every other line of this same function in orange and make it dashed, but this is only one square function, so can anyone help me?
2
votes
1answer
30 views

How to align subscripted annotations with axis labels in pgfplots?

This question is a follow-up to my earlier question about how to align annotations with axis labels in pgfplots. The accepted solution works perfectly, but I've run into a further alignment problem ...
2
votes
1answer
42 views

Undefined control sequence. \end{axis}

I am using TikZ to draw plots in LaTeX \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} %\usepackage{pgfplotstable} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} ...
2
votes
1answer
33 views

Place arrow and text at specific point in a pgfplot

This code is building off the solution posted here. How do I go about adding an arrow and text like this to the second plot: Here is the code: \documentclass{book} ...
2
votes
1answer
25 views

Fill area above and below lines in pgfplots

In the code below, when I try to implement the soft clip command \addplot [red, fill opacity=0.1] fill between[of=C and D,soft clip={domain=0:0.6336}], my output file comes out blank showing just the ...
3
votes
1answer
39 views

restrict y to domain “cuts” up plot

In my code below, my plot shows up like: It is not a continuous plot as the restrict y to domain=-500:500 deletes some of the points to cause the plot to look like the way is does. Is there a work ...
5
votes
1answer
41 views

Move position of y-axis label and legend in pgfplots

I would like to move one of the y-labels to the second group of plots on the right and legend more to the center of the plots as shown here: Here is the code: \documentclass[11pt]{book} ...
4
votes
1answer
112 views

Change thousands separator in pfgplots' ticklabels to space

I am sure that I am repeating an old question, but I couldn't find it in the Tex Exchange browser. I am using french mathematics nomenclature and thousand separation is a space like this 1 000 and ...
3
votes
1answer
62 views

pgfplots legend with two ordinates (lines and bar chart)

In the legend, I would like to have a line for the red and orange lines (as it is the case), and ybar legend style for the rest. I just can't figure out the easiest/best/any way to do it. MWE: ...
2
votes
1answer
40 views

Insert border to area under plot part 2

This question builds from the question posted here. How can I get the plot to show up in red in the region between the shaded region like this: Here is the original code: \documentclass{book} ...
3
votes
1answer
35 views

Insert border to area under plot

This post is building from the post found here. How do I go about adding a border to the shaded area under the curve to look like this: \documentclass{book} \usepackage{tikz} \usepackage{pgfplots} ...
0
votes
1answer
20 views

Change y-axis limits in pgf groupplots

This post is building from the post found here. How do I go about changing the y-limits of all the right hand side plots to a ymin of -160? Here is my code: \documentclass[11pt]{book} \usepackage[% ...
5
votes
1answer
83 views

Error 'thisrow_unavailable' with manually positionned (anchor) labels in 'tikzpicture' plot

I want to set labels with manual anchors in my graphic to allow for reading the captions and am trying to apply everything I've read so far. I have an external file for data, given below. The problem ...
7
votes
1answer
188 views

What's the relation between packages PGFplots and TikZ?

I've constated that I can use tikzpicture even if I comment \usepackage{tikz} out, as long as I keep \usepackage{pgfplots}. Isn't tikzpicture provided by package tikz? In which situation should I load ...
1
vote
1answer
61 views

How to highlight a region in a Pgfplots graph based on an axis' values?

I want to highlight the region where the two measures below, represented with dots and error bars, agree: This is the code I'm using: \documentclass[a4paper,10pt]{book} \usepackage{tikz} ...