{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
1answer
66 views

How to plot this histograms as a line graph?

Let's say I have this histogram plot: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ symbolic x coords={a small bar,a medium bar,a large bar}, ...
3
votes
1answer
45 views

pgfplots + gnuplot: how to clean up the look of a contour plot generated from raw gnuplot data by using a colour bar?

Here's a MWE: \documentclass[12pt,letterpaper]{article} \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} ...
3
votes
0answers
22 views

pgfplots stacked bar plots with too little space for some “nodes near coords” [duplicate]

When creating stacked bar charts with pgfplots, how can I avoid printing those (and only those) "nodes near coords" if there is too little space? The following MWE illustrates the problem: ...
2
votes
1answer
42 views

Call to coordinate for creating a patch gives an error

I'm trying to construct a patch in pgfplots by means of table data. In attempting to do so, I also use the \coordinate command. Minimum working example: \documentclass{standalone} ...
4
votes
1answer
59 views

Disabling filling does not work with patches

I want to draw a triangular patch with no filling. Minimum working example: \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} ...
1
vote
0answers
43 views

Importing PDF image with filled surfaces using graphicx [closed]

So I coded up a plot in pgfplots for inclusion in a document and it came out very nice. I've attached what it looks like below straight from the original pgfplots compilation. I generated the filled ...
1
vote
0answers
37 views

Glitches and other problems with pgfplots

I want to draw a rather smooth surface in a 3D graph with pgfplots. 1) It shows however, some glitches (spikes on the smooth surface), which I guess due to some numerical issues in the basic package. ...
2
votes
0answers
72 views

Tips for making a lightweight long document

I wonder what tips should we keep in mind to keep a long document lightweight. I've written 3 chapters from my thesis with ~30 figs and some math, and document size is exponentially increasing (10MB ...
5
votes
1answer
54 views

Use pgfplots to force linear regression through origin/zero

I'm using pgfplots to make a linear regression of some data. I know the curve should pass through zero (Hookes law). data.csv: F,delta 2.4525,0.6 4.905,1.05 7.3575,1.5 9.81,2.4 12.2625,2.5 ...
0
votes
1answer
112 views

How to shade a region outside the sphere in Tikz

I would like to graph the region given by (x-2)^2 + (y+1)^2 + z^2 > 5. So, I'm looking to draw a dashed sphere of radius sqrt(5) centered at (2,-1,0) and then shade everything outside of it. Any ...
3
votes
2answers
72 views

! Dimension too large. for tikz

MY aim is to plot only a small part of a data set with tikz but I get the error message ! Dimension too large. <recently read> \pgf@xx when I try limit the plot area with xmin and xmax. Is there ...
0
votes
0answers
34 views

Scale y data in bar plots with pgfplots depending on x ticks

I have an issue dealing with data scaling. I consider two different kinds of information (i.e. orange and apple eaten daily) depending on three different people. Now I need to display the factor of ...
1
vote
1answer
46 views

Hidden data in stacked bar plot

I am trying to reuse a stacked bar plot I created a few months ago that looked like this: The source code I'm pretty sure I used to create is was: \documentclass{article} ...
2
votes
1answer
148 views

Color coded plots with colorbar in pgfplots

In matlab I can achieve this result using the structure of this minimal working example (in matlab): figure('color','white'); hold on xx=0:1; colors = parula(5); for i = 1:5 color = colors(i,:); ...
3
votes
1answer
52 views

Stack lines by absolulte Y-offsets in pgfplots

I need to shift several curves in a plot but in a way that is independent of the scale of the data. For example I need to shift each curve by a fifth or so of the scale of plot. Suppose one has to ...
4
votes
1answer
95 views

Filter in PGFPlots by x coordinate value

I've been trying to springboard off of the answer I got from percusse here, but I'm drowning in the PGFPlots manual. I wanted to plot a smooth region in the middle, given the x coordinate values ...
2
votes
1answer
133 views

pgfplots: Color a 3D surf plot based on y-value

I'm not sure if things have changed since version 1.7, but this is the closest thing I could find. I'm wondering if there's an easier way to use the y-value with a colormap to determine the color, or ...
2
votes
1answer
43 views

pgfplots: figure too large

I have a problem with pgfplots and it took me a while to strip down my problem to the minimum. I try to add two lines and fill the area between them. The curves have points outside of the axis area. ...
16
votes
2answers
1k views

Using pgfplots, how can I make and use a colormap that has a sharp transition in the middle?

I wish to make a colormap where the distinction between numbers smaller than 0 and numbers greater than 0 is emphasised. So I want to make a colormap that has one sharp transition in the middle and ...
10
votes
1answer
166 views

ybar stacked: Position of labels

I want to display some results of a performance test in a diagram as ybar stacked, but as you can see, some labels are printed over others and are hard to read (because of colors). Now I want labels ...
0
votes
0answers
41 views

Reduce mesh size of data set for Surface pgfplot

