{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

8
votes
1answer
1k views

PGFplots skip the first row of a table on which there are NaN values. Why?

Suppose to have a file .dat like this: -4.8767000e+000 -2.9142000e-001 NaN NaN NaN NaN -3.9017000e+000 -4.1404000e-001 NaN ...
4
votes
0answers
1k views

Problems by enlarging tex memory [closed]

I have a problem with the tex memory while using pgfplots and a very huge dataset in Ubuntu. Under Windows with MikTeX I have the following settings and the texfile compile without any problems: ...
8
votes
3answers
1k views

Cut-off cone in TikZ

How would I draw the following cone using TikZ? I have no clue how to incorporate the "cut-off". I want to draw a picture of the cone given by the points (y, t) for y in R^d and t in (0, infty) such ...
12
votes
3answers
2k views

PGFPlot - Missing values in table data

I am using PGFPlot with external table data. However, some values are missing for some plots. This causes data in column 2 does not exists error. Is there a way to solve this. The value does not ...
5
votes
1answer
307 views

pgfplots axis descriptions from file

I was wondering if there is any way to make pgfplots read the xlabel and ylabel from a file. This is similar to this question Using Labels from a File in PGFplot but I'd like to read the column ...
5
votes
1answer
1k views

How to fill area under plot using a color map?

I have one diagram showing a function f(x,y) like imshow does, and a second diagram that shows the probability distribution P(f). Find below an image of the situation. The code for the plot at the ...
1
vote
2answers
418 views

baseline of custom marks in pgfplots

I'm trying to plot some intervals with pgfplots and wanted to use a custom mark for upper and lower bound. I planned doing this by using a "V" for the upper bound and a "^" for the lower bound ...
3
votes
1answer
721 views

pgfplot: Pin drawn on top of ybar stacked plot

I need to label some components of a stacked bar plot in pgfplot, and I would like the pin to be visible to the center (rather than the edge). I believe it is currently being drawn to the center of ...
7
votes
2answers
324 views

How to emphasize within a listing two successive identifiers separated by a space?

I have this pgfplots code that I want to put in a lstlisting environment: \pgfplotsset{ every axis x label/.append style = { font = \small }, every axis y label/.append style = { ...
12
votes
2answers
4k views

Drawing curves and multiple y-axes in one plot with pgfplots

I'm aware of the possibility given by pgfplots to have two y-axes, one on the left and one on the right with two different scales. But I'd like to explore other ways to have multiple axes, e.g. ...
4
votes
1answer
744 views

pgfplots: stacked plots using absolute values instead of relative

I would like to use absolute coordinates instead of relative values when using a ybar stacked plot. Is this possible? I know I can just reformat my data to be relative, but it sounds like pgfplots ...
10
votes
1answer
8k views

Problem plotting histogram using pgfplots package

The following code plots a histogram using pgfplots. \documentclass[a4paper]{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \centering ...
1
vote
3answers
1k views

Tikz Axis with colormap bounding box does not align with other bounding boxes

My last question here was concerning tikz-axis aligned with centered other pictures. I received a very good answer. This question is similar but extends the question by a colormap as in the given ...
7
votes
1answer
6k views

How to create a bar chart in which the y-axis is expressed in percents?

Suppose there is a chart like the following: This chart was created using the code: \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
4
votes
2answers
884 views

Rescaling ticks

I have created a simple 2D plot from a table (xy-data) and now I would like to both translate and scale the x-axis. (I would prefer not to scale the actual data only the axis). As an example, let's ...
6
votes
1answer
915 views

How to fix a contour plot at top of a 3D box

I want to fix a contour plot at the top of a 3D box. The following code sets the contour plot to the base: \documentclass{scrartcl} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} ...
3
votes
1answer
2k views

smooth surface plot with pgfplots/gnuplot

i want to create a smooth surface plot with pgf-plots and gnuplot. The following code yields a graph, but i need much more gridpoints along y-direction. How can i reach this? The increase of samples ...
2
votes
1answer
1k views

Tikz Axis bounding box does not align with other bounding boxes. What can I do?

I want to place a lot of pictures and plots in a long document. By now, I am using figure-environment with center-environment, but the tikz-axis-plots didn't align well with included eps-pictures or ...
12
votes
1answer
4k views

Default color pgfplot

I noticed that when using pgfplots to make plots without specifying style, it automatically assigns the same color and line style to the first input and fifth input, which means the two curves would ...
1
vote
1answer
3k views

Pgfplots: Linewidth when using \ref in custom legend

I'm creating a custom legend for some pgfplots graph by drawing a node containing a shortstack. Inside the node I'm using \ref{} to insert correct line-styles in front of my text labels. The problem ...
5
votes
2answers
2k views

Fill area of curve above a line using pgfplots

This question is related to Fill between two curves in pgfplots. which started me of. However, I need to have just the area above the reference line filled. \begin{tikzpicture} ...
3
votes
1answer
635 views

When using pgfmathparse to offset plots, how can I remove the extra tick?

I plot a few data sets into the same chart using pgfplot and I therefore use \pgfmathparse to offset every plot a bit to the left or the right. I found out that the first plot will always be the ...
2
votes
1answer
2k views

pgfplots and figure centering

I'm wondering about a way to exclude the axis labels and axis graduation from how latex will center the figure with respect to the caption. Labels and graduation along the y-axis (assuming it lies on ...
0
votes
1answer
760 views

xlog scale with pgfplots for random x-values

in the code below, two things should be modified: xlabels and xgrid should appear for x=10^-0.1, x=10^0 and x=10^0.1 only the grid along the x-axis should reflect the logarithmic scale (ie, not ...
5
votes
2answers
4k views

Get default colored plots with “no markers” command in pgfplots

I want to plot several curves with a \foreach command in pgfplots. I don't want any markers, and I can't find a way to get colored plots without markers in a \foreach loop. Using no markers gets rid ...
1
vote
1answer
610 views

use the coordinates of an axis tip with pgf plot

here's a drawing I just made (the sine function are replaced by external datas) \documentclass[12pt]{article} \usepackage{pgfplots} \usepackage{tikz} ...
17
votes
2answers
6k views

How to combine fill and pattern in a pgfplot bar plot?

Is it possible to combine a TikZ pattern with a background of a chosen color? \addplot[black,fill=yellow,pattern=north east lines] ... yields bars which have black stripes on white (transparent?) ...
6
votes
1answer
4k views

PGFplot to occupy full \linewidth, and aligned y=axis across tikzpicture

How do I get the tikzpicture to occupy the full \linewidth, and also have the left and right axis aligned? I suspect that some \phantom spacing applied to the tick labels will do the trick, but don't ...
0
votes
1answer
805 views

PGFplot Dimension too large/TeX Capacity Exceeded after reduction in domain and range

In trying to graph the intersection of 3^x and x^3, I was shrinking the domain to properly show one of the intersections. However, once I reduce the domain, I get either Dimension too large, or TeX ...
2
votes
1answer
357 views

pgfplots and final size of the externalized pdf image

I have the following piece of code: % command: pdflatex --jobname=try-f1 try.tex \documentclass[12pt]{book} \usepackage{tikz,pgfplots} \pgfplotsset{compat=newest} \pgfrealjobname{try} ...
6
votes
1answer
313 views

ytick=\empty not working with semilogyaxis

see what's below. I can't compile it. It works with xtick=\empty though. \documentclass[12pt]{book} \usepackage{tikz,pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} ...
5
votes
1answer
872 views

tick removal with pfgplots

To remove the ticks of a figure (and not the tick labels), I could only find the opacity trick, that I find odd. Is there any better way? \documentclass[12pt]{book} \usepackage{tikz,pgfplots} ...
6
votes
1answer
958 views

How can I use \foreach in an axis environment of pgfplots?

I'm having a pretty weird issue with TikZ and pgfplots. I want to have a legend driven by a \foreach variable, but TikZ won't let me do that. I tried a couple of different stuff and realized that ...
4
votes
1answer
818 views

In PGFplots, how can I have arrows as markers for plots in order to have them appear in the legend?

In my plot, I want to indicate the direction of a graph with arrows. Usually, I would just create something like this: \begin{tikzpicture} \begin{axis}[ axis x line=center, axis ...
6
votes
1answer
1k views

Using 'semilogyaxis' with 'groupplot' in PGFPlots

Using groupplot library of PGFPlots, the command \nextgroupplot can take the parameters that \begin{axis} used to take. So giving it the option "ymode=log" should effectively make the plot a ...
14
votes
2answers
1k views

Use first row of a table as legend entry in pgfplot graph?

I'm using pgfplots extensively and I'd like to avoid having to write legends every time, since all the text files I want to plot have explicit headers. As a comparison, \pgfplotstabletypeset makes a ...
4
votes
1answer
314 views

More: Generalised: Accessing the logic values of a TikZ coordinate

This is a follow-up question to: Generalised: Accessing the logic values of a TikZ coordinate. In that question a PGFplot answer was suggested by jake. I took that answer and modified it to the ...
5
votes
3answers
2k views

A problem with “Tikz + Gnuplot”, set terminal table

When I use Tikz to plot a function. I followed the instruction to use gnuplot to do so. I did that half year before. But now when I recompile, the gnuplot has problem with the first line of its ...
3
votes
1answer
306 views

pgfplots ycomb width

Is there a simple way to control the width\thickness of the strokes in the ycomb/xcomb commands proposed in pgfplots? Or should I dive into the source code to clarify?
2
votes
1answer
964 views

How to correct for a xshift in the pgfplot legend?

Using the following example code: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel=$x$, ...
3
votes
1answer
2k views

Log color bar/meta data in PGFPLOT

I'm trying to create a 2D plot with a color map using pgfplots. I've managed to get the overall behaviour that I want, but I would like the color map to be logarithmic, rather than linear. The best ...
17
votes
3answers
6k views

Pgfplots with custom axis markers

Assume you have a trigonometric function, say for simplicity sin(x). When plotting the function, how can one place the x-axis markers on 0, pi/2, pi, 3pi/2, 2pi, instead of the default numeric values ...
4
votes
1answer
252 views

Change “<” to “<=” in pgfmath's and function

I am using this method for Defining a Piecewise Function for PGFplots and want to specifically define the function value at the endpoint to be 1, not 0. When I change the < in the and to <= I ...
1
vote
1answer
85 views

Equivalent of \providecoordinate?

I am looking for something that is the equivalent of \providecoordinate in TikZ/PGFplots. This would be easy if I knew how to test if a coordinate is already defined. There are similar questions ...
1
vote
1answer
976 views

Fill a quadrant with PGFplots and axis equal=true

I need to fill quadrant three and want to use axis equal=true. However, using this setting changes the minimum value of x. How do I adjust this to fill the entire quadrant independent of axis ...
10
votes
1answer
3k views

What “smooth” plot interpolation algorithm does pgfplots use?

In the pgfplots manual it says: \addplot+[smooth] Smooth plots interpolate smoothly between successive points. In order to choose the right sampling of points from a function evaluation for ...
9
votes
1answer
843 views

How determine slope of straight line (with auto scale of axis) in PGF plots

I want to allow automatic scaling of the axis (so don't want to set axis equal=true), and be able to place a label on a line at a manually chosen point along the line. Of course if axis equal=true, ...
8
votes
2answers
3k views

Is is possible to rotate text using nodes near coords?

I'm plotting a ybar, and nodes near coords is ugly. Is it possible to rotate the text above the bars by 90? \begin{tikzpicture} \begin{axis}[area legend, legend pos=north west, legend columns=4, ...
17
votes
1answer
2k views

How can I draw a chart in the economist style with pgfplots?

I am trying to draw a chart with "The Economist" style. With tikz, I draw this chart clumsily, so I would like to know is that possible to draw this chart elegantly with pgfplots. ...
5
votes
1answer
1k views

How do I name a plot in tikz and use it for intersections?

I want to create a figure with 3 plots, a vertical reference line, and marks at the intersections of each plot with the reference line. The plots come from an external table. Plotting works, but ...