{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

5
votes
1answer
85 views

Repeat geometry / body / object / shape in PGFplots

I depicted a pentahedron by means of the code \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset { plotOptsA/.style={surf,patch,patch type=triangle,shader=faceted interp}, ...
5
votes
1answer
48 views

Creating different coordinates with the same macro

I am creating a 3d image using pgfplots. To specify certain coordinates, I created a macro \newcommand{\setpolarcoord}[4]{ % {Name}{r}{theta}{phi} \pgfmathsetmacro{\tx}{#2*sin(#3)*cos(#4)} ...
7
votes
1answer
100 views

Macro for pgfplots/gnuplot exponential regression line

I am trying to create a series of plots with exponential regression that are automatically generated from comma/tab separated .csv files and pgfplots with help from gnuplot. When not using macros I ...
2
votes
1answer
48 views

Problems plotting histograms as a line graph?

I would like to plot some percentages as a line graph, so I tried this: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=2.12} \begin{document} \begin{tikzpicture} ...
5
votes
2answers
131 views

Bar graph-PGFPlots

first sorry for my English. I wonder how to make a bar graph like figure. I tried with this code PGFPlots package, but is not good. Someone knows how to do this? \begin{tikzpicture} \begin{axis}[ ...
6
votes
2answers
77 views

Help with plotting the following

Bellow is the following code that I currently have, I am just struggling to replicate the graph as accurately as I would like. The actual functions for the graphs are quite complex so i am just trying ...
1
vote
0answers
34 views

Part of surface plot missing

I have created the following plot using pgfplots I'd like to remove the white patches (marked in red). Here's my code \begin{tikzpicture} \begin{axis}[grid = major, grid style={dotted}, ...
1
vote
1answer
39 views

How can I plot error bars on the first and last points in pgfplots?

I have a number of data series to plot with error bars, but since they might overlap in the middle, I'd like to show error bars for only the first and last points. All the data points will have the ...
2
votes
1answer
42 views

Apply same options to multiple `addplot` in pgfplots

Can I apply the same options to all addplot's in a single axis environment in pgfplots? For example: \begin{tikzpicture} \begin{axis} \addplot[%plot 1 color = red, ...
1
vote
1answer
110 views

Plotting a 2D slice of a 3D data set

I am plotting 3D data sets as surface plots, but sometimes I need to show a slice of the surface plot by restricting either the x-value or the y-value. I have provided a MWE, showing The surface ...
2
votes
2answers
45 views

How to make a legend entry image consist of line, pattern and markers in pgfplots

I'm trying to make the legend entry image look like a chunk from the "whole" of the following plot (so it has a line, pattern lines and marker). Is it really possible? I'm after an unsuccessful ...
2
votes
1answer
47 views

Point meta not working for for coordinates plot, example page 186 PGFplots manual Revision 1.12 (2015/01/31)

On page 186 of the PGFplots manual Revision 1.12 (2015/01/31) an example of the use of point meta is given: \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
3
votes
2answers
187 views

Change edge color of pgfplots patches

I am plotting patches and do not want them to be colored according to their z-values. Instead, I want to define the colors by myself. Here is an example: \addplot3[area legend,patch,forget ...
5
votes
1answer
55 views

Construct colormap for iso / level surface in PGFplots

I am trying to construct a plot of a surface in 3d of which the color of the surface is dependent on the z coordinate. The difficult part is that I need the color to vary 'discretely', not ...
7
votes
1answer
84 views

How to make a figure showing growth of functions but with scaled y-axis in latex?

My problem is I would like to make a figure in LaTeX, which looks like the picture. It's important that the y-axis is scaled in a similar way as the picture. BTW I'm using Windows, MikTeX and ...
1
vote
0answers
29 views

Pgfplots surface looks “wiry” [duplicate]

I've plotted a function from some values, given in the form: x,y,z -2.4,-2.4,0.00208966369454526 -2.3,-2.4,0.00245568047497186 -2.2,-2.4,0.00284901821144199 -2.1,-2.4,0.00326424484110634 ...
0
votes
0answers
49 views

pgfplots won't plot from CSV

I have a file called 'dat.csv' that contains data in the following format: x,y,z -2.4,-2.4,0.00208966369454526 -2.3,-2.4,0.00245568047497186 -2.2,-2.4,0.00284901821144199 ...
5
votes
1answer
62 views

Erroneous depiction by use of `\draw` and `\fill` commands in PGFplots `axis` environment

I am trying to use table data to construct a patch surface plot. In doing so, I use pgf/tikz, pgfplots, pgfplotstable and the command \edef. My code: \documentclass{standalone} \usepackage{amsmath} ...
3
votes
1answer
99 views

Is it possible to choose the base line of the ycomb?

Is it possible to choose the base line of the ycomb (vertical lines)? For example, in log scale, the default base line is at y=1 (or y=10^0). But I would like to make it at y=0 (i.e. minus infinity). ...
3
votes
1answer
67 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
59 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
23 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
46 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
40 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
73 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
58 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
116 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
76 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
43 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
53 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
167 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
96 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
145 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
46 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. ...
17
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
172 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
43 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
40 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 ...
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
106 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
32 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
57 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
83 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
67 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
118 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
106 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
210 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 ...