{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

13
votes
1answer
789 views

Is there a workaround against loss of precision in pgfplots axis?

I am generating a bunch of plots automatically using pgfplots. For some datasets the span of data in one axis (y) is relatively small (relative to the absolute value) and therefore pgfplots when ...
13
votes
1answer
324 views

Climographs (climate diagrams) with pgfplots

I'd like to create climographs (climate diagrams) with pgfplots, but these graphs have some special rules (defined by Walter and Lieth about 50 years ago) for axis scaling which I have absolutely no ...
13
votes
2answers
3k views

pgfplots from file: search path, looking for \graphicspath equivalent

I have recently discovered the wonderful pgfplots package and I've started coding my Python code to output tabular data of whatever is plotted (at least for simple plots). In my LaTeX source code, I ...
13
votes
1answer
1k views

PGFPLOTS: Show x labels for every second tick

How can I show xaxis labels for every second data in this dataset. I want a bar for each tick, but not a label. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} ...
13
votes
1answer
658 views

Polar Plots - layout and extraction of crucial parameters

Let S be some sort of function, depending on direction and frequency, for example: envir. background noise. I have S defined on a rectangular grid and I wanted it plotted on a polar grid. So far I ...
12
votes
3answers
6k views

Label a single coordinate (pgfplots)

I have the following plot: \begin{tikzpicture} \begin{axis}[grmin=-5:5 -5:5] \addplot[mark=none] {x^2/4}; \addplot[mark=none] {-1}; \addplot[mark=*] coordinates {(0,1)}; ...
12
votes
3answers
785 views

Draw a cylindrical spiral with TikZ

I want to make a tikzpicture to illustrate the construction of a spiral capacitor. These are made of spiral coiled films. So imagine a rectangular paper that you tail around one side. Thats basically ...
12
votes
3answers
518 views

PGFPlots: How to draw a label at a zero of a function?

Is there an easy method to construct a node (and hence a label) at a zero of a function, i.e. at the intersection of the function with the x-axis? The examples I found were somehow too complicated, ...
12
votes
2answers
952 views

How can I create a polar plot on a Cartesian grid?

I'm currently using tikzpicture and pgfplots to plot this polar function: \documentclass{article} \usepackage{pgfplots} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{polaraxis} ...
12
votes
2answers
786 views

Can PGF plot the integral of any specified function?

How can I use the pgf maths engine to plot the integral of any function? For example \addplot {int(cos(x))} does not work.
12
votes
3answers
5k views

How can I change place of y label on pgfplots?

I want to change place of ylabel near the axes.
12
votes
2answers
2k views

pgfplots: mark max/min value of a function

How can I mark the maximum or minimum value of a function like x^2 in pgfplots? \begin{tikzpicture} \begin{axis} \addplot+[mark=none] plot {x^2}; \end{axis} \end{tikzpicture}
12
votes
2answers
5k views

matlab2tikz - TeX out of memory

I am using matlab2tikz to import figures from MATLAB to tex. However I quickly get the message TeX capacity exceeded, sorry [main memory size = 3000000]. I have tried expand main memory using ...
12
votes
3answers
1k views

pgfplots - Add offset to pins

I'm trying to make a bar plot for an optimization parameter in quantum physics. To be more informative, the graph should display the values of these parameters above the bars. So far I did ...
12
votes
3answers
3k views

Disabling the arrows that appear in pgfplots on the axes

By default in PGFplots, when axes are only shown in the bottom left corner, arrows appear at the end of the ends of axes lines. How can I change the defaults so these arrows do not appear? Edit: ...
12
votes
2answers
5k 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. ...
12
votes
1answer
1k views

pgfplots: auto-size chart?

I have an xbar graph with some some data that I don't necessarily know the length of beforehand. Is there some way I can tell pgfplots to automatically expand the height of the chart according to the ...
12
votes
1answer
6k views

pgfplots line colors

Is it possible to make pgfplots use a predefined color map while plotting multiple lines, I currently have 9 samples that I want to plot, but don't want to type different colors for each one. Right ...
12
votes
2answers
6k views