I want to reduce the amount of sample points latex uses for creating a pgf surface plot. My data file currently has a mesh of (41x401) points. I am looking for a way to implement the (each nth ...
1
vote
0answers
34 views

How do I uniformly change bar thickness, box width and add error bars?

I need help with a few adjustments on this group plot. I managed to solved my previous problem but now I´m searching for a needle in a haystack. 1. How do I make the bars thinner so they may fit ...
15
votes
6answers
478 views

Draw a smooth surface

I would like to draw a smooth surface like http://mathematica.stackexchange.com/questions/20912/how-to-draw-a-higher-genus-surface but using Asymptote, TikZ, Metapost, PStricks, or other TeX friendly ...
1
vote
1answer
60 views

How to do the following graph in LaTeX with pgfplots?

is there anybody who can help me with graph in graph pictures?
1
vote
0answers
105 views

draw a function in Latex

I'm a beginner to latex and tikz, I've learned some basics but I still don't have a clue to draw functions in latex or tikz. Could anyone provide me with the codes for the two functions shown in the ...
1
vote
0answers
28 views

Something like \tikzexternalize[prefix=tikztmp/] for LuaLaTeX

My aim is to compile a *.tex file that contains quite a number of tikz-environments and to create for every tikz-environment one pdf-file. Under LaTeX I would use something like ...
4
votes
1answer
56 views

Style args syntax for negative/not/except to make this cleaner code

I asked another question and not only did percusse explain the code, but went even farther and wrote my code for me. That is beyond awesome. All I need to do is switch the part of the plot that the ...
3
votes
1answer
79 views

Plot every nth point except for a region in the middle

I found these neat little additions here, but I'm having a hard time reading the code: \makeatletter \def\pgfplotsutil@decstringcounter#1{% \begingroup \c@pgf@counta=#1\relax ...
1
vote
1answer
64 views

Improving a tikz plot

I have drawn the following picture with tikz: Code for MWE: \documentclass[a4paper,12pt,notitlepage,oneside,reqno]{scrbook} \usepackage[T1]{fontenc} \usepackage{kpfonts} \usepackage{libertine} ...
5
votes
1answer
108 views

3d surface plot with logarithmic x and y axis

What I need the surface of the function $(1/x)^(1/y)$ in the range of x:10^1 - 10^8 and y:10^1 - 10^5. The x and y axes are preferred to be in logarithmic scale. I tried different approaches, but none ...
6
votes
1answer
89 views

Two different axis labels in one pgfplots graph

Is there any way in pgfplots describe the positive part of the x-axis labels above the axis and the negative part of the x-axis label below the axis? The point is that if the graph of the function is ...
7
votes
4answers
199 views

tikz/pgfplot — always same distance between marks

Is there a way to get for all tikz-plots in one LaTeX document the same distance between the plot marks, ie the distance between the marks should be independent of sample size. It would be really ...
10
votes
3answers
680 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, ...
0
votes
0answers
91 views

Option payoff diagrams in LaTeX

How can I generate an option payoff diagram such as this in LaTeX with PGFPlots or TikZ?
6
votes
0answers
133 views

Special effects in TikZ leads to unprintable PDF

So I recently made a picture of the Mexican Hat Potential (related to the Brout-Englert-Higgs Mechanism of particle physics). I am more than satisfied with the graph and everything, but I noticed ...
3
votes
1answer
35 views

Align legend label to text

I have this MWE. \documentclass{article} \usepackage{pgfplots} \usetikzlibrary{patterns} \definecolor{nrgray}{HTML}{F0F0F0} \newcommand{\graphTripleData}[4]{ \begin{tikzpicture} \begin{axis}[ ...
11
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 ...
1
vote
1answer
93 views

scatter, group, error bar, and a legend

I want a grouped scatter plot with xy error bars and a legend. So each point is a different group, with its own color, mark, and legend entry. The error bars should have the same color as the mark ...
4
votes
1answer
56 views

One more skipping jump discontinuity in pgfplots

Trying to draw graphs using pgfplots (regarding this library, I am a beginner). I tried to find a solution to my problem (in even offered links), but I was not successful. Is it possible to achieve ...
2
votes
1answer
42 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
102 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 ...
4
votes
1answer
56 views

pgfplots and subfigure

I'm using Springer LNCS template to create a paper, so that I can't use subcaption Using subfigure with pgfplots results in no aligning at all. The code I use to draw plots: \begin{figure} ...
6
votes
2answers
290 views

How to draw this particular Mexican hat potential?

I know there are some other mexican hat questions here, but none of the answers seems complete to me. I would like to draw the following figure with TikZ with similar axis and labeling. How can one do ...
6
votes
1answer
94 views

Calculate axis limits depending on depicted data

In a pgfplots axis environment, I want to make the axis limits dependent on the depicted data or some other data. Consider the minimum working example \documentclass{standalone} ...
4
votes
1answer
59 views

Invert axis using pgfplots and TiKz

I am trying to do a stacked histogram, and I am trying to start from the code provided in this question : Tikz Stacked Bar Chart with Text Yet, I would like to invert the axis, so that the A,B,C... ...
3
votes
1answer
35 views

Changing the properties of only one plot in a ybar

Sorry I am sure there is a simple answer to this but I just can't find it! All I am trying to do is turn off the labels (I think they are called nodes near coords) on the second set of data, ie. the ...
1
vote
0answers
69 views

Memory overload due to pgfplots / tikz

first of all, I need to mention that there are 2 related threads, that I found usefull: 1, 2. I am working with TeXstudio 2.8.8 on Win 7 64bit (i5 @3.3GHz, 8GB RAM - if this matters). My goal is to ...
3
votes
1answer
60 views

Nodes Near coords hide when 0

Is it possible to hide nodes near coords in pgfplots when value = 0 ? I have something like this. And axis setting \begin{axis}[ ybar, bar width=3pt, nodes near coords ]
1
vote
0answers
29 views

pgfplots(table) protect ##1 when in a `\newcommand` with optional arguments

I am using the excellent answer from @percusse to the question How to rotate head row cell entries of pgfplotstable which works great if you always want rotated headers. I am calling ...
2
votes
1answer
39 views

Log mode of short X-axis pfgplots

I'm trying to obtain this graph (made in Origin): Both axes in log scale. This is MWE: \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{units} \begin{document} ...