{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
390 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} ...
3
votes
1answer
218 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
443 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} ...
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
4k 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 ...
3
votes
1answer
53 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
46 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. ...
3
votes
1answer
95 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
55 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} ...
3
votes
2answers
158 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
265 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
75 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
89 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
86 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
146 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} ...
3
votes
1answer
42 views

bug in pgfplots+subcaption?

I'm using pgfplots (with the excellent matlab2tikz), pgfplotstable and subcaptionbox together, and for some inexplicable reason (at least to me), the command \pgfplotsforeachungrouped seems to break ...
3
votes
1answer
176 views

Draw a surface on a ternary diagram with pgfplots

I'd like to draw a surface on a ternary diagram. Until now, I can plot density maps on a ternary diagram (cf. density map). But I would like to replace the density map by a surface, like on figs a ...
3
votes
1answer
200 views

pgfplots error message “/pgfplots@addplotimpl@expression@curly”

I am currently using pgf plots to make a few graphs; however, when I go to typeset the document I receive a strange error message that prevents the PDF from being produced. The error message states: ...
3
votes
1answer
150 views

Adding lines to bar charts

Is it possible to add a straight horizontal black line (from (0, 0.4) until the very end of the graph) in a bar chart environment like this: Here is the code that generates this bar chart (borrowed ...
3
votes
1answer
246 views

How to add an extra tick without adding a new line to the grid

I need to add an extra tick to the x-axis without adding a new grid line at the new x value, the problem is that I'm using extra ticks to get a complete grid (it is one solution that was given to me ...
3
votes
1answer
104 views

Show mark labels near marks and not centered in ybar interaval graph

I'm doing a graph with vertical bars (ybar) where each bar represents not a number (1) but a class ([-0.5,0.5]). I would prefer that tick labels on the x axis appeared near the ticks marks, so ...
3
votes
1answer
63 views

characteristic of a regression line

I have a little Problem with a regression line I made. I need it to be from its zero up to the x-value of the highest point. This is how it actually looks und underneath how I need it. Does anyone ...
3
votes
1answer
132 views

Is it possible to make a gradient from 'opaque color' to 'total transparency'?

It seems like the 'color' transparent acts just like black (changing opacity acts as some kind of gray): \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} ...
3
votes
2answers
104 views

Labelling only one point on a coordinate axis (pgfplots)

I want a grid on the whole plane like I have, but I don't want labels on the coordinate axes (other than at x/y=1) or the blank spaces that are seen in the MWE. How do I accomplish this? ...
3
votes
1answer
93 views

Funky (don't know how else to describe) Surface Plot

Below is an MWE \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} \usetikzlibrary{pgfplots.groupplots} \pgfplotsset{compat = 1.12} \begin{document} \centering ...
3
votes
2answers
144 views

Draw a special element (line with a cross in the middle) in circuitikz

I need to draw a wire that looks like That is the symbol my lecturer uses for the Josephson junction. I googled a bit and it seems to be the commonly used symbol for such an element, so it would ...
3
votes
1answer
242 views

Adding a 2D plot to a 3D plot without closing the ends

I want to add 2 parabolas to a plot of a hyperbolic paraboloid, but I can't figure out (and couldn't find any information on the internet) how to keep pgfplots from closing the ends of the graphs. My ...
3
votes
1answer
125 views

Colored circles from data

I have a data file which gives x-position (xpos), radius, and color. I wish to draw a circle at ever (xpos,0) with appropriate radius and color. How do I achieve that? I have used two approaches. ...
3
votes
1answer
339 views

How to add node above pgfplot Y axis max?

I want to add some nodes (labels) above the max value of the Y axis in a pgfplots. I came with the following MWE: \documentclass{beamer} \usepackage{tikz} \usepackage{pgfplots} ...
3
votes
1answer
151 views

Runaway argument using int() function in pgfplots

The MWE below yields Runaway argument? 3\pgfflt@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok \ETC. ./TeX-SE.tex:29: Paragraph ended before \pgfflt@readlowlevelfloat was complete. ...
3
votes
1answer
839 views

Specifying which user defined colormap to use in pgfplots

