{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

7
votes
1answer
459 views

How to omit non-integer x-axis ticks in pgfplots?

The following figure has annoying x ticks at 0.5, 1.5 and 2.5. Non-integer values have no interpretation for my purpose. Question: How can I get pgfplots to exclude non-integer x-axis ticks? ...
16
votes
1answer
2k views

Plotting Normal distribution in pgfplots

I'm trying to reproduce the following diagram in TikZ and pgfplots. My MWE with regenerated graph is below: \documentclass{standalone} \usepackage{pgfplots} \begin{document} ...
5
votes
1answer
267 views

Automatically choosing preset color schemes in pgfplots based on number of entries

This is really more of a question to satisfy personal curiosity than to solve a real problem. When choosing the colour schemes for my plots, I try to select colours that will work well with the ...
1
vote
1answer
137 views

Does anyone know if the listed prerequisites for TikZ's pgfplots package are slightly off?

Does anyone (not to specifically ask Christian) know if the prerequisite PGF/TikZ version listed in the PGFPlots manual is off by a bit? I've been trying to use \tikzset{external/mode=list and make} ...
2
votes
2answers
1k views

Remove border around area legend rectangle

I have a legend with the option area legend to draw a little rectangle in the legend instead of a line segment. There is a border around the rectangle I would like to either remove or make the same ...
4
votes
1answer
209 views

Use of rnd in pgfplots

The following code fails to compile due to the use of rnd: \documentclass{article} \usepackage{tikz,pgfplots} \pgfplotsset{width=7cm,compat=1.3} \begin{document} \begin{tikzpicture} \begin{axis} ...
4
votes
1answer
1k views

Undefined control sequence: \pgfplots@data@xmin

I am trying to use Jake's excellent Tufte y bar chart style but I am getting an ! Undefined control sequence. <argument> {rel axis cs:0,0}-|{axis cs:\pgfplots ...
3
votes
1answer
643 views

Align plots in pgfplots

Can somebody help me? I try to align two plots horizontally in pgfplots! In the preamble I have: MWE* \documentclass[12pt]{article} \usepackage{pgfplots,subcaption} \pgfplotsset{ compat=1.7, ...
14
votes
1answer
1k views

How to plot circular polarized electromagnetic wave

I am searching for a solution to get nice looking circular polarized waves in my latex document. My goal is to get a graph that looks like this: I do not want the graph to be animated but I can not ...
2
votes
1answer
219 views

ytick pgfplot issue

I have the following latex code but unfortunately cannot get the ytick to be of my choice. \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{center} ...
6
votes
1answer
3k views

Specific error bars in pgfplots possible?

For plots with a lot of points it often looks very crowded if each point has its own error bar. Is there an easy way to only draw certain error bars in pgfplots? I could not find any option besides ...
8
votes
1answer
3k views

change color of pgfplot bar plot

I want to plot two bar plots next to each other. This works without a problem. However both use the first color defined in a pre or selfdefined colorseries. I tried to modify the color manually in the ...
5
votes
1answer
2k views

How to align PGFplot subplots

I am using the matlab2tikz MATLAB function to export a MATLAB figure with subplots to tikz code. Unfortunately the subplots do not align properly. The post PGFplot to occupy full \linewidth, and ...
1
vote
0answers
334 views

change color of nodes in pgfplots bar plot [closed]

I have a bar plot which print the number next to the bar. The text is however not very well readable due to the color applied to it. Therefore I would like to know how to modify its style. ...
12
votes
1answer
1k views

Creating Bezier surfaces using procedural graphics

Are there any package for LaTeX that can create Bezier surfaces? I mean a actual existing function that takes matrices as arguments and generates the surface, not a function written by myself.
5
votes
1answer
792 views

How to increase/fit the width of x-axis to fit all points in pgfplots?

This is my code: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[scale only axis, symbolic x ...
7
votes
2answers
2k views

Easy creation of logarithmic grid with TikZ

Is it possible to create a logarithmic grid using the command below with TikZ? \draw (-0.1,-0.1) grid (4.1,4.1); It would be great to be able to create a logarithmic grid without having to specify ...
7
votes
1answer
325 views

Problem of superimpose and how to change legend symbol

Given the plot as follows I have two problems: a and b are superimposed on each other, how should I make this clear on the graph? How could I change legend c to other icons like star? (It looks a ...
6
votes
1answer
1k views

Multiple different meta for marker color and marker size

How do I set the color of a marker with one meta column in a table AND its size with another meta column? So in this minimal working example, how can I set the marker size with 'w1' and the color ...
9
votes
3answers
515 views

How to draw two intersecting graphs?

I want to make the following figure. My efforts are: \documentclass{standalone} \usepackage{pgfplots} \usetikzlibrary{calc,shadings} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
1
vote
0answers
196 views

How to bring beauty to this pgfplot? [closed]

We are making a plot as follows: \documentclass{standalone} \usepackage{pgfplots} \usetikzlibrary{calc,shadings} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \def\xmin{0} ...
3
votes
1answer
1k views

pgfplots - Number above one of the bars in the bar chart

I want to put a number above only one of the bars in the bar chart. For example, above the bar A, I want to put a number say 200. Other bars will not have any number at the top. This is my code. ...
3
votes
1answer
337 views

problems with pgfplots/ymax

I have two figures that I'd like to connect; both are generated with pgfplots (and in this example, gnuplot). The following works exactly as expected: \documentclass{beamer} \usepackage{graphicx} ...
10
votes
1answer
196 views

Is there an easy way to change the column order of a pgfplotstable?

I am aware of Rearrange data in pgfplotstable but I was hoping for a kind of one-pass solution that doesn't spread the table over so many commands but is rather self-contained within ...
7
votes
1answer
2k views

Filter rows from a table

I have a large table that contains results for many instances, and I want to make separate tables and plots grouped by one (or more) field. In this minimal working example, I want to make a table and ...
3
votes
2answers
1k views

Distance of the labels from the axis

I am a beginner with the package TikZ. I am using pgfplots to produce a very simple plot. The code I am using has been copied from an example found on the web, but my output is different from the ...
8
votes
1answer
544 views

Normalize curves in a plot by the area under the curves

In the MWE below, there are two tables, with one (common) column of x values and two columns of y values (A and B) in each table. They are plotted in the same plot, after normalization to the maximum ...
3
votes
1answer
275 views

What does error bars/.cd do?

In pgfplots, if you want error bars, you have to write error bars/.cd into each addplot that should have error bars. What does it mean and what does it do and why do I need it?
8
votes
1answer
367 views

how to draw plots without data in tikz?

I want to draw this plot. I know how to do it with data. But here I don't have any data. And I want to draw this. How would I do it?
4
votes
2answers
4k views

How can I install pgfplots on the home directory with or without sudo rights?

I need to use some packages at my uni network so I can compile my projects there too but I am pretty sure it doesn't have pgfplots (from looking at the log) perhaps some others. All the tutorials ...
8
votes
1answer
659 views

How to reuse the plotmark styles from PGFPlots outside the tikzpicture environment?

In a figure caption or in the main text I want to reuse the style of the plotmarks or the combination of line and symbol as in the figure legend. As I did not find a command to reuse the legend image ...
7
votes
1answer
1k views

pgfplots: color a (3D) surf using arbitrary RGB colors

I would like to color a surf using arbitrary RGB colors (unlike this question, which just colors the surf using the colormap). In this minimal example (which plots the x+y function), I would like the ...
5
votes
1answer
400 views

How to plot just part of the function with pgfplots, gnuplot

I have the following code. \begin{tikzpicture} \begin{axis}[domain = -2:2 ,y domain = -2:2,view={0}{90}] \addplot3[contour gnuplot={number=10},thick,domain=-2:2] ...
2
votes
1answer
515 views

error while using gnuplot in pgfplots

I am using pgfplots and tikz library for generating some figures. my problem is that I can not use gnuplot within pgfplots. I tried to compile the following code bu seemingly the gnuplot is not ...
6
votes
1answer
1k views

2D colors above 3D surface plot

I would like to draw a 2D, colored plot of a function above its surface plot. I tried copying the surface plot and setting z filter/.code={\def\pgfmathresult{1.4}}, but then everything is the same ...
8
votes
1answer
694 views

Does anyone know the default mark size for a circle in pgfplots?

I'd like to use the mark size option relative to the current default size of a circle mark. Page 130 of the pgfplots manual mentions that the dimension for a circle is the radius, but does not ...
2
votes
1answer
347 views

Labels in xtick with pgfplots

I am using Pgfplots to make a very simple graph. I already have the code below \documentclass{article} \usepackage{tikz,pgfplots} \pagestyle{empty} \begin{document} \begin{tikzpicture}[>=latex] ...
2
votes
0answers
481 views

How to use tikzexternal? [closed]

I use some huge file to plot and for this I changed the tex conf file to increase memory that works. But I would like use instead external memory for this I try to use tikzexternal. But I fail. MWE ...
3
votes
1answer
590 views

Spacing bar between bars is too high in a bar plot with error bars [closed]

\documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ title = {ring enrich.}, ybar, width=10cm, xtick={1,2}, xticklabels={% before, after, }] ...
8
votes
2answers
718 views

Use function to scale x axis

Please consider the following plot (code see bottom). The curves are the result of the function q[D]=sqrt(2*s*D/h), whereas h=0.01 and s is equal to 0.1 (blue) respectively 0.01 (green). Now, I ...
14
votes
2answers
1k views

Allow underscore in PGFPlots tick labels read from table

I'm trying to use the text data from a table column as the tick labels in a plot. The text data contains underscores, which makes LaTeX throw a Missing $ inserted error. I'd usually get around this by ...
2
votes
2answers
2k views

Can't load file for bar plot

I have the following: \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{filecontents} \begin{filecontents}{testdata.csv} Probe Mittelwert ...
22
votes
1answer
572 views

Does pgfplots support “spatial” plotting?

As the title states, I like to know if I can plot "spatial" with pgfplots. And I think I have to explain what I mean by that (I couldn't find a good expression in english): In a pgfplots 3d plot, ...
2
votes
1answer
167 views

pgfplots - x unit, space between label and parantheses

Can I specify the space between the label and the parantheses when using x unit in pgfplots? In my example image, I want less space (\,) between the E and the [eV].
2
votes
1answer
1k views

Moving axes labels in pgfplots

How can one have an axes labels (x and z near the axis) like this:
8
votes
1answer
600 views

pgfplots - x unit with siunitx

I want to use x unit=something to draw the units to an axis. In the manual I find this to use siunitx to do so: \pgfplotsset{ unit code/.code 2 args={\si{#1#2}} } Now I make a plot: ...
10
votes
1answer
572 views

Plot magnification using sub-plot within a plot!

How can I produce such kind of zooming shown in the figure? Here the selected portion is plotted again with new axis displaying more details than just magnifying the portion. One solution is to ...
8
votes
1answer
698 views

plotting two time series with bounds

I've two times series (y_h, y_f) with a lower and upper bound (confidence interval). I'd like to plot all of them on the same picture. I've succeeded in plotting y_h with upper and lower bounds, but i ...
3
votes
1answer
522 views

How do I change the color of one axis in pgfplots?

I know how to change the color for all axis in pgfplots: \begin{axis}[blue] \end{axis} This makes all four edges of the plot blue. Another example is there: PGFPlots: Change the color of axis lines ...
10
votes
1answer
2k views

Add grid only on y-axis (pgfplots)

I would like to add only a grid on the y-axis. Here is my MWE: \documentclass{scrreprt} \usepackage{tikz, pgfplots} \begin{document} \begin{tikzpicture} \begin{semilogyaxis}[ /pgf/number ...