{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
1k views

3D Arrow Tips for TikZ/pgfplots

I really like the arrow tips shown in How to get rid of the viewer's (incorrect) axes in an Asymptote 3D graphics and am wondering how to produce this in pgfplots: I admit I have not tried ...
5
votes
1answer
389 views

Embed text in pgfplots or tikz generated pdf files

I generate data plots in my LaTeX documentation using a combination of TikZ and pgfplots. Many of the plots are generated using script files which can also include the raw data if data is being ...
1
vote
1answer
286 views

Using pgfplot externalize with .eps output in letter 10cm*10cm

Using pgfplots, externalize an .avi file and using DVI>ps, externalize an .eps file on A4 but I want a figure with width and height of 10cm in letter (10cm x 10cm). How can I make it? (If you ...
8
votes
1answer
605 views

Scalar field in pgfplots

I want to make a PGF plot which, besides normal 2D graph, includes scalar field, that is values of the 2D function in various positions of the 2D graph. Of course, I tried to do that using \foreach ...
6
votes
1answer
10k views

Reduce font size and keep label position in bar chart using PGF/TikZ

I am preparing a bar chart in PGF and it is a pleasure to work with. The only problem is that I have trouble reducing the font size used to indicate the value associated to each bar. Consider the ...
8
votes
1answer
2k views

Multi-line texts in xticklabel from a File in PGFplot

I am using LaTeX, TikZ and PGFplots to generate a bar chart, in which the xticklabel is read from testdata.dat file. In the following example, the xticklabel is a single line, i.e., Big-Bed, ...
12
votes
2answers
4k views

How can a title be placed for a group of pgfplots?

Using the groupplots library in pgfplots, how can a title be set for a group of plots? The following code (basically from the manual) is an example layout. I don't want each plot to have a title, ...
3
votes
1answer
406 views

Using counter values as part of style name for plots

I figured I should be able to give a bunch of line styles and access them using counters. Sure enough, this works out fine; this document \documentclass{article} \usepackage{tikz,pgfplots} ...
5
votes
1answer
1k views

How to create the graph only once in Tikz/pgf/pgfplots

I saw Why is tikz so much slower when plotting a huge amount of data than WYSIWYG plotting tools? that pgfplots can be configured to do the plotting only once. How to do this? I have a document with ...
6
votes
1answer
6k views

Adjust size and position of a PGFplots plot

I created a 2x2 array where each box contains a subfigure. For three subplots I use \addplot3 from PGFplots with colorbar and in the other, a \addplot. Due to the use of colorbar, the symmetry of the ...
4
votes
1answer
1k views

Inserting the slope inside a log-log chart with pgfplots

I would like to insert the slope inside a log-log chart with pgfplots. I checked both the pgfplots documentation and the net, but I didn't find something helpful about this problem. Here is the MWE: ...
5
votes
1answer
675 views

Using foreach loop variable as node label in pgfplots

I have a (multi)line plot generated from a table in pgfplots: \begin{document} \begin{tikzpicture} \begin{axis} \pgfplotstableread{table.tsv}\loadedtable \foreach \metavar in {foo,bar} { ...
7
votes
2answers
8k views

y label tikz plot interferes with y axis

I'm trying to make an tikz plot from a matlab plot. The problem is that de y label is on the y axis. I used the following code: \begin{tikzpicture} \begin{axis}[% width=\figurewidth, ...
3
votes
1answer
2k views

Rescaling the colors in a colormap and the axes

I have cerated a file (workfile.dat) at the following format: <x1> >y1> <z> <x1> >y2> <z> <x1> >y3> <z> <x2> >y1> <z> ...
7
votes
1answer
1k views

Is it possible to create a table and bar chart on the fly?

I am a beginner in Latex, using it tentatively for industrial documents. I have reached a point where the anticipated benefits from using it in a Corporate environment appear to me very significant. I ...
10
votes
1answer
4k views

generate a surf plot from a text file

I would like to create a surf plot (like mesh in Matlab) with a view from the top. From a bit leasing I found this way for accomplishing that: \begin{tikzpicture} \begin{axis}{view={0}{90}] ...
9
votes
1answer
1k views

Style to make axis tick label opaque

I would like to make a specific tick label have a white opaque fill around it, so that the a line does not cross over it. Ideally I would like to be able to specify exactly which tick, but do not ...
6
votes
1answer
2k views

marker on every n points only in pgfplots

I use the following command to plot data from a file using pgfplots. \addplot table [x expr=\coordindex+1,y index=0]{file.txt} I have around 8 curves in the same plot and lot of data points in the ...
8
votes
2answers
2k views

TikZ node pin angle in 2D plot

I would like to rotate the pin corresponding to the point -3.09% to the left, but when I increase the angle past 87, it snaps to 90 and the minus sign gets in the ticks and even at 87, it doesn't look ...
5
votes
2answers
865 views

pgfplots: How to draw line from 0-like value with loglogaxis

I want to plot some vertical lines (to mark control points on my histogram). Code to draw the line looks like: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
15
votes
1answer
6k views

What is the opposite to “only marks” option in PGFPlots?

For some application I generate a bunch of plots automatically from a script, that means that sometimes I issue contradictory options to pgfplots objects because one is the default (within the ...
7
votes
1answer
682 views

How can I place numbers into marks of a plot?

I have the following plot with this latex-source: \documentclass{minimal} \usepackage{tikz} \usetikzlibrary{plotmarks} %%%< \usepackage{verbatim} \usepackage[active,tightpage]{preview} ...
2
votes
1answer
338 views

Cobweb diagram has offset iterates / modifying a working piecewise functions results in chaos

I have a problem with the following tikz code (maybe, when reading this, skip at first the code and read the question which is at the end), that creates cobweb-diagrams: \documentclass{article} ...
4
votes
1answer
992 views

How to remove coordinates in a 3d plot using pgfplots

I would like to know how to remove coordinates in an addplot3 surf plot. Here is a simplified example: \begin{tikzpicture} \begin{axis}[clip=false,view={45}{45},grid=major] ...
4
votes
1answer
1k views

Stacked bar-plot: display total value

Is there a way to make pgfplots display only the total value of a stacked bar-plot? With nodes near coords, all segment-values are shown: I'm only interested in the sum of the stacks, though. ...
3
votes
1answer
769 views

Filling path in pgfplot and pushing into background?

I'm using pgfplots to produce a plot of a closed path in the x-y plane. For reasons that are not important here, I would like to fill the closed path. That works fine, but the axes are then hidden by ...
16
votes
1answer
13k views

pgfplots: alignment and size of math in legend

The legend entries created by a more complex math formula as in this example are overlapping and the alignment to the lines is wrong. \documentclass[]{scrbook} \usepackage{pgfplots} ...
3
votes
2answers
532 views

Can't use \pgfmathdeclarefunction even though I use package pgfplots? [duplicate]

Possible Duplicate: How do I use pgfmathdeclarefunction to create define a new pgf function? I'm running the simple code: \documentclass{minimal} \usepackage{pgfplots} ...
2
votes
1answer
750 views

pgfplots spline and colorseries do not work

I want to create a plot with predefined colors and have the points connected by a spline curve. Both things do not happen. The color series is not applied (all lines are black) and a spline is not ...
8
votes
1answer
2k views

How to generate stem plots with TikZ like stem() in Matlab?

Given a set of (x,y) coordinates stored in a file, how could I generate a stem plot from those coordinates? I would like to achieve something similar as the matlab's stem function: ...
6
votes
1answer
359 views

I want to plot several curves in pgfplots and I have problem with markers

I want to skip some of markers, but not skip Coordinates. For example if we have 24 Coordinates I dont need 24 marker, I need 12 marker with 24 Coordinates. How can I do it? \documentclass{report}‎ ...
10
votes
1answer
1k views

matlab2tikz externalize graphics only

I recently discovered the part of pgfplots that allows you to add external graphics with the \addplot graphics command. I have a matlab plot converted to tikz with matlab2tikz. Problem is that the ...
7
votes
1answer
5k views

pgfplots stacked bar plot: distance to axis, padding between bars

I have the following chart: \documentclass{article} \usepackage{xcolor} \usepackage{tikz} \usepackage{pgfplots} \definecolor{transfertoserver}{HTML}{D7191C} \definecolor{database}{HTML}{FDAE61} ...
3
votes
1answer
4k views

Formatting a pgfplot graph. Thicker bars and total width

I am creating a stacked barchart with the following code. However, I have some problems. How do I set the width, of the whole thing? width= does not do it ... How can I get thicker bars? How can I ...
5
votes
1answer
3k views

How to fix the space between each x ticks in a pgfplot?

I want to plot some data using pgfplot. Here is what I got for now: \begin{tikzpicture} \begin{axis}[ xlabel=X, xmin = 0, xtick = {1,2,3,4,8}, ylabel=Y, enlargelimits=false ] \addplot ...
13
votes
2answers
4k views

How to select a finite number of samples from the file when plotting using pgfplot

I have a datafile containing thousands of points of which I need to plot only the first 100 points. How to do this using pgfplots? I tried the following with no effect. \begin{axis}[
xlabel=k,
...
3
votes
1answer
2k views

how to plot a sequence of numbers (not co-ordinates as such) using pgfplots

I have a data file containing a sequence of numbers, to be plotted against integers starting from 1. So the x co-ordinate is the row number of the data in the file. How to plot this data using ...
6
votes
1answer
1k views

Horizontal bar-charts in PGFPlots: “point meta” messes with alignment

I'm drawing a rather unusual bar-chart to display the results of a small survey. The axis of the chart extends in both the negative and the positive domain. However, there is no zero and all values ...
23
votes
5answers
2k views

Lower and upper Riemann sums

I am trying to create a few images for educational purposes. Therefore I need to be able to illustrate the area under various functions, using lower and upper riemann sums (rectangles) Reason for not ...
18
votes
3answers
13k views

specify the step of pgfplots axis

Now the numbers on the x-axis are 0, 0.5, 1, 1.5, 2 I want to show integer only: 0, 1, 2 How can I do that? My code: \begin{tikzpicture} \begin{axis}[ xlabel=threads, ...
3
votes
2answers
1k views

latex code for graphing rational function

I've seen in TikZ and pgf Manual for version 1.18 a code for graphing some functions but it does not provide an example for a rational function. Can someone help me graph $x+\frac{1}{x}$?
4
votes
3answers
1k views

Tikz,PGFplots: drawing in node's cs placed on plot

I'm trying to place some arrows which should be placed alongside the graphs. I place nodes on the graph using node[pos=0.2,above] (point1) {} Then I want to draw in that coordinate system \draw ...
5
votes
2answers
1k views

pgfplots: three dimensional plot with one variable as exponent?

In want to draw this function with pgfplots: f(x,y) = 1-(1-(1+y)^(-x))/x*y. When compiling, I get some error message about z buffer reoderings. I already played around a bit and ist seems to me the ...
5
votes
2answers
5k views

Axis tick numbers overlap in TikZ

The following code can be used to create a TikZ plot: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[% view={0}{90}, scale only axis, ...
9
votes
1answer
3k views

pgfplot with constant decimal places on ticks

I'm trying to display the tick labels of the y axis of just this graph within my document formatting to two decimal places. I've tried the following code but it seems that it doesn't like the way I'm ...
14
votes
2answers
6k views

ylabel postion with pgfplots

I am using pgfplots to plot some data, but I am having problem you see in the image below. Basically, the ylabel overlaps with the axis numbering. I have googled a LOT but couldn't find any solution. ...
37
votes
2answers
5k views

Axis break in pgfplots

Is there an easy way to 'break' the axis in a pgfplots environment? What I'm talking about is something like this Any minimal plot will do as an example...for example \documentclass{minimal} ...
2
votes
0answers
371 views

node not appearing when used with pos option in a pgfplot [closed]

I want to place a node on a plot using the pathway modifier: node[pos=0.5] {node text};. The pgfplots manual clearly describes how that is done, but my node doesn't appear. Could my scaling be a ...
5
votes
1answer
3k views

How to put the values of each bar in a pgfplots bar chart inside the bar itself?

I have this: \begin{tikzpicture} \begin{axis}[ ybar = 0.6, width=1.2\textwidth, height=0.4\textheight, enlarge x limits = 0.2, bar width=16pt, title={Instance els19 with 1\% max error}, legend ...
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}