{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

3
votes
1answer
49 views

Adding a trend line to a bar chart

I'm very new to LaTeX, preparing my very first document in the environment and learning on the way. I've encountered a problem with one of my plots - I'm trying to add a trend line to a bar chart to ...
3
votes
1answer
51 views

Runaway argument using int() function in pgfplots

The MWE below yields Runaway argument? 3\pgfflt@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok \ETC. ./TeX-SE.tex:29: Paragraph ended before \pgfflt@readlowlevelfloat was complete. ...
3
votes
1answer
85 views

Plots large number of data

As you all know, TikZ has to face the limits in terms of memory, that is given by the TeX compiler. For most of my plots, I have a maximum time step of around 1us and I record several waveforms over ...
3
votes
1answer
72 views

How to project nodes created by relative position on curve to axis and below?

In case I have two curves created with pgfplots I can draw a line between two relatively positioned nodes on each. In this example there is an arrow between the points at 50% of each curve. ...
3
votes
1answer
70 views

Using a character as mark in pgfplots

I have a scatter plot in pgfplots which shows dots in 4 different colors belonging to 4 different sources. I would like to use a character (e.g., "A") instead of a circle as the marker. For instance, ...
3
votes
1answer
49 views

Add nodes with pgfplots

I was trying to add nodes inside axis environment but nothing came out. I actually tried several ways... Any help is much appreciated. \documentclass[11 pt, a4paper]{article} ...
3
votes
1answer
139 views

How to draw and label a vertical line from datapoint to x-axis in pgfplots

I have the following figure that consists of only four different values of $x$. Each of these $x$ values corresponds to a certain dataset and I need to label it in the figure. Therefore, I want to ...
3
votes
1answer
80 views

Adding nodes to line segments

\documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepackage[active,float]{preview} \usetikzlibrary{calc} ...
3
votes
1answer
63 views

Why are my symbolic x coordinate labels printed twice in a tikz plot?

I'm trying to plot a bar graph, using symbolic x coordinates. For some reason, the name of some symbolic coordinates appears under the x axis more than once. If I increase the width (e.g. 12cm) ...
3
votes
1answer
78 views

Specifying markers in tikzpicture

I have the following chart...the below code won't build without the data files, but an image follows \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{figure} ...
3
votes
1answer
96 views

How to add one single legend entry for several plots?

How can I create a single legend entry for 4 plots at the bottom of the group of plots?. Something like this: Title Title -------------- ---------------- - ...
3
votes
1answer
93 views

Adding error bars to pgfplot with coordinate o

I'm just starting out with pgfplots, and am not overly steeped in Latex in general. I have the following, which isn't all the way there (I need to expand the width the accommodate the legend for ...
3
votes
1answer
109 views

When using pgfplots, I receive an error of “ Missing { inserted.” when using the fillbetween package. Why does this error show up?

I've been using pgfplots to generate images in my homework for a modelling course. I've been receiving the error below and I can't seem to locate it in my code. Missing character: There is no ; in ...
3
votes
1answer
69 views

Apply same options to multiple `addplot` in pgfplots

Can I apply the same options to all addplot's in a single axis environment in pgfplots? For example: \begin{tikzpicture} \begin{axis} \addplot[%plot 1 color = red, ...
3
votes
1answer
82 views

How to plot this histograms as a line graph?

Let's say I have this histogram plot: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ symbolic x coords={a small bar,a medium bar,a large bar}, ...
3
votes
1answer
154 views

pgfplots + gnuplot: how to clean up the look of a contour plot generated from raw gnuplot data by using a colour bar?

Here's a MWE: \documentclass[12pt,letterpaper]{article} \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} ...
3
votes
1answer
133 views

pgfplots, axis limits and axis equal

I would like to apply the axis equal option and scale the y-axis from 0 to pi. Unfortunately both is not working with the minimal example provided below. The output still contains white filled space ...
3
votes
1answer
56 views

Why are my marks not drawn?

I'm somewhat stumped by the following simple plot at the moment. I expected three black marks to be drawn. Instead, I see no points being drawn (only the axes). This is based on old code, so I'm ...
3
votes
1answer
144 views

adding single points to bar figure in pgfplots

I have a bar plot, in which I would like to add some single points overlayed on the bars. Those points are in another scale compared to the error bars. Below, I'm illustrating those single points in ...
3
votes
1answer
120 views

tikz, pgfplots and polaraxis

I found a nice template for a polar graph 1 and I adjusted it as follows: \documentclass[12pt]{standalone} \usepackage[x11names]{xcolor} \usepackage{tikz} \usepackage{pgfplots} \begin{document} ...
3
votes
1answer
205 views

Undefined control sequence: \pgfmath@multiply@thousand [duplicate]

After updating my MiKTeX distribution, I suddenly got a compile error with a .tex file that compiled perfectly fine before. After removing everything that did not contribute to the error, I ended up ...
3
votes
1answer
115 views

Appending arbitrary code to a pgfplots axis environment before curve and axes are drawn

There was some confusion about what I really wanted, so I include the actual use case here. The MWE plus corresponding picture is at the bottom of the post. I made some fancy looking graph, among ...
3
votes
1answer
45 views

Disable automatic subticks on semilogyaxis plot with pgfplots

I found many questions regarding why subtics do not appear on a semilogyaxis plot. But I actually would like to not have those subticks as this adds too many ticks so that my plot looks pretty full. ...
3
votes
1answer
58 views

Providing legend for pre-rasterized data

I have a plot containing several million data points (real-time sensor, 50 samples/s, multiple channels, 5 hours). To keep the file size of my document down, I made a bare PNG with the line graph in ...
3
votes
1answer
196 views

PGFplots: Can I do vector addition/substraction?

I'd like, in the following MWE, to draw a vector from P to P+v and to P-v for some given point P and directional vector v in the axis coordinate system of a pgfplot. Can it be done? ...
3
votes
2answers
324 views

How to enable minor y ticks for a logarithmic axis

I am using pgfplots to create some plot with logarithmic axis. But Latex automatically shows minor y ticks for some of them and doesn't show them for the others. Here is an example (when I increase ...
3
votes
1answer
148 views

Combining surface plot, explicit colour and legends in pgfplots

This question is a result of this one. I would like to make a surface plot using tikz/pgfplots using explicit colour and including legends. Is this possible? I have gone through the entire manual for ...
3
votes
1answer
116 views

Choosing the bar size with symbolic x coords option

When I use both "bar width" and "symbolic x", pdflatex gives me the following error message: ! Package pgfkeys Error: I do not know the key '/pgfplots/bar width' and I am going to ignore it. ...
3
votes
1answer
68 views

Problem with plot using pgfplots

I'm trying to plot the exponential function using pgfplots, but no matter what I change, I get only a part of the plot. Here's the code (the code and the image were made using exp(0.25x) instead of ...
3
votes
1answer
109 views

Clipping plots to other plots in pgfplots

I'm plotting a convex frame as shown below, with the given MWE. Inside this frame, the idea is to plot additional functions to create an image. In order to avoid manually computing the domain ...
3
votes
1answer
255 views

\addplot3 in pgfplots plots data beyond axis limits

When using pgfplots for a 3D graph and reading the data from a table, is there a way to truncate the data at the axis limits specified in the axis environment ? Here is a MWE: ...
3
votes
1answer
220 views

How can I mark a point in a pgfplot and make sure its visible (on top of the plot)?

Recently, I have TikZ'ed the following image for Wikipedia (see file) I would like to mark the green dot like it was done here: I've tried a couple of different things, but no matter what I did ...
3
votes
1answer
109 views

Error cross-referencing when tikz mode is graphics if exist

I am getting the error "Undefined control sequence" when using \tikzset{external/mode=graphics if exists} and the label does not exist (It should produce a warning not an error, though because the ...
3
votes
1answer
158 views

pgfplots: Adding additional lines to a graph

I did an ANOVA with 4 tests. Result graph is shown here, original code comes from: TikZ: Replacing the values (labels) on x-axis with names \documentclass[12pt]{article} \usepackage{pgfplots} ...
3
votes
1answer
48 views

pgfplots@y@inverseveclength ->infty

I'm experiencing problems with pgfplots. The following piece of code was automatically generated by a piece of software I'm working on. \documentclass {standalone} \errorcontextlines 10000 ...
3
votes
2answers
84 views

Using \foreach to generate functions

I wish to plot a function based on collection of simple functions. For instance, the maximum of some functions: \begin{tikzpicture}[] \begin{axis} \addplot[smooth, color=black] { max( 2*x, ...
3
votes
1answer
150 views

Move ylabel up/down in pgfplots

I'm creating a graph with pgfplots with two y-axes, one on the left and one on the right. I'm wondering how to move the ylabels up or down to vertically align with the middle of the tick marks: ...
3
votes
1answer
731 views

Package pgfkeys Error: I do not know the key '/tikz/y error plus index'

I am having trouble compiling the attached mwe. I receive the following message: "Package pgfkeys Error: I do not know the key '/tikz/y error plus index' and I am going to ignore it. Perhaps you ...
3
votes
1answer
220 views

Stacking plots in animation using fill between library (with dynamic calculation of intersection segments?)

As a followup question to Filling the area under a graph based on intersection with another graph, I'm looking to create the following effect: Fill based on the coordinates of the intersection ...
3
votes
1answer
171 views

Global pgfplotset messing up error bars

I have a plot with some error bars generated with this code, but the error bars are messed up. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \pgfplotsset{ every ...
3
votes
1answer
276 views

pgfplots linear regression for the wrong column

The following MWE correctly plots the Y column when it is plotted directly (black points). However, a linear regression specified for the Y column actually fits to the Z column if the Y column is the ...
3
votes
1answer
169 views

pgfplots + animate + foreach: Starting with one plot

I want to generate an animation where the number of lines increases one by one. It works very well but the start image always has two lines. \documentclass{article} \usepackage{pgfplots} ...
3
votes
1answer
211 views

Add legend to the curve from \draw

I am a new user to PGFPlots so I have the following question: I draw a ellipse in TikZ and I want to add a legend for it. However, I found the \addlegendentry is only for \addplot. Then, how can I add ...
3
votes
1answer
135 views

Bar plot in PGF plots with no upper limit

I assesed particke size distribution using sieve analysis. Now I want to present the results using PGFplots. The largest opening was 1 mm. I can plot finite intervals (e.g. 0.25 mm -- 0.50 mm), but I ...
3
votes
1answer
313 views

ybar overlaps axis line (and xtick removal)

When I use the MWE below my bar plots are overlapping partly the black x-axis How is it possible that the bar graph starts exactly above the x-axis and not on top of it? And is there a way to ...
3
votes
1answer
189 views

Adjusting pgfplots

I am having trouble controlling the axes in pgfplots. I have defined an evironment for graphs \newenvironment{graph}[3][]{\begin{figure}[htp] \def\tempa{#1} %Saves caption since \end cannot take ...
3
votes
1answer
626 views

missing tick labels for symbolic coords in second plot

I am attempting to draw two plots in the same axis environment. Both plots use symbolic X coordinates (and symbolic Y coordinates) but X values that don't appear in the first plot will not make it ...
3
votes
1answer
95 views

Same ymin in loglogscale

I want to obtain the same y axis for multiple plots. Here is a MWE: \documentclass[preview=true]{standalone} \usepackage{pgfplots} \begin{document} \begin{preview} \begin{tikzpicture} \begin{axis}[ ...
3
votes
1answer
601 views

Errors when plotting a bar chart

This is my crude attempt to create a graph from copied example. I want to plot the diseases on the Yy axis and QoL scores on x axis. It has resulted in errors. Could anyone be kind enough to point out ...
3
votes
1answer
60 views

calling an expression in the document in pgfplot

Say I have the following function which I would like to plot. $S(z)=\frac{p.(\alpha_H+z.\alpha_W)}{p.(\alpha_H+z.\alpha_W)+\beta_H+z.\beta_W}$ While I could specify it in the \addplot command, I ...