{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
2answers
514 views

Pgfplots: let legend show two linestyles

I do have a double axis plot which which compares two different things (part 1 on the left axis in solid, part two on the right axis in dashed) for different paramters which are common for both plots. ...
3
votes
2answers
180 views

title in graphic with pgfplots

I have the following code: \documentclass[12pt,a4paper]{article} \newcounter{conto} \setcounter{conto}{\time} \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{url}...
3
votes
1answer
480 views

Showing all the decimal numbers on the y axis clearly in a given chart

I would like to show my y axis as follows: Here is my code: \documentclass[english,12pt]{standalone} \usepackage{tikz} \usetikzlibrary{patterns} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \...
3
votes
2answers
855 views

define manually the position of a pgfplots plot inside the TikZ picture

I just started using matlab2tikz for the graphics in my thesis and got stuck with a probably simple problem: I have a plot of a function and an inset (zoom-in) on it. Both the main plot and the inset ...
3
votes
1answer
370 views

How to add a 2d plot to a 3d axis drawing?

My task is quite simple. I want to add to my 3d axis drawing a 2d plot. My closes result is this: \begin{tikzpicture} \begin{axis}[ axis equal, view={45}{30}, ...
3
votes
2answers
777 views

precision in xy axis in tikz

I have this code \begin{tikzpicture} \begin{axis}[% width=\figurewidth, height=\figureheight, scale only axis, xmin=0, xmax=1.5e-05, ymin=1.222e-07, ymax=1.224e-07 ] \addplot [color=red,line ...
3
votes
1answer
841 views

Force pgfplots to draw legend according to cycle list instead of the first plots

I use pgfplots to plot multiple curves from a file. The graph is plotted in two steps Draw only the marks, taking the original values from the file Draw only the lines, approximating the curve of ...
3
votes
1answer
626 views

Automatically get (ymin,ymax) and (xmin,xmax) in pgfplots

I am plotting some 2D data from a file using pgfplots. Is it possible to automatically get (ymin,ymax) and (xmin,xmax) from the file I am trying to plot? I don't want to keep changing these each time ...
3
votes
1answer
766 views

One axis in pgfplots

I try to make one axis exercices for students, thus I try to customize pgflots but I don't understand what append in this examples : \documentclass{article} \usepackage{tikz,...
3
votes
1answer
409 views

\pgfplotstabletypeset heatmap: logarithmic scale

I am trying to create my own rendition of this heatmap. My values range anywhere from 1 to 783764. I want to plot them as colors on a logarithmically (base10) scaled colormap. So the values' ...
3
votes
1answer
535 views

Cyrillic text in symbolic x coords

I make bar plot with pgfplots: \documentclass{report} \usepackage[T2A]{fontenc} % Поддержка русских букв \usepackage[utf8]{inputenc} % Кодировка utf8 \usepackage[english, russian]{babel} % Языки: ...
3
votes
1answer
382 views

Add arrow to 3D pgfplot

How to add an arrow (cf red arrows below) in a 3D plot (or 2D plot should be similar) in pgfplots ? The arrow has not to be specifically aligned with the label but could be placed closer to the axis.
3
votes
2answers
3k views

matlab2tikz and legend location

I have a matlab plot given below, that is converted to tikz. Let's call it myfile.tikz \begin{tikzpicture} \begin{axis}[% width=\figurewidth, height=\figureheight, scale only axis, xmin=1, xmax=3, ...
3
votes
1answer
202 views

PGFPlots: Thick line goes outside drawn y-range

What is the best way to avoid thick lines in PGFPlots from going outside the drawn y-range? For example, near the maximum in \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{...
3
votes
1answer
624 views

Two boxplots per plot entry - shifting boxplots in pgfplots

I'm trying to compare the results of a control group and an experimental group under different conditions. To simplify, let's assume there is only one condition (ie. only one mark along the x axis ...
3
votes
1answer
154 views

How to remove all of ticks keeping the extra ticks

I want something like \begin{axis}[ y ticks=\empty, extra y ticks={-1,1}, extra y tick style={yticklabels={{name1},{name2}} ] ... \end{axis}
3
votes
1answer
534 views

PGFPlots: How does one plot a wave packet?

Given the equation 2\cos(kx - wt)\cos(.5\Delta k(x - \frac{\Delta w}{\Delta k}t)). How can I plot this in pgfplots? k is the wave number w is the frequency \Delta k and \Delta w are both \ll 1 We ...
3
votes
1answer
464 views

pgfplots memory overload

I want to plot 5x9000+ data points. I am already using: \usepgfplotslibrary{external} \tikzexternalize and -shell-escape -enable-write18 in PDFLatex. However, I still get the memory error. I ...
3
votes
1answer
516 views

pgfplots plot marks vanish when I change colors

I have created two overlapping plots (thanks to Drawing curves and multiple y-axes in one plot with pgfplots): When I change the color in the second one, the plot marks vanish: Here's my MWE: \...
3
votes
1answer
412 views

! Dimension too large

I keep getting the error Dimension too large when i make my \Desktops{80} and my \DTUnits{20} however if I change my \DTUnits{14} it works, can someone help me please? \documentclass[a4paper,12pt]{...
3
votes
1answer
112 views

Hiding Decimal Results from PGF Output

I have this \foreach statement which results in even numbers with decimals. I would like to omit or hide the decimal from the results. How can this be done simply? I have seen a few answers to much ...
3
votes
1answer
792 views

pgfplots won't produce error bars

The following error is thrown when I try to compile the MWE below: Package pgfkeys Error: I do not know the key '/tikz/error' and I am going to ignore it. Perhaps you misspelled it. I'm running ...
3
votes
1answer
257 views

How to make the legend border tighter?

I am trying to make the legend border tighter. What is the \begin{axis}[legend style={...}] property to adjust the legend border (both width and height of the border)? \documentclass{article} \...
3
votes
1answer
730 views

set domain in pgfplots

I created this graph. The graph is shown correctly but I need the range on the y-axis to be from 10e-8 to 1. I would also like a grid. I'm a newbie with the pgfplots package. \begin{figure}[htp] \...
3
votes
1answer
3k views

matlab2tikz for surf plots: reducing data?

I was really happy to see that matlab2tikz also supports surf plots. Unfortunately, it produces too much data, so I run into the well-known memory problem. I tried compiling with lualatex instead of ...
3
votes
1answer
275 views

Using foreach to generate computed indices in a plot

I have a table with 8 columns, and I want to generate 4 plots (1 vs 0, 3 vs 2, 5 vs 4, and 7 vs 6). I was going to use foreach to generate the plots using \begin{tikzpicture} \begin{axis} \foreach \x ...
3
votes
1answer
343 views

pgfplots: marks in table as ellipse with size of error bars, area of uncertainty?

Is it possible, and if yes how, to plot a table with pgfplots where the marks are ellipses with the major and minor semiaxes being the size of the error? Such that a data point is displayed as its own ...
3
votes
1answer
145 views

Make the label surrounding line disappear

Referring to How to plot the graph below? Is it possible to make the label surrounding lines, and the top and right lines for the coordinates disappear?
3
votes
1answer
444 views

Plots with only a few scattered marks and correct legend

I would like to draw several plots with lines and only a few marks. The markes are irregularely spaced, so I used a method alluded to in the pgfplots manual, section 4.8.5 (Legend appearance), page ...
3
votes
1answer
887 views

How can I add a legend in aligned subplots

I want to have two subplots with the same x axis aligned above one another. In the manual I read, that I should use \matrix{} to achieve this. Now I want to have legends in both plots. But since the ...
3
votes
2answers
394 views

Numbers as markers with \foreach and additional macro based on counter

First issue I would like to plot several curves using the \foreach command and have their number in the sequence as markers. Here is the code I came up with : \documentclass{article} \usepackage{...
3
votes
1answer
220 views

pass a set of numbers to pgfplotsinvokeforeach <list>

Is it possible to pass a numeric set to the list argument of the \pgfplotsinvokeforeach command? I need something like this: \newcommand{\a}{1,2,...,10} \pgfplotsinvokeforeach{\a} {<...>} ...
3
votes
1answer
450 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} \tikzset{%...
3
votes
2answers
2k 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}$?
3
votes
1answer
5k views

PGFPLOTS: figure and table formatting

Just after an hour spending browsing through the pgfplots manual, I am trying to have a figure and a table side by side (both the figure and the table use the same data). So I still have lot to learn! ...
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 ...
3
votes
4answers
2k views

How do I align a pgfplots graph?

I'm trying to draw a graph with the associated table of data using pgfplots. It works great, but the graph itself isn't aligned with the table. This is what it looks like: I don't like the overhang....
3
votes
1answer
41 views

Fill Area pgfplots

I somehow have problems getting the area below my curve filled. The library fillbetween should be able to handle this but fails for me (probably because of me). MWE: \documentclass{standalone} \...
3
votes
1answer
22 views

Pgfplots: Scope inside axis environment - follow up

This is a follow-up question to this question: I still want to place an external figure inside a pgfplots plot. Additionally, I want to put some labels inside the external figure to mark the position....
3
votes
1answer
67 views

Axis label positioning in pgfplots

Can someone please help me explain why label positioning in the following code does not work? It is not clear what I am doing wrong. I also tried axis description cs. That does not change the label ...
3
votes
1answer
48 views

How do I remove some unwanted x ticks in PGFPlots?

I am not sure where I am doing wrong, but in the plot I should not have two 32, two 64 and two 128 on the x-axis. Here is a minimum working example; I would appreciate any assistance. \documentclass[...
3
votes
1answer
101 views

Alternate position of x tick labels

Is it possible to automatically change the position of every other x tick label in pgfplots? This is my scenario: I have a plot with symbolic x tick labels loaded from the table. Those labels are ...
3
votes
1answer
57 views

How can I add degree signs to the numbers on the x axis?

I want to add degree signs to the numbers on the x axis, as shown in this picture. How can I do this? \documentclass[tikz,border=5pt]{standalone} \usepackage{pgfplots} \usepackage{...
3
votes
2answers
175 views

How to draw a tangent line to an arbitrary `\addplot` [duplicate]

I am attempting to draw the following graph in tikz. My attempt so far has gotten me to here. \documentclass[border=3mm]{standalone} \usepackage[dvipsnames]{xcolor} \usepackage{pgfplots} \...
3
votes
1answer
298 views

Basic Bar Plot with long text legend, horizontal guides and percentage values

I am new to pgfplots and actually I want to create something pretty basic. Yesterday, I started modifying my chart with the help of the pgfplot manual and the help of Google but unfortunately, I ...
3
votes
1answer
61 views

Plot hex numbers in pgfplot

I want to draw a graph from external text file which contains hex numbers (representing integers) like 0x8210 in 4 columns. It seems pgfplot does not automatically recognize the hex numbers. I know ...
3
votes
2answers
82 views

How to align annotations with axis labels in pgfplots?

I would like to annotate plots produced with pgfplots in such a way that: The baseline of the annotation is aligned with the baseline of the x-axis label. The left margin of the annotation is ...
3
votes
1answer
107 views

Fix Overlapping Plots in Pgfplots

I am trying to plot x^2+y^2−z^2=1 and x−2z=0 on the same graph and am able to successfully graph them; however, the result looks horrible and overlaps poorly. How can I fix the overlap and make a ...
3
votes
1answer
87 views

How to add multiple x axes with different scaling?

I am trying to plot the following graph (Standard Atmosphere) with pgfplots: What I currently have is: \documentclass[]{article} \usepackage{pgfplots,amsmath} \begin{document} \begin{tikzpicture} ...
3
votes
1answer
164 views

PGFPlots — custom colors for ticks labels

Is there any way to change a color of a single tick label? I need some labels to be black and others to be blue and red. \documentclass[png,border=4pt]{standalone} \usepackage{tikz} \usepackage{...