{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

1
vote
1answer
46 views

How to change font for axes, labels, etc in pgfplots using fontspec (lualatex)?

I need to make figure with Garamond font applied to axes and labels, as well to text in nodes. This is my MWE: \documentclass[12pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} ...
3
votes
1answer
38 views

How to calculate “extra y ticks” value by function instead of giving a fixed value

The code is as follows: \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \begin{document} \tikzset{ declare function={ func(\x)= \x*\x; } } \begin{tikzpicture} \def ...
3
votes
0answers
60 views

Defining a function for later use in TikZ or pgfplots

Not sure what my problem is. I'm trying to define a function to later use in 3D plotting. As of now, I've tried to simplify the code as much as possible to find the error, so realize these are not the ...
2
votes
1answer
77 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
90 views

Trouble updating pgfplots on Windows/MikTeX

I'm trying to update to a newer version of pgfplots, preferably v1.12. I'm currently using v1.7. First, I opened Update (admin mode) with MikTeX and it didn't have any updates for pgfplots. Then I ...
2
votes
1answer
50 views

How to scale axes in tikz package

I want to scale my drawing without distorting the graph and the text within the plot. My current code shows the drawing in 1:1 scale. What I want is to show it in a rectangular scale. ...
3
votes
1answer
152 views

Is there a way to draw a Voronoi diagram with pgfplots?

I want to draw a voronoi diagram with pgfplots, but sadly I cannot get it the way it should look like. I used the Matlab command to get the x and y coordinates and saved them as a dat-file. In that ...
6
votes
1answer
80 views

Is version control for figures possible in LaTeX?

I have a long document with multiple graphs. All graphs are done using pgfplots and I'm using tables stored as separate text documents. For instance, to plot data from a table big_table_with_data.txt, ...
4
votes
1answer
96 views

How to node foreach value in math equation?

I'm trying to plot roots of $(-1)^{n}$. The code works fine \documentclass[9pt]{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \def \n {7} \begin{center} ...
2
votes
1answer
66 views

PGFplots z buffer does not sort the plotted objects properly

I have a PGFplots axis environment in which I attempt to plot several line objects and a surface object. The objects have to be 'sorted' in the sense of which object is drawn before or behind the ...
3
votes
1answer
53 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 ...
4
votes
1answer
48 views

pgfplots + unicode-math + lualatex gives the error “kernel/command-already-defined”

With the following MWE compiled with lualatex, I get the error: ... LaTeX error: "kernel/command-already-defined" Control sequence \crampeddisplaystyle already defined. ... l.637 ...
1
vote
0answers
36 views

How to fix pgf boxplot error with only zero value in samples?

Following this previous question I am still figuring out how to properly handle different "borderline" cases with the boxplot feature provided by pgfplots. The following MWE: ...
8
votes
1answer
172 views

Coaxial cable in pgfplots

I want to draw a coaxial cable using pgfplots. It more or less has to be done within that program because in my document, I also want to add some 3D plot next to the cable. (I guess a solution using ...
6
votes
0answers
48 views

Pgfplot image messed up with newer texlive [duplicate]

EDIT: The question has been marked as duplicate, since the fillbetween not working in groupplots is a known issue in pgfplots newer than 1.10. But the question remains, that why doesn't using ...
4
votes
1answer
100 views

What is wrong with this PGFPlots Boxplot?

The following MWE: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{pgfplots.statistics} \pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture} ...
3
votes
1answer
35 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
50 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 ...
1
vote
2answers
53 views

xbar plots in pgfplots 1.12 gives empty y axis range warning

The following MWE works great with pgfplots v1.11, but gives a warning about an empty y axis range with v1.12. I didn't see anything in the README that would indicate a change has been made to the ...
5
votes
1answer
97 views

Remove tick marks on only one axis in pgfplots

How do you remove the tick marks on only one axis in pgfplots? In my MWE, you'll notice slightly darker part to the y grid lines where the ticks are. I'd rather just have the grid lines, with no ...
1
vote
0answers
79 views

Combining logarithmic scale and self-defined ticks on colorbar

I'm trying to make a heat map of matrix form data, with logarithmic scale on the colorbar, I'm essentially following the advice here. But the problem I am having is that I have the ticks set on weird ...
0
votes
1answer
73 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 ...
2
votes
1answer
93 views

Survival Curves with pgfplots

I'd like to plot Kaplan-Meier (survival) curves with pgfplots from output generated in Mathematica. A typical output table would look something like this: 211 1 253 1 307 1 344 0 365 0 365 1 ...
0
votes
0answers
64 views

Convert from rectangular coordinates to polar coordinates

The following code gives me the display that I want. The only modification that I want is to specify the points in polar coordinates with the same radius. (These points are on a unit circle centered ...
2
votes
1answer
47 views

pgfplots: addplot3 color particular planes

using \addplot3 how do you shade in particular planes? e.g., If we consider the unit cube, I want to shade the plane x = 1,y = 1, z = 1. This is all I've got so far: \begin{tikzpicture} ...
2
votes
1answer
48 views

How to plot with tikz without graduations in the axis?

I'm trying to plot a function with tikz and let the plot as clean as possible, but I can't remove the lines along the axis. Can anyone help with this? \begin{tikzpicture} \begin{axis}[ axis ...
4
votes
1answer
72 views

Why doesn't normalizing the vectors in quiver plot work?

I'm creating a vector field using the quiver plot and I would like to have all the vectors of unit length. Why doesn't the following work? \documentclass{article} \usepackage{pgfplots,} ...
2
votes
1answer
97 views

Reduce pdf file size for large image produced by pgfplots

I created a plot using pgfplots. The plot is embedded in a document. The total size of the document is about 26 MB, while the plot is 12.5 MB. The plot contains a lot of data which makes the pdf ...
0
votes
0answers
64 views

Graph functions & color area under curves

Could anyone help me with the attached images below as far as coding the axis's and shading the area? I'm new to anything graphing in LaTeX and would love to have some guidance.
8
votes
1answer
132 views

Why does PGFplots plot more than the desired range in a 3D plot?

I would like to plot a function in the range [-2, 2], but PGFplots keeps plotting a little bit more: Why is that the case and how do I fix it? Code \documentclass[varwidth=true, ...
2
votes
0answers
49 views

vertical axis doesn't show in ymode=log with pgfplots

Consider the following MWE (mostly copy-pasted from this example) : \documentclass[12pt,% a4paper,]{scrreprt} \usepackage{pgfplots} ...
4
votes
1answer
62 views

How to plot two line graphs on top of one another in pgfplots

I need to make a graph of two or three different plots, each sharing the same x-axis but having different y-axes, one on top of another. Kinda like this except that I don't really need that second ...
2
votes
1answer
66 views

Why do I get a “Dimension is too large” error?

\documentclass{article} \usepackge{pgfplots} \usepackage{tikz} \begin{document} \begin{figure}[H] \centering \resizebox{0.80\textwidth}{!}{% \begin{tikzpicture} ...
0
votes
2answers
36 views

Chart Axis won't properly display the quadrant

I have a graph which has data in the 4th quadrant. Unfortunately, the visible axis orientation is such that the chart appears in the 1st quadrant. Is there any way that I can move the x-axis to the ...
1
vote
1answer
88 views

2D histogram from a single row of a table, with discrete axis

I am trying to make an animation from a table that contains a row for every frame (year) where the rows are a 9x7 matrix unzipped: Date, Row1Col1, Row1Col2, ..., Row9Col7 1864, 0.65, 0.01, ...
1
vote
1answer
37 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 ...
1
vote
1answer
49 views

pfgplots groupplot with more than one \addplot per \nextgroupplot?

I'm having trouble making a group plot in pgfplots. I want to have 2 separate graphs, each with two regression lines and two sets of dots, but groupplot lumps everything onto 1 set of axes. I can't an ...
5
votes
3answers
180 views

Specifying some points in rectangular coordinates and other points in polar coordinates

I would like to draw a right triangle inscribed in a circle on the Cartesian plane. In the following code, a circle of radius 3 and center (1,1) is drawn. One side of the triangle, the hypotenuse, is ...
5
votes
2answers
77 views

Pgfplot, show mark when distance along the path is reached

Is it possible to show marks when there is a certain distance along the path has been reached? Example With \documentclass[10pt,tikz]{standalone} \usepackage{pgf} \usepackage{tikz} ...
5
votes
1answer
140 views

How to use fewer markers while keeping curve details?

I am trying to add a few markers to a curve with lots of points, like shown below, but without resorting to the second addplot: \documentclass{article} \usepackage{pgfplots} \begin{document} ...
0
votes
0answers
45 views

Using tikzlibrary spy without magnifying line width and/or mark size with groupplots

This question has been asked before here: Using tikzlibrary spy without magnifying line width and/or mark size However, I have a problem with its solution. I tried both solutions posted and I would ...
5
votes
2answers
81 views

Showing filled graphs from pgfplots, slide by slide with beamer

I want to uncover two plots one at a time using a combination of beamer and pgfplots. The MWE below highlights three attempts. The first attempt uses \onslide but doesn't seem to have any noticable ...
6
votes
1answer
70 views

Plotting graphs from csv with pgfplots?

I am trying to plot a graph using pgfplots in which the data is read from a CSV file. My points show up fine, but when I try to add a regression line, it appears as a vertical line at x=0. Can anyone ...
2
votes
0answers
25 views

pgf stacked bar plot not displayed correctly - wrong intersection with x-axis

I'm trying to generate a bar plot with the code below. As you can see does the bar plot not start at zero, as it should. It starts below zero!!! Can anybody help me? ...
3
votes
0answers
41 views

pgfplots + gnuplot: why does setting clip = false in axis options completely ruin graphs of implicit functions?

Here's a MWE: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[xmin = 0, xmax = 1.5, ymin = 0, ymax = 6.2831853072, ...
3
votes
1answer
41 views

TeXStudio: Why can't pgfplots open gnuplot output anymore?

Here's the minimum not working example: \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[ ...
3
votes
0answers
60 views

PGF: draw longitudinal arcs in 3D axis environment

I want to draw a sphere, similar to the first one here: http://www.texample.net/tikz/examples/map-projections/ But - of course - different. This is, what I did so far: The dashed lines are behind ...
-1
votes
1answer
55 views

Dashed line in pgfplots not working

Please look at this document: https://www.overleaf.com/2201174ypzqyy You can see that the bottom figure has a dashed line while the top does not, even though they both have dashed in their addplot ...
4
votes
1answer
40 views

restricting a pgfplots-based curve on a specified axis

I'm new to pgfplots and I'm having some trouble figuring out how to restrict a curve to a certain x-axis range. I've created a pgfplots based figure shown below It is based on the following tex ...
3
votes
1answer
24 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 ...