I have figured out how to define my own colormap in pgfplots. My understanding is that when I define my color map and I plot any graph that requires a colorbar, the default coloring scheme used ...
3
votes
2answers
289 views

Modifying some features in a scatter plot

I would like to have the following modifications to the scatter plot. The title should be typeset on two lines. I would like a break on each axis indicating a skip from 0. (When I was in junior ...
3
votes
1answer
2k views

Help with grid lines in a pgfplot

Nothing exciting here. I have a plot with xmin=-11, xmax=11, ymin=-11, and ymax=11. I would like to use the grid option in the axis environment to draw a particular grid. All horizontal and ...
3
votes
1answer
128 views

Ticks stop early in PGFPlot

So I was trying to produce this with PGFPlot and got pretty close with the code below but (apart from the major/minor ticks not being as different in their lengths as in the example) I have one ...
3
votes
1answer
323 views

Contour Plots in Groupplot

I am trying to produce a groupplot with two contour plots. I suspect I could work this out on my own given enough time to play with it, but I am up against a bit of a time crunch... As background, ...
3
votes
1answer
239 views

Same pgfplots within standalone for usage in elsarticle and revtex4-1

Suppose I have created a plot with pgfplots for a scientific paper. However, for usual reasons the targeted journal is not certain. Possibly the plot has to be adjusted to match different journals ...
3
votes
1answer
317 views

LuaTeX, unable to read file in pgfplots

I am trying to switch to LuaTeX, but I am not able to compile any pgfplots figures with external data files, which used to compile with pdflatex. Here is the MWE: \documentclass{standalone} ...
3
votes
1answer
164 views

Drawing Sinusoids with Phase difference

My first goal was to draw sinusoid plots similar whit these images: This is what I've done (similar to one code in this forum): What I'd like to know is (if possible) how to change integral ...
3
votes
1answer
149 views

How to draw a z-simple paraboloid in a “clean” way

I'd like to draw z=x^2+y^2 on the interval 0<z<9. So normally I've just been using pgfplots with the addplot3 command, and for rectangular domains that doesn't seem to cause too much trouble. ...
3
votes
1answer
72 views

pgfplots build just hangs

I'm very new to using pgfplots, so maybe I'm just being impatient... Here's the first five lines of my data file, plusMethods.csv. In total, the data file has 58 lines. ...
3
votes
1answer
253 views

Pgfplots rounded corners and plot problem

I noticed something strange recently when trying to use rounded corners in pgfplots: it totally ruins the plot. See below without rounded corners: and then with rounded corners: Here is a ...
3
votes
1answer
329 views

pgfplots: How can I write square brackets in xlabel or ylabel?

The following works fine: \begin{tikzpicture} \begin{axis}[xlabel=$k$, ylabel=$x(k)$] \addplot coordinates {(0,1) (1,4) (2,2) (3,-1) (4,2)}; \end{axis} \end{tikzpicture} But as soon as I ...
3
votes
1answer
199 views

How to remove automatic exponential coordinate value (Polystyrene Foam in this case) in tikz?

\documentclass{standalone} \usepackage{tikz,pgf,pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ xbar, xmin=0, xlabel={\textbf{Unit Weight (in $\mathbf{kN/m^3}$)}}, symbolic y ...
3
votes
1answer
883 views

Vertical alignment of legend entries in pgfplots

I have multiline legend entries in my plot. The default styles uses centered alignment for both legend image and legend text. How can I change that such that the legend image is top-alignment next to ...
3
votes
1answer
641 views

pgfplots, axis limits and axis equal

I would like to apply the axis equal option and scale the y-axis from 0 to pi. Unfortunately both is not working with the minimal example provided below. The output still contains white filled space ...
3
votes
1answer
242 views

Change style of PGFplots 3d box

When making a 3d axis plot by means of PGFplots, one can for instance change the style of the grid with \pgfplotsset{grid style={dashed,gray}} . But when using 3d ...
3
votes
1answer
40 views

Long node undesiringly cropped outside of pgfplot

I have a node within a pgfplot that is rather long. I know I can move the node along using pos but that's not what I want, since in the actual applications I have more objects on the plot. On the ...