{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

3
votes
1answer
86 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
604 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
129 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
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
0answers
48 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
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} ...
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
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 ...
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 ...
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} ...
6
votes
3answers
449 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 ...
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 ...
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 ...
5
votes
2answers
80 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 ...
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
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
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
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 ...
6
votes
1answer
82 views

Flowchart-decision shape - enforce aspect of pgf diamond shape

I am using TikZ/PGF to build a flowchart. To construct the shapes I need, I used the flowchart package plus the ones given in this excellent answer. I modified the decision shape to have the aspect ...
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 ...
0
votes
1answer
52 views

Why is the scaled ticks label placed incorrectly?

See the following example, created by matlab2tikz. I removed a lot of lines to simplify the problem. \begin{tikzpicture} \begin{axis}[% width=0.99266\figurewidth, height=\figureheight, xmin=0, ...
9
votes
1answer
420 views

Switching math fonts and back to normal fails in figures?

For my current document I want to use a normal serif font for the main text. Most diagrams from other sources and myself are with sans serif fonts (TeX Gyre Heros). Now I want to use pgfplots to ...
1
vote
1answer
55 views

After setting the samples parameter, why are gnuplot plots misaligned relative to background TikZ grid?

In order to run this code, you'll need to have gnuplot installed. In addition, you'll have to have your editor/workflow ensure that the --shell-escape option is passed to pdflatex, so that TikZ can ...
0
votes
2answers
58 views

How can I align plots generated by pgfplots relative to a background TikZ grid?

Consider the following code: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{plotmarks} \begin{document} \begin{tikzpicture} \draw[<->] (0,5) ...
4
votes
2answers
205 views

Illustration of Lagrange multipliers

I want to draw with pgfplots and/or tikz an illustration of Lagrange multipliers. For reminder, Lagrange multipliers are used to optimize thing like this: min_x f(x) such that g(x)=0 Basically, I ...
2
votes
1answer
23 views

How to change the tick labels of extra ticks in a loglog plot made with pgfplots?

I am trying to make the tick labels of extra ticks of a loglog axis (ie in the MWE, extra x ticks={.5}),consistent with the "log ticks with fixed point", the general format of the label ticks in the ...
1
vote
1answer
42 views

problem with intersection points in pgfplots

Using pgfplots I have a region enclosed within three lines and the axes. I used the intersections library as indicated by this solution. The problem is that the intersections do not all seem to be ...
2
votes
1answer
52 views

plotting complicating funtions

Is it possible to plot the function 1/{1+\frac{1}{x}} from 0 to 20 using tikzpicture, when I do it I just get a straight line \documentclass{article} \usepackage{pgfplots} \begin{document} ...
1
vote
1answer
28 views

Changing only arrow direction on y axis

I want to change the direction of the arrow at y axis, so that 0 still starts from the top and minus increases in direction of the arrow. here is the code (I am having more charts thats why I added ...
6
votes
1answer
147 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 ...
4
votes
1answer
46 views

How to change spacing and labeling in tikz group plot?

I'd like to learn how to change my labels from generic (A) to (My special label) individually for each graph as well as create additional space so that the graphs and their respective labels don't ...
3
votes
1answer
251 views

Build a real histogram in pgfplots

Always in my long learning TikZ, I would build a "real" histogram from the following set of data : xi ni 1000 5 1200 8 1500 24 2500 13 3000 2 The idea is to group the data into ...
3
votes
1answer
61 views

Font size in pt (pgfplots)

how can I set the font size in pt in pgfplots? Reduced to the basics, my document looks like this: \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{ compat=newest, ...
9
votes
2answers
110 views

Area between two curves which are functions of y, not x

I would like to shade the region between x=y^2 -1 and x=1-y^2. I would like to be able to write something like, \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{every ...
2
votes
1answer
46 views

“Collision” between marker labels in pgfplots scatter plot

Sometimes, it's hard to avoid "colliding" marker labels in scatter plots, by which I mean labels that overlap each other. If I don't want to remove data points to avoid the overlap, is it possible to ...
9
votes
2answers
652 views

pgfplots data time format

I have this type of data set: Time State 22:54:14.716 5 22:54:14.716 5 22:54:14.716 5 22:54:14.716 5 22:54:14.729 4 22:54:14.919 1 22:54:14.919 1 22:54:15.128 5 I ...
2
votes
1answer
78 views

A very simple positionning problem using pgfplots standalone geometry and tikz package

I try to find information in the big list of pgfplots question on tex, without success, so this is "one more question" from a beginner about pgfplots, standalone, geometry, tikz combo package. I need ...
2
votes
0answers
61 views

Adding error bars to PGFPlots [on hold]

I know there's got to be an easy way to do this, but I can't figure it out right now. I'm just trying to add error bars to my plot. Here's what I've got without error bars: \documentclass[reprint, ...
5
votes
1answer
274 views

Generate 3d surface plot using black and white heightmap and pgfplots

I am searching for the best way, software or script (latex, python, R, octave), to interactively draw or paint some 3D surface plot for pedagogic usage. I finally found a way to generate and ...
10
votes
1answer
199 views

Visualize singular vector fields with TikZ or PsTricks and friends

I am trying to find a good way to make really visually appealing plots of singular vector fields. For example electric fields of point like charges. I already tried this in python without too much ...
1
vote
1answer
56 views

Changing font size of marker labels in pgfplots scatter plot

How can I change the font size of marker labels in a pgfplots scatter plot? I've tried label style={font=\small} in \pgfplotsset as well as adding scatter/@pre marker code/.code={font=\small}, to no ...
5
votes
2answers
81 views

sinc function amplitude wrong in pgfplots

It seems that pgfplots has a problem with plotting the sinc function, aka sin(x)/x. Why is the amplitude wrong? It should be 1 at x=0. As to my knowledge the y-scale is nonsense (compare ...
0
votes
0answers
25 views

How to compile creating externalized figures files from pgfplots in a given folder?

I'm working on a project on LaTeX which includes heavy externalization of pgfplots figures, so I've hidden everything in a tex subfolder of the main one and work only there. Every time, though, I have ...
2
votes
0answers
38 views

How to make ybar chart where the final bar start at the end of the other one?

I want to make a ybar chart like this picture here (sorry for my bad painting skills ;) ) So that the bars switch from minus to plus or the other way round and the bar lenght should be noted as a ...
5
votes
0answers
64 views

How can I reduce the memory required for following example (nested ‘for’ loops)

I want to plot a convolution of two spectra. The first one is a weighted dirac comb, the second a defined function. To do this I used two nested for loops but the calculation exceed the Tex capacity ...
6
votes
2answers
188 views

Draw tikzpicture in figure caption

I want to make a small tikzpicture inside the caption of a figure, I namely want to create a legend of a plot in the caption. I have read section 4.9.6 Legends with \label and \ref from the pgfplots ...