Positioning a tikz scope relative to another tikz scope

In the manual of PGFplots on page 333 the author describes how to position an axis environment relative to another axis environment: \begin{tikzpicture} ...
12
votes
1answer
2k views

How to plot the first n rows of a table using pgfplots?

When using pgfplots, is there a way to plot only the first n rows of a given table ? Considering the following MWE file: \documentclass[tikz]{standalone} \usepackage{tikz} \usepackage{pgfplots} ...
12
votes
2answers
517 views

Derivative of a tikz path?

I would like to draw curves that are smooth and have linear segments. These curves are to be used in the graph of one-dimensional functions, x(t). [To be used as position vs time graphs in writing ...
12
votes
2answers
3k views

Is it possible to multiply the x coordinates of a plot by a certain factor using pgfplots

I have a pgf plot. Now the scale on the x-axis is at the moment frequency, hz, but it should be rad/s to save myself time exporting the file again is it possible to multiply the x-coordinate of every ...
12
votes
1answer
950 views

How to jam the axis of a pgfplots plot?

I need to have some kind of jump on the axis of the plot in pgfplots package. Something similar to the following figure where some part of the scales are jammed. It would be interesting to have ...
12
votes
1answer
6k views

pgfplots using strings *from data table* as x axis labels in bar chart

I've seen some of the other threads on using strings as x axis labels, but nothing that fits my situation. I'm trying to create a bar chart from a CSV file. I can do it so long as everything in the ...
12
votes
1answer
2k views

Is it possible to change the color of a single bar when the bar plot is based on symbolic values?

I am beginner in LaTeX, trying to use it for industrial documents. I wonder if there is a way to change the color of only one bar of the plot below, ie "TestDetails", to illustrate it is a local macro ...
12
votes
1answer
4k views

plot within a plot: zoom into a plot so that the magnified part is framed by axis with ticks and tick labels

I want to zoom into a plot much like it is possible by using the spy library but I want the spy-in node to contain its own ticks and tick labels with a finer grid than the original plot. To clarify ...
12
votes
1answer
451 views

nodes near coords with logarithmic axis: Wrong values

I created a horizontal bar plot to compare benchmark times. Since one of the tested components is really slow, I need a logarithmic y axis for the other values to be distinguishable. Combined with ...
12
votes
1answer
2k views

Stacked barplots/groupplots with text labels in x-coordinate

I was trying to stack a groupplot, or was it grouping a stacked plot? However I was trying to get something like: The ybar stacked option works quite nice here. But when I try to adapt it to a ...
12
votes
2answers
6k views

Pgfplots - ugly marks when using dotted or dashed line [duplicate]

Recently I spotted that applying the option dashed or dotted to a plot results in having ugly / distorted marks or marks with dots (when applying dotted) around them. Here is a MWE: ...
12
votes
1answer
298 views

Pgfplots dynamic opacity

I'm trying to add multiple plots on one axis and I would like them to have different opacities (e.g. 0.1, 0.2 etc.). I have tried with different options: The only thing that actually compiles is ...
12
votes
2answers
227 views

Question on interpretation of a pgfplotsset

I am trying to understand the following code: \pgfplotsset{ discard if not/.style 2 args={ x filter/.code={ \edef\tempa{\thisrow{#1}} \edef\tempb{#2} ...
12
votes
1answer
4k views

How to remove ticks from the top and right axes of a plot generated with PGFPlots?

I want to remove ticks from the top and right axes of the bounding box of a plot generated with pgfplots. Any help appreciated. Here is sample code which generates unwanted ticks. ...
12
votes
2answers
3k views

Pgfplots axis, option to remove (or ignore) legends

Is there an option in pgfplots at the axis level or a setting of legend style option, that would effectively ignore the subsequent legend entries in the plot? \documentclass{article} ...
12
votes
1answer
1k views

pgfplots: How to ignore the last line of a data file?

I need to plot data files which contain a comment in the last line, like this: 0 2 4 1 5 7 2 9 5 3 11 15 4 10 15 THIS WAS: TOTAL Now, pgfplots seems to have a problem with that giving me ...
12
votes
1answer
5k views

Trend line or line of best fit in pgfplots

Is there an "out of the box" way to automatically draw the trend line in pgfplots? Below follows a basic illustration of a scatter graph with a line of best fit:
12
votes
1answer
2k views

Multiple Files input to one pgfplotstable

I have several data files that I would like to combine into one table using pgfplots table. Specifically, I would like to use one file to set the first three columns and then have each data file fill ...
12
votes
1answer
4k views

multiple legends in pgfplot

The problem: I have plots with 8 lines, and need to put the legend for all 8 lines into the plot. The document format is IEEE, and the plots need to fit in the single column. The current solution: ...
12
votes
1answer
721 views

Visualize singular vector fields with TikZ or PsTricks and friends

I am trying to find a good way to make really visually appealing plots of singular vector fields. For example electric fields of point like charges. I already tried this in python without too much ...
12
votes
1answer
1k views

Why does \mathbb{R} cause '! Undefined control sequence. - \GenericError'?

When I compile the following document, I get ! Undefined control sequence. \GenericError ... #4 \errhelp \@err@ ...
12
votes
1answer
2k views

locally disable automatic ylabel rotation

Ordinate axis labels are rotated by default. This is not useful in case of short, single letter labels such as $\phi$. How can I suppress rotation easily in a given plot? I couldn't find anything ...
12
votes
1answer
2k views

How can I force the pgfplots coordinate system and the tikz coordinate system to match and why do they not match by default?

I plot a function with pgfplots and want to combine it with some simple \draw commands from tikz. But to my suprise the coordinate systems seem not to match. The rectangle drawn ranges from x=-10 up ...
12
votes
1answer
722 views

Tabs in output file written by xelatex and pdflatex are different

I'm trying out pgfplots with gnuplot to generate the data. This works by having pgfplots write some stuff to an external file, run gnuplot on the file, and then use the generated data to plot the ...
12
votes
4answers
1k views

In pgfplots, how to apply enlarge * limits to axis but not to grid?

I need to plot a pgfplot where the axis arrows “overshoot” the grid by 10pt. Using enlarge x limits I can enlarge the arrows, but then the grid gets enlarged too. \documentclass[]{standalone} ...
12
votes
1answer
2k views

Consistently specify a Function and use it for computation and plotting

I would like to be able to specify a mathematical function and be able to use that for multiple purposes including: Computation of values (see bullet points below) Graphing using pgfplot Graphing ...
12
votes
1answer
4k views

Non-linear curve fitting with gnuplot

I am trying to use gnuplot with pgfplots in TexShop, following on from an example by Martin H in the comments here. I can get the data points in OK, and plot them but the fit (red line) does not seem ...
12
votes
1answer
2k views

Z-Order of plots pgfplots

Simple question: I can’t seem to control the z-order (i.e. which comes in front, which comes in the back) of the plots in a 2D axis. MWE: \documentclass{article} \usepackage{pgfplots} ...
12
votes
1answer
238 views

Fractions in annotations

I want to use the \frac command in an annotation to a line \documentclass{standalone} \usepackage{pgfplots} \usepackage{amsmath} \begin{document} \begin{tikzpicture} \begin{axis} ...
12
votes
1answer
989 views

pgfplots: colorbar: align y ticklables to the right

I have a colorbar in pgfplots and would like to have the y tick labels aligned to the right. Using colorbar style={yticklabel style={align=right}} did not work for me. The left colorbar shows the ...
12
votes
1answer
837 views

Brownian motion with drift

I have a code for the Brownian motion and it indicates three paths which initially started at point 0. My goal is to increase the initial starting point from 0.0 to e.g. 0.6. This is achieved by ...
12
votes
2answers
590 views

How can I do an affine coordinate transformation in pgfplots?

It is possible to perform a general affine coordinate transformation in TikZ by combining the shift, x, and y keys (or just the generalized cm key to set the coordinate matrix and shift). This allows ...