Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pgfplots]

{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.

2
votes
1answer
40 views

Tikz barchart space between bars within group

I have the following bar chart: \documentclass[tikz]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ legend style={at={(1.2,1)},anchor=...
2
votes
1answer
47 views

How can I plot vertical asymptote in my graph?

I'm trying to plot vertical asymptotes in my graph but I can't. This is my code: \documentclass[a4paper]{article} \usepackage{pgfplots} \usepackage{amsmath} \begin{document} \begin{center} \begin{...
5
votes
2answers
38 views

pgfplots: How to align plot width to same width as legend?

The user marmot has posted a nice approach to put a legend below a multigraph diagram. Minimum Working Example (MWE): \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \usetikzlibrary{...
4
votes
1answer
23 views

Pgfplot - How to exactly align the legend in a plot

I have a legend in my pgfplots and want to manually position it at a point where the legend does not cover any text or measurement points. I know the axis property legend pos=north west, but it's not ...
0
votes
0answers
17 views

pgfplots: Is “scale only axis” only necessary for documents but not for standalone?

Assumed we have this kind of code: Minimum Working Example (MWE): \documentclass{article} \usepackage{showframe} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[height=\...
1
vote
0answers
27 views

Own defined color and pgfplots

My codes are follows: % Using spot colors with xcolor and pstricks. % process with: % $ latex xcpst % $ dvips -h tex.pro -h xcolor.pro -h spot.pro filename.dvi \begin{filecontents*}{PANTONE300C.pro} %...
1
vote
1answer
20 views

pgfplots: How to force datetime to only display xticks with even times (18:00) instead of odd times (18:34)?

Assumed we have the following plot from user darthbith to display a pgfplot with a time axis: Minimum Working Example (MWE): \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{...
0
votes
0answers
26 views

tikz distribution and contour plot from seaborn

I have a generated a contour plot from 2 density estimations using seaborn. I want to reproduce the plot using tikz, but I don't find any resources. Any help would be appreciated. Thank you Edit: ...
1
vote
1answer
19 views

tikzpicture with xbar interval and nodes near coords is missing an interval label

I'm trying to create an xbar interval chart with nodes near coords. This works with some shifting etc., but the interval label is missing for the topmost value (or the value is extra, depending on how ...
3
votes
1answer
32 views

pgfplots: How to add time axis as second x-axis?

I preprocessed a series of data into a time column and a further column with time distance to zero, the latter as decimal value. Minimum Working Example (MWE): \documentclass[border=5mm]{standalone} ...
1
vote
1answer
40 views

pgfplots: How to control and align legend items precisely above each other?

The user marmot has posted a really nice approach of adding legend items into one single box below a multigraph diagram by placing them inside a \node. Based on this initial situation I have tried to ...
0
votes
1answer
26 views

pgfplots to build a contour from csv

I want to plot the contour lines from some simulation I did. Therefore, I have a csv file with my computed data, and I would like to use pgfplots to plots these contour lines. I look on the ...
1
vote
1answer
20 views

Specify times and dates in Pgfplots

I have x-data as dates associated with float values; plotting them with pgfplots is as easy as \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \pgfplotsset{compat=...
1
vote
0answers
18 views

How to align multiple graphs with their y-axis in a standalone document in PGFPlots?

I have created two graphs in one page using a \documentclass[varwidth]{standalone}. How can I align them with their y-axis? I tried \begin{tikzpicture}[trim axis left] but it cut off right part of the ...
0
votes
0answers
29 views

Matlab2tikz // Error divsion by 0.0

I created a minimal working example in Matlab: [x,y] = meshgrid(-2:0.1:2,-2:0.1:2); fx = x.*y; fy = x.*y; figure quiver(x,y,fx,fy) matlab2tikz('plot.tex'); This works great and creates the plot....
3
votes
1answer
81 views
+50

Linear comb plot, choosing origin different from zero

I'm plotting spectral data, sometimes with logarithmic axes and sometimes linear but with values in dB. The usual way for plotting these kind of diagrams (at least in my field) is to have all the ...
1
vote
2answers
38 views

Circle using tikz and pgfplots package

I have been trying to obtain this Since i am still an amateur at using the tikz package, i started somewhere. This is my bit of code, but all i am obtaining is this \usepackage{pgfplots} \...
1
vote
1answer
23 views

PGFPlots grouped bar chart with error bars providing additional information above, convert point to string in comma for display

How can I get comma as a decimal separator in my upper axes (the number above the major grid)? All suggestions to improve the graph are warmly welcomed. basic requirement using .csv data with (long)...
3
votes
1answer
23 views

pgfplots: How to align legends of multigraph diagram?

Assumed we have the following MWE to display various graphs in one single diagram. Minimum working example (MWE): \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=...
3
votes
1answer
26 views

Using axis units (axis cs) for line width

Say my plot shows geometric objects in a metric x,y plane, so one axis unit equals 1m. Drawing in metric units is easy using axis cs for the coordinates like in this example: \begin{tikzpicture} ...
0
votes
0answers
45 views

Multiple 2D Gaussian ellipses in 3D plot

I'd like to plot different bivariate Gaussian distributions as shaded 2D ellipses at different points in 3D space. The 2D ellipses I would plot like Jake suggests in Gaussian ellipsoids using tikz, ...
3
votes
1answer
51 views

continuous function including hypergeometric function

How can I plot this pdf in LaTeX? I did this \documentclass[a4 , 12pt]{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ samples at={-20,...,20}, ] \...
3
votes
1answer
53 views

Set aspect ratio on 2D pgfplots plot

I would like to set the aspect ratio of a pgfplots plots without explicitly specifying width and height (i.e., leaving them default). For 3D plots, there is plot box ratio; for 2D plots, I tried ...
0
votes
0answers
32 views

Missing \begin{document} error with pgfplots

I am having trouble using pgfplots. I reinstalled my MikTeX 2.9 version because something broke. It's working fine, but when I try to use \usepackage{pgfplots} with pdfLaTeX I get the following: ...
1
vote
1answer
41 views

Tikz/pgfplots Reduce distance between Tick labels line break

I'm pretty desperate with a problem I have right now. I'm trying to create a lollipop plot that has different categories on the y-axis and occurrences on the x-axis. According to the below code. Note ...
0
votes
1answer
30 views

pgfplot does not work properly when using ymode=log

The plot is working fine when axes are regular. The moment, y-axis changed to log scale it is showing only part of the plot. The dat file provided has around 9000 points. Any support will be ...
1
vote
2answers
33 views

Lines and axis labels in pgfplots

I have two questions about the code below: How can I put the dashed lines in the right place (that is, from (0, 2) to (3, 2) to (3, 0))? At the moment they are in the wrong place. How can I move the ...
2
votes
1answer
48 views

Labeling points on a plane

I have two points in a plane, both depending on several parameters. The coordinates of them shall fall within the range [0,1], i.e. within the red square: I would like to draw these points for many ...
1
vote
2answers
15 views

xticklabel distance for math expression

I have a pgfplot and the labels in the x axis are not centered as I expected and this is because one of them is higher than the other because of the superscript. \documentclass[]{article} % Use the "...
2
votes
1answer
23 views

formatting bar charts pgfplots

How to show the entire bars and slightly extend the y axis in both directions (top and bottom)? \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \...
2
votes
1answer
47 views

mistake when exporting numpy data to csv to pgfplots

I have to plot data from a numerical simulation. I perform my simulations with python and numpy. But now I want to plot the result in a LaTeX file. Since I want to be able to modify the layout without ...
3
votes
1answer
31 views

How to change viewpoint when using logarithmic scale with pgfplots?

I want to display a surface, with 3 points sitting on it. I attempted to combine two posts, with partial success. If I change the viewpoint, I receive the upper figure. In this case the log scaling ...
1
vote
1answer
24 views

How to draw a curly brace at a correct location between 2 points with coordinates in a plot?

\documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.pathreplacing} \usepackage{pgfplots} \usepackage{xcolor} \begin{document} \begin{center} \begin{tikzpicture} \begin{...
2
votes
1answer
45 views

Drawing step functions

How would I represent a one dimensional potential step such as the one shown in the attached figure? I've managed to get as far as defining my x and y axis but I'm not sure how to draw the function ...
1
vote
0answers
27 views

How can I reset pgfplots settings?

Suppose I have a document which has a \pgfplotsset{...} part in the preamble. Further suppose that in the main document I want to do a pgfplot inside of an environment \begin{myenv}...\end{myenv}. ...
9
votes
1answer
293 views

Increase thickness of graph lines larger than ultra thick

I have a beamer presentation with some pgfplots graphs and want to increase their thickness. I found this answer How to increase the thickness of the graph lines and remove the point?, but I found ...
4
votes
0answers
58 views

End Tick Mark Not Showing in Tikz Image

I'm trying to create an empty box for my students to draw their own box-and-whiskers plot on an assignment: \documentclass{article} \usepackage{pgfplots} \begin{document} \centerline{ \resizebox{...
1
vote
0answers
34 views

Combine fill and pattern in a pgfplot boxplot?

Is it possible to combine a pattern with a background color in Pgfplot boxplot? \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \usepgfplotslibrary{statistics} \usetikzlibrary{...
7
votes
3answers
377 views

Plot a function of two variables equal 0

I would like to plot the function x2(1 − x2) − y2 = 0 in LaTeX. I tried running following code \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage[utf8]{inputenc} \...
1
vote
0answers
51 views

capacity problem with some packages

I 'm trying to draw the plot of f(x)=sin(1/x) with pgfplot, but I get an error message: ! TeX capacity exceeded, sorry [main memory size=3000000]. I realized that when I delete one of the ...
0
votes
0answers
21 views

How to read data from file using pgfplots?

I have the following pgfplots example: \documentclass{article} \usepackage{pgfplots} \usepackage{filecontents} \begin{filecontents}{datax.dat} 1,3,6 2,4,5 3,3,7 4,1,2 5,1,1 \end{filecontents} \...
5
votes
2answers
134 views

Workflow for projects with many tikz figures/plots

I love LaTeX and TikZ for creating high-quality documents. The problem is that large projects require a pretty long compilation time and that complicated TikZ figures/plots quickly exceed the memory ...
3
votes
1answer
39 views

Plot level curve using data from pgfplotstable

I have some data from some numerical experiments stored in some csv files, which I read into LaTeX using \pgfplotstableread{Results/test.csv}\data These data consist of x, y and z coordinates and I ...
1
vote
1answer
21 views

Generating Samples at Points used in pgfplots

For one of my academic courses, i need to generate sample lattices and was wondering if there was any way to generalize the hard-coded points I am using. Instead of repeating -5.19,-3.46,-1.73,0,1.73,...
2
votes
0answers
22 views

Plotting grouped bar chart with 2 sets of y-axes in pgfplot

I'm trying to plot a bar chart with pgfplots, with two data series, and two separate y-axes (one on the left, one on the right). In order to have different axes, it seems that I need to put each \...
2
votes
1answer
50 views

How to select a range of data in tikz-pgf?

This is a subset of my table that I want to use to create a stacked bar chart: Is it possible to select columns A through F for the first two rows and then select column G for the other rows to ...
1
vote
1answer
33 views

How to switch row/column in a stacked bar chart

This is my MWE: \begin{tikzpicture} \pgfplotstableread{ % Read the data into a table macro Label First Second Third Yes 0.1 0.3 0.3 No 0.9 0.7 0.7 }\datatable \begin{...
4
votes
1answer
40 views

Set rectangle widths to match sides of other figures in a diagram and make arrow lines horizontal without shifting

In the following diagram, some distances are set manually testing different values, but they do not have exact dimensions. \documentclass[12pt]{article} \usepackage{tikz} \usepackage[active,tightpage]...
1
vote
1answer
47 views

Aligning one pgfplot above another pgfplot

How do I move the number line depicting the solution set to |3x - 5| - x < 17 closer to the graph of y = |3x - 5| - x? \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \...
3
votes
1answer
44 views

Tikz: Transforming axis to skip an interval

Two graphs are illustrated in a diagram, with quite a lot of space inbetween, making it rather unsightly. I would like to move them closer together by skipping the space inbetween. This is the ...