{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
113 views

Coordinates of intersection

The code generates a strain - stress curve. How can the code be simplified? How can the code be make smarter? Can I make the bezier curve with one draw command? \ShowintersectionB prints just the ...
2
votes
0answers
55 views

Obtaining a particular 3d view in pgfplots

I am trying to achieve the following plot, with the indicated perspective and the axis lines centered: I've played around with several view options and I'm just not able to reproduce the figure. Any ...
20
votes
1answer
1k views

Pre-defined color cycles à la RColorBrewer?

When I have multiple line plots in pgfplots, the colors of the lines cycle through a few colors (my guess is the colors are blue, red, black and dark khaki) before repeating with different marks. See ...
6
votes
2answers
167 views

How to make latex parse `x` as an argument of a macro definition instead of `#1`

When I define a mathematical function for plotting in pgfplots or pstricks I usually to it in the following way: \def\f(#1){(#1)^3 + 3*exp(#1)} just as suggested by Jake in his answer to a ...
8
votes
1answer
139 views

Describe intersections on X axis

I have two functions which intersect at three different points: \documentclass{article} \usepackage{tikz} \usepackage{tkz-euclide} \usetikzlibrary{intersections} \usepackage{pgfplots} ...
1
vote
1answer
87 views

Specify arc radius in coordinate systems units

This is a follow up on Specify radius of an arc with pgfplots and axis direction cs? If I'd like to change the MWE from there to the following: \pgfplotsset{compat=1.10} \begin{tikzpicture} ...
8
votes
3answers
226 views

pgf plot and foreach loop

I have this function y=a*x^2 where a changes (-2.4,-2.1,-1.8,....,2.1,2.4) and i want to draw it with pgf plots. Problem is i dont know how to implement this i think i'll need foreach loop or ...
2
votes
1answer
36 views

PGFPlot equally spaced coordinates

how can i make the plot that the provided x-coordinates are separated visually with the same distance. So instead of 0 500 1000 1500 2000 there should be 0 10 20 50 100 200 ... and the second thing ...
3
votes
0answers
99 views

TikZ binomial distribution plus Gaussian approximation

My intention is to draw the probability function of a binomial distribution with trials = 20 and probability = 0,4. Then i wanna add the curve of an approximate gaussian curve in the same plot. How ...
6
votes
1answer
315 views

legend problem in highlighting a data plot

I followed the tips on highlighting in data plots at http://www.howtotex.com/tips-tricks/highlighting-in-tikz-plots/ The highlighting does not work well with \addlegendentry. A MWE is shown below. ...
5
votes
1answer
114 views

Specify legend entry as \addplot option?

Somehow, specifying the legend entry for each \addplot using the separate command \addlegendentry bothers me... I'm not sure why, probably because my sense of order says that the legend entry belongs ...
5
votes
1answer
272 views

Shell Scheme with pgfplots/gnuplot

I have a problem with pgfplots. I want to create a shell scheme from an E-motor characteristics. In the end it should look like this (well, with some more pleasing colours): The data is stored in a ...
4
votes
1answer
216 views

Increasing dateplot's resolution to seconds

These three dots should be spread out over a period of 50 seconds, but for some reason they all appear at 13:00:30. \documentclass{minimal} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} ...
2
votes
2answers
98 views

Tikz addplot fill between depending on sign

i have following problem. I read data from a table and plot it and then fill the area between the x-axis and the curve. This works fine. Well at least a bit. I want the "negative part" filled in ...
3
votes
1answer
153 views

Undefined control sequence: \pgfmath@multiply@thousand [duplicate]

After updating my MiKTeX distribution, I suddenly got a compile error with a .tex file that compiled perfectly fine before. After removing everything that did not contribute to the error, I ended up ...
4
votes
1answer
127 views

Problem using atan in pgfplots

I'm trying to plot something using atan in pgfplots, but it always results in hundreds of errors. I'm using an example I found here: \documentclass{article} \usepackage{pgfplots} \begin{document} ...
2
votes
1answer
59 views

Pgfplots polar axis: can I draw angle labels rotated as for smith charts?

[This is a question which came up on the pgfplots mailing list. Since it might be of general interest, I post it here.] In pgfplots, the smithcharts library supports an option to draw the angular ...
0
votes
0answers
66 views

XML and LaTeX, including figures PGF plots

I am about to submit an article to a scientific journal. This journal provides some guidelines for those who want to submit the work in LaTeX. Requirements, however, are quite restrictive: Do not ...
239
votes
2answers
27k views

Create xkcd style diagram in TeX

The unique style of the diagrams at xkcd has an informative but nice hand-drawn touch. I guess they are actually drawn by hand but just recently on our partner site for Mathematica someone asked how ...
3
votes
1answer
72 views

Appending arbitrary code to a pgfplots axis environment before curve and axes are drawn

There was some confusion about what I really wanted, so I include the actual use case here. The MWE plus corresponding picture is at the bottom of the post. I made some fancy looking graph, among ...
9
votes
1answer
307 views

pgfplot groupplot fillbetween

I am trying to use the fillbetween package with combined with groupplot and I am having serious troubles. Basically, what I want to have is the error plotted around my curves with a filled area. I am ...
2
votes
1answer
55 views

How to make Loop?

I need to make for loop analog in LaTeX. My code has following form \documentclass[9pt]{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[scale=1.2, font=\tiny] ...
3
votes
1answer
43 views

Set PGFplots coordinate label using ifnum

I can't overcome this little nasty issue. Using \ifnum I set labels position around the coordinates in my pgfplot. This works fine but : I am only able to test if variable \coordindex is greater or ...
1
vote
1answer
51 views

Clipping only the bottom of a graph in pgfplots/tikz?

Is it possible to clip only the bottom of a graph? I have a graph with a node above the area of it; when clipping over the entire thing is enabled, the node is cut away. However, no clipping means the ...
5
votes
1answer
91 views

Logarithmic bar plot

I'm currently trying to create a diagram, with a logarithmic scale on y axis. This mostly works, except that the value of nodes near coords is wrong. Without ymode=log it shows e.g. 20551 as label. ...
2
votes
0answers
28 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 ...
2
votes
2answers
69 views

Bar chart using pgfplots with both positive and negative bars

I am trying to create a bar chart with both positive and negative stacked bars. However, my negative bar doesn't appear/it is hidden behind the positive bars. How should I change the settings to make ...
3
votes
1answer
26 views

change colour of the labels within istogram pgfplots

Given the following code snippet: \begin{frame} \titlesub \pgfplotsset{compat=1.9} \centering \begin{tikzpicture} \begin{axis}[ width=0.9\textwidth, ...
6
votes
1answer
116 views

PGFplots: How to add a legend to “superimposed” plots

I have "superimposed" different plots on the same graph (i.e., I have two axises environments in one tikzpicture environment.) Now I would like to add a single legend for both of the plots and ...
2
votes
1answer
45 views

Suppress auto axis range in pgfplots

I have an axis with two \addplot commands inside in pgfplots. Every \addplot command cause the axis limits to automatically re-arrange in order to show all the plotted data. I would like to suppress ...
0
votes
1answer
102 views

Which software should I use for making high quality graphs? [closed]

I have written a paper in MS-Word. Now, I am converting it into LaTeX. The problem that I am facing is about figures. Some of the figures I have converted using Adobe Illustrator. However, since I ...
1
vote
1answer
49 views

Drawing angles using pgfplots that are identical to angles using TikZ

I am using pgfplots to draw intersecting lines. Three right triangles are made by these intersecting lines - two of them in the third. I am trying to mark the two pairs of acute angles of equal ...
-1
votes
1answer
148 views

Multi figure in one page

edit same as you but dont help------ \documentclass{article} \usepackage{pgfplots,tikz} \usepackage{caption} \DeclareCaptionLabelSeparator{fullstop}{.\quad} ...
2
votes
1answer
63 views

yticklabels Problems

I'm going to draw a certain function from a .txt file. I'd like to specify/to highlight a point of that function on the function itself by a marker and a label. Moreover, I'd like to put a notch on ...
2
votes
1answer
101 views

Legend and caption label of graph

I add 4 legend to my graph and different types of mark. Also, I want the legends to be under the X axis and in one line to each other. Position of legend Also How I can to write caption of this graph: ...
3
votes
2answers
234 views

Projectile Motion Diagram using PGFplots/tikz?

I'm making an equation sheet for my physics class (using LaTeX), and we're doing a section on projectile motion/vectors. Are there any suggestions for drawing diagrams using either plain Tikz or ...
8
votes
1answer
152 views

Tikz path with changing color and arrow decorations

How does one draw a path that is changing color as a function of the path length and is decorated with arrows at the same time? Basically, I want to combine these to figure into one: The code for ...
0
votes
1answer
78 views

How do I create a certain graph using pgfplots?

I can't create this graph or something similar to it. I use pgfplots for plotting.
1
vote
1answer
106 views

Plotting a chart and chart line?

How I can Plot this curve in Latex {revtex4-1}? \begin{center} \begin{tikzpicture} \begin{axis}[bar width=18pt, xtick=data,ymin=0,ymax=45,x tick label style= {rotate=90,anchor=east}] \addplot[ybar] ...
3
votes
2answers
62 views

How to align two pgfplots that are overlapping?

I'm fairly new to pgfplots. I'm trying to graph two things, and have them plot side by side. However, when I use subfigure, my plots (and axes labels) overlap. How can I fix this? ...
1
vote
1answer
61 views

Trim excessive whitespace from top of 3d pgfplots graph

Using the data in this file, I have the following plot: \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \usepackage{savetrees} \begin{document} \begin{figure}[b] \centering ...
4
votes
1answer
75 views

Defining a variable in Tikz and using it in a table

I read the page Define a variable in TikZ about how to define a variable in tikz, but I am trying to then put these values in a table and getting errors. It seems latex is not remembering the white ...
5
votes
1answer
73 views

How can I have text along a path with pgfplots with marks?

I am using the decorations.text library to set text along a path drawn by pgfplots. The decoration works fine without marks, as suggested in this answer, but with marks on the path, the compilation ...
11
votes
1answer
3k views

Trend line or line of best fit in pgfplots

Is there an "out of the box" way to automatically draw the trend line in pgfplots? Below follows a basic illustration of a scatter graph with a line of best fit:
1
vote
0answers
55 views

How do I do a scatter with trend line?

I'm trying to remake this table from an article about Nested Containment List by Alekseyenko: I have a file with all my points in this format: 1183 0.561 1222 0.384 1473 0.425 1941 ...
3
votes
1answer
1k views

tikz externalization and multiple axis using \ref and \label for legendentry

I have a plot consisting of two y-axis. When I'm adding the legendentries in each axis environment, the first legendentry will be plotted "behind" the plot of the second axis. Thus I thought a ...
1
vote
1answer
79 views

Help drawing vectors in a PGFplots axis environment using calculated coordinates and \draw

Why does using \draw and calculated coordinates not follow what a graph of projectile motion ought to look like? Any suggestions for code that would work using formulas in coordinates? ...
3
votes
1answer
91 views

How to set intervals for step-like plot (`const plot`) in pgfplots?

How do I set the precise intervals that pgfplots should consider when performing addplot with the option const plot mark mid? For example: \documentclass{article} \usepackage{pgfplots} ...
1
vote
1answer
53 views

Pgfplot display only x axis, one value point with label and text

I want to plot a chart with one axis and draw a point at a specific value and show it with a label. In addition I'd like to place two label on the min and max tick of x axis. For q better ...
6
votes
0answers
107 views

Plotting time series data

I would like to plot quarterly time series with special x-axis features. In particular, I would like to see small ticks indicating when the quarters begin and larger ticks indicating when the years ...