{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

2
votes
0answers
28 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 ...
5
votes
2answers
1k views

Area between curves

I want to fill the area of a region R bounded by x=f(y), x=g(y), y=A and y=B. For example, R is bounded by x=0, x=2/y, y=1 and y=4.
2
votes
1answer
68 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 ...
3
votes
0answers
57 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
87 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
48 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. ...
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
89 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} ...
10
votes
2answers
2k views

Pgfplots axis, option to remove (or ignore) legends

Is there an option in pgfplots at the axis level or a setting of legend style option, that would effectively ignore the subsequent legend entries in the plot? \documentclass{article} ...
4
votes
1answer
41 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 ...
3
votes
1answer
46 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 ...
1
vote
2answers
49 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 ...
4
votes
1answer
98 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} ...
1
vote
1answer
133 views

pgfplots - plusminus doesn't match its definition

I've been trying to make a ybar plot with error bar using pgfplots. I want to make this graph inside a tex template, but one weird thing has occurred - when I inserted the following code (be more ...
1
vote
0answers
33 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
171 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 ...
0
votes
1answer
72 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
1answer
47 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
34 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 ...
5
votes
1answer
92 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
76 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 ...
2
votes
1answer
88 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 ...
2
votes
1answer
87 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
63 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
46 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} ...
4
votes
1answer
69 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
47 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 ...
2
votes
1answer
108 views

What exactly are the 'unsuitable tick labels' mentioned in pgfplots' compatibility warning?

When I use pgfplots, I get the following warning: Package pgfplots Warning: running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing ...
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
0answers
62 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.
14
votes
2answers
4k views

Using a pgfplots-style legend in a plain-old tikzpicture

I am using a plain-old tikzpicture to produce a pie-chart-like plot. Now, all other plots in my paper are handled using pgfplots (which doesn't do pie charts) and have their legend typeset by ...
3
votes
2answers
247 views

How can I plot an implicit function in pgfplots without having to use gnuplot?

I have been trying to plot a couple of really simple implicit linear functions using only pgfplots internal facilities. Here is my MWE: \documentclass{article} \usepackage{pgfplots} ...
1
vote
1answer
90 views

How to change x-axis label position only horizontally keeping the default vertical value using pgfplots

I have two plots of different width next to each other. I want them to share one x-axis label. For this I take the x-axis label of the left plot and shift it to the right so that it is perfectly ...
8
votes
1answer
130 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
1answer
55 views

Axis drawn longer than specified

The y-axis in the following graph is about ten times higher than I want it to be. The graph has a maximum height of 0.5 units. I specify that the y-axis should go up to 2 units. ...
2
votes
1answer
83 views

How to get two data series in tikz plot?

How do I create a second data series from the code below? I have tried separating the two curves with curly brackets but it was not the correct code. \begin{figure}[h!tp] \centering ...
3
votes
1answer
82 views

Labeling only one tick mark but having other tick marks on x-axis

The code provided has pgfplots mark 5 tick marks on the x-axis (at increments of 5 starting at 5). I would like to have only one extra tick mark labeled - the one at 2. \documentclass[10pt]{amsart} ...
4
votes
1answer
45 views

How can I make my pgfplots title multiline

I tried title = {really\\ long title} but it does not work. One thing that I find is working is to use title = {\parbox{0.4\textwidth}{\centering really long title}}. But this is not as flexible. Is ...
1
vote
1answer
591 views

Plotting Multiple Time Series plots in LaTeX using PGFplots and txt files - Relativity Issues

I have a problem with plotting multiple time series plots in a single graph in Latex. Background: I have three products - Potatoes, Apples, and Oranges. Each products' historical price and ...
1
vote
1answer
127 views

How to put legend below the chart?

I have the following code that produces a line chart: \begin{figure}[p] \centering \begin{tikzpicture} \begin{axis}[ use units, cycle list name=exotic, %This defines the color. It ...
2
votes
1answer
97 views

Drawing lines half the thickness of the default thickness [closed]

In the following code, two triangles are drawn - one is the reflection of the other across the line y=x. I would like to have a line, with the command \draw[loosely dash dot], drawn either half or a ...
4
votes
1answer
59 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
0answers
45 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} ...
5
votes
2answers
74 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} ...
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
47 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 ...
1
vote
1answer
34 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 ...
5
votes
1answer
138 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
73 views

round operation within tikzpicture [closed]

I'm having a problem with the following plot.In particular I would expect to see a function decreasing by finite steps.It should not decrease gradually as it does in the following plot: ...
6
votes
3answers
448 views

Calculate function with integers as input and plotting

I'd like to plot the function 1/2*x(x+1) in for integer values ranging from 3 to 20 and in particular I'd like the function to be plotted in those points. I have managed to create the following graph ...