{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

11
votes
1answer
4k views

pgfplots - number format on axis

How can I force pgfplots to draw my axis ticks labels consistently? I mean instead of 0 a 0.0, instead of 1 a 1.0 in the below image. EDIT: Code \documentclass[a4paper,10pt]{scrartcl} ...
11
votes
1answer
7k views

Legend in tikzpicture

I am looking for a way to create a legend in a regular tikzpicture. I found this Using a pgfplots-style legend in a plain-old tikzpicture but I don't know how to put the legend at the wanted ...
11
votes
1answer
2k 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 ...
11
votes
2answers
196 views

Can I rotate a marker with a scatter source?

I'd like to be able to use pgfplots to show a skier going down a ski slope. Here is what I have done so far. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \makeatletter ...
11
votes
2answers
452 views

Visualize data on a variable-radius graph/network

I am trying to visualize the output from a simulation model I have been working with. The simulation finds the steady-state solution to a system of differential equations on a variable-radius (and ...
11
votes
2answers
2k 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 ...
11
votes
1answer
4k views

How to change label and ticks of a pgfplots colorbar?

I have a 3d plot with colored surface and a colorbar made with pgfplots. My probably related questions are: How can I set the label of the colorbar? What are the equivalents of zticks (positions of ...
11
votes
1answer
5k views

pgfplot: Datafile format for datetime field

I have a datafile (which I may manipulate to any format), it contains a date-time stamp currently in the form "year-month-day hour:min" and a single variable for each recorded time. When I attempt to ...
11
votes
1answer
3k views

Chart with long x axis text labels looks ugly

Thanks to Caramdir and Alan Munn I am now able to create basic bar charts that use text as x axis labels. Functionally they are perfect, but some of them look kind of ugly. See for yourself: ...
11
votes
1answer
581 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 ...
11
votes
1answer
3k views

Axis with trigonometric labels in PGFPlots

How do I make the axis labels use multiples of \pi in PGFPlots?
11
votes
1answer
2k views

Using Labels from a File in PGFplot

I am using LaTeX, TikZ and PGFplot in order to automatically generate several series of diagrams, one of which is comprised of bar charts. Each bar in each bar chart may have a unique label and height ...
11
votes
1answer
359 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} ...
11
votes
1answer
372 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@ ...
11
votes
1answer
147 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 ...
11
votes
1answer
318 views

Problem with legend in pgfplots

I want to make plot with fill area. I try this code \documentclass[a4paper,12pt]{report} \usepackage{pgfplots} \definecolor{plotmain}{HTML}{97bbcd} \pgfplotsset{every axis legend/.append ...
11
votes
1answer
257 views

pgfplots: two axis for one dataset e.g. °C and °F

I want to plot ONE dataset in a pgfplots and use TWO axis with different units on each axis. For example I have one dataset with temperature and want to print a °C scale on the left and a °F on the ...
11
votes
1answer
589 views

Why does pgfplots package cause tikz layer to disappear?

I wish to include a pgf-generated line plot and a tikz-generated graphical model in the same document. However, the presence of the pgfplots package (needed for the axis environment) seems to turn one ...
11
votes
1answer
358 views

Place point on helix

Pasted below is a helix created with PGFPlots package and now I need to add points to a helix. What I was able to get so far is pasted below. I also included a figure depicting desired output I ...
11
votes
2answers
670 views

How to add a jitter to a scatter plot with pgfplots

I have the following scatter plot: \begin{tikzpicture} \begin{axis}[ enlarge x limits=0.02, xmin=0, ] \addplot+[only marks,mark size=1pt] table[x=rmsd,y=seq_score_min] ...
11
votes
1answer
3k 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:
11
votes
1answer
3k 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: ...
11
votes
1answer
665 views

Draw a line between data points in two different pgfplots (subfigures)

I have two different pgfplots in two subfigures. I want to draw a line between the red circled data points and the blue ones. I added lines manually with LibreOffice Draw to show you what I mean. My ...
11
votes
2answers
341 views

Automatically label groupplots (A), (B), (C),

Is there a way to automatically label a set of groupplots from the pgfplots package (A), (B), (C), ...? \documentclass[margin=2pt]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} ...
11
votes
4answers
482 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} ...
11
votes
1answer
1k 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 ...
11
votes
1answer
866 views

Draw Pareto chart with pgfplots?

I've been following the pgfplots documentation to make some basic bar charts, mostly following this example: \begin{tikzpicture} \begin{axis}[ ybar, ymin=0, width=12cm, height=3.5cm, ...
11
votes
2answers
270 views

Double Smithchart with pgfplot

I'm trying to plot a smithchart, which has negative impedances, too. This is how far i got till now: \documentclass[]{standalone} \usepackage{tikz} \usepackage{pgfplots} ...
11
votes
1answer
778 views

Modified pattern does not see the pattern color option

I have modified the north east lines pattern to accept a \LineSpace option that sets the density of the pattern (see the question Can I control the density of a pattern in TikZ?). The code works very ...
11
votes
1answer
162 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} ...
11
votes
1answer
609 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 ...
11
votes
2answers
2k views

How to maintain consistency with TikZ and Pgfplots?

I would like to maintain some consistency between TikZ and PGFplots, and have run into numerous difficulties. Here is an example of two of them: I would like to be able to use something similar to ...
11
votes
1answer
1k 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} ...
11
votes
1answer
377 views

Building a 2D histogram with PGFPlots

What I want to achieve The framework ROOT can create 2D histogram plots with colored boxes indicating count rate that looks something like: My question is really only: can I produce this kind of ...
11
votes
1answer
277 views

Criteria for deciding how best to specify coordinates with tikzpicture with or without pgfplots

Conclusion The original question, as Christian has pointed out, was far too broad and basically a result of being overwhelmed by the size of two main manuals for tikz and pgfplots and how they ...
11
votes
1answer
332 views

Presumed error of pgfplots in the “cutting” of a surface

I'm struggling with a 3D representation through the use of the package pgfplots. I'm faced with an alleged error in pgfplots (from my point of view). Consider the txt file (which is attached here) and ...
11
votes
1answer
3k views

pgfplots and calculations; without fpu 'dimension too large', with fpu 'Illegal unit of measure (pt inserted)'

I'm trying to multiply some numbers that will end up in the legend of a plot. I can't get it to work: If I naively try \pgfmathmultiply, I get a dimension too large error, with the code in MWE 1 ...
11
votes
1answer
236 views

How can I draw 25 horizontal lines instead of these 25 marked samples?

Instead of the samples which were marked via mark=-, I would like to have horizontal lines that fill the entire axis from left to right. Had the idea to tune the dashes via mark size=6cm but I did not ...
11
votes
1answer
2k views

pgfplots - Placing Nodes on x Coordinates of a Plot

I want to plot some graphs in pgfplots and want to place nodes on the exact same x coordinate of the plot. The position of the note has to be set in x direction but free in y direction. Here is one ...
11
votes
1answer
650 views

how to draw interrupted bar charts in pgfplots

Is there a way to interrupt the bar charts in pgfplots? More specifically, I have a plots with bar charts and one chart has extremely high values, so that you can hardly see the others in a scale. ...
11
votes
1answer
1k views

Space between bars, height and width of the plot

I'm using pgfplots to generate bar plots from data files. Here's MWE: \documentclass{article} \usepackage[ngerman]{babel} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ ...
11
votes
1answer
208 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 ...
11
votes
1answer
582 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} ...
10
votes
2answers
4k views

Histogram with Tikz

I am a newbie in TeX. And I need to use Tikz to make a copy of this histogram Of course, I am able to make something similar. Unfortunately, I need a replica (90%) of it. Can anybody help me? ...
10
votes
2answers
876 views

pgfplots quadrics

I wonder whether it is possible to draw the three following quadric surfaces (cone, hyperboloids) x^2+y^2-z^2=0 x^2+y^2-z^2=1 x^2+y^2-z^2=-1 (and the axis) using pgfplots 3d or TikZ as it is ...
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 ...
10
votes
3answers
555 views

Filling in the area under a normal distribution curve [duplicate]

I'm trying to fill the area between the two $z$-scores but I'm not having any luck. Could someone please help me with this? \begin{tikzpicture} \begin{axis}[ no markers, domain=0:6, ...
10
votes
2answers
693 views

Not recompile unchanged pgfplots graph

I'm writing a document with something like 30 graphs with a lot of points in each. The graphs are almost ok and I don't need to change them for now. I'm improving the text, so I need to recompile ...
10
votes
4answers
1k views

Plot inverse function in pgfplots

pgfplots is not quite comfortable plotting sqrt(x) near x=0. The graphic can be improved by setting samples=2000 (not less), but this seems overkill to me. Is there a way to plot x as a function of ...
10
votes
2answers
298 views

Decorating a path's edge with a hatch pattern in TikZ

Problem I would like to indicate an infeasible region in one of my pgfplots by manually drawing a path in the canvas. This should be a hatched pattern that is decorated on the path, something like ...