Tag Info

New answers tagged

1

You can use xtick={1,...,5}, xticklabels={A,B,C,D,E} in the options of \nextgroupplot. Change xtick={1...,5}, as you wish. Further don't use \it{...} as \it is tex command and it doesn't take an argument. Use \itshape as I did. \documentclass[]{article} \usepackage{pgfplots, alphalph} \usepgfplotslibrary{groupplots} ...


3

You need a minimal tex distribution. Then you can unzip the pgfplots .tds zip into the "local texmf" directory (linux: ~/texmf, windows also has it somewhere) and then run texhash. Keep in mind that you also need PGF (which can also be installed into a local texmf tree).


1

It's not clear what you think needed doing manually, but just using ybar stacked and plotting each piece works fine here: \documentclass[tikz]{standalone} \usepackage{pgfplots,pgfplotstable} \pgfplotsset{compat=1.12} \pgfplotstableread[col sep=comma,header=true]{ Year,RoW,MEA,China,Americas,APAC,Europe 2000,751,0,19,21,368,129 2001,807,0,24,24,496,265 ...


3

Here is a over kill solution for you. \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \usetikzlibrary{patterns} \pgfplotsset{compat=1.12} \begin{document} \begin{table}[h] \centering \begin{tikzpicture} \begin{axis}[ extra y ticks = 2, extra y tick labels = z, extra y tick style ...


2

I reduced your code a bit, but this is what you need: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \usepgfplotslibrary{fillbetween} \usetikzlibrary{patterns} \begin{document} \begin{figure}[h] \centering \begin{tikzpicture} \begin{axis}[ xmin=-1, xmax=3, ymin=-1, ymax=3, axis lines=middle, ...


3

You can sort your table based on the column you want to show. Then you can count the unique items and match the indices with the respective labels. This is of course pretty convoluted way of doing things and I think can be proposed as a feature request to Christian Feuersänger. However I've noticed that there is some sensitivity in the bin computations ...


5

You need not use empty \nextgroupplot to insert the Row 1 etc. But use a node like \node[rotate=90,above=5mm] at (my plots c1r1.west) {Row 1}; \node[rotate=90,above=5mm] at (my plots c1r2.west) {Row 2}; \node[above=5mm] at (my plots c1r1.north) {Column 1}; \node[above=5mm] at (my plots c2r1.north) {Column 2}; The width problem comes as you have width=1cm ...


3

For more complicated math, LaTeX is not the proper tool. Using a computer algebra system called Sage, running through a (free) Sagemath Cloud account you can quickly get your plots. \documentclass{article} \usepackage{sagetex} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{pgfplots} \begin{document} \begin{sagesilent} t = var('t') x = var('x') f1 = ...


2

See \tikzsetnextfilename in the TikZ manual. This allows individual names for the figures. MD5 sum names have the disadvantage, that each change would generate new file. Then the disc space would be filled with outdated garbage.


1

It's necessary to train \pgfplotstabletranspose to maintain the column names. Add a dummy row to the data, having the values colnames 0 1 2 3 4 (whereas colnames could be replaced by anything basically). Call the \addplot table[x=xrow,y=yrow] {\otherdatatable}; (I've used another macro for the transposed table. I am not sure if using the same macro ...


4

First let us look at the decoration random step: \documentclass[border=9,tikz]{standalone} \usetikzlibrary{decorations.pathmorphing} \begin{document} \makeatletter \tikzset{ demo decoration/.style={ gray, postaction={draw=red,decorate,decoration={segment length=6pt,amplitude=3pt,meta-amplitude=12pt,#1}} } } ...


4

Your plots are too wide. You may try to put 2 plots in a row instead of 3. However, there is always this box techniques that can be used. \documentclass[]{article} \usepackage{pgfplots, alphalph} \usepgfplotslibrary{groupplots} \begin{document} \begin{figure} \makebox[\textwidth]{% \begin{tikzpicture}[font=\footnotesize\sffamily] ...


3

Instead of passing scale=0.71 to tikzpicture pass it to the axis options. I have also added ylabel style={anchor=west} to put y label little up. \documentclass[11pt]{memoir} \setstocksize{23cm}{15.9cm} \settrimmedsize{23cm}{15.9cm}{*} \settrims{0pt}{0pt} \settypeblocksize{17.8cm}{11.3cm}{*} \setlrmargins{2.3cm}{*}{*} \setulmargins{6.4\onelineskip}{*}{*} ...


2

You can use restrict expr to domain: \begin{filecontents*}{mydata.dat} C P1 P2 P3 sigP3 1 1.12E-4 0.06189 0.1865 0.0080 1 6.03E-3 0.00000 0.2517 0.0046 1 2.64E-2 0.00000 0.2247 0.0165 2 6.49E-5 0.00000 0.1906 0.0043 2 1.27E-5 0.00296 0.2120 0.0039 2 3.34E-4 0.00865 0.1709 0.0050 3 1.59E-2 0.01857 0.1596 ...


3

You can use plain \draw also inside axis environment. \documentclass[11pt]{article} \usepackage{color} \usepackage{tikz} % for flowcharts %\usepackage[latin1]{inputenc} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} ...


1

To modify the styling of the axis lines, use <axis> axis line style={<styles>}, where <axis> is the axis to modify (x, y, z, or omit to style all axes) and <styles> is the styling to apply. So, we can use axis line style={-} in the axis options to override the axisStyle and locally set no arrow tip for the axis line. Here I've ...


5

If you want to reproduce a hand drawn curve and use the smooth interpolation it is better to use less points: \documentclass[]{standalone} \usepackage{xcolor} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ytick={30,45},yticklabels={min,max},xtick={10,200,1024},xticklabels={$10$,$20$,$1024$}] \addplot[smooth] coordinates { (0,45) ...


2

The dateplot lib needs to map the date range to integers (TeX has no longs...). In order to make the best use of the available, limited, data range, it uses date ZERO to calibrate the numbers. If you set date ZERO to any date which is close to your data range, the plot is fine. The actual scaling needs scale only axis as pgfplots only supports precise ...


0

This answer relies on the ifoddpage package. I put the yaxis label in the outside (or is it inside?) margin while the legend is on the opposite side. To create the mwe, I'll use the two following files (to make the code shorter). First the main one: \documentclass{article} \usepackage{pgfplots} \usepackage{float} \usepackage{ifoddpage} \begin{document} ...


4

Well, that is looot of questions and I am very sleepy... \documentclass[11pt]{article} \usepackage{color} \usepackage{tikz} % for flowcharts %\usepackage[latin1]{inputenc} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[ width=\linewidth, ...


3

Maybe you can set the yticklabels explicitly and use \raisebox and \smash \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \usetikzlibrary{pgfplots.groupplots} \begin{document} \begin{tikzpicture} \begin{groupplot}[ group style={ group name=my plots, group size=1 by 3, xlabels at=edge bottom, ...


1

The problem with oversized fonts in adobe reader comes from a bug with XeLaTex when using fonts in OTF format that have a particular resolution (see http://typophile.com/node/46451). What I do to circumvent this issue is to work locally with the .ttf version of FontAwesome. Added benefits to this is to make the new fonts available to you, it's easier to ...


3

I just found an answer thanks to this answer by Jake, using extra y ticks and extra y tick style: \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \usetikzlibrary{pgfplots.groupplots} \begin{document} \begin{tikzpicture} \begin{groupplot}[ group style={ group name=my plots, group size=1 ...


0

This is a solution for the first issue (taken from here): Download the latest version of fontawesome from their site: http://fortawesome.github.io/Font-Awesome/ Install the .ttf version of the font (by simply double clicking the file on the most operating systems) Replace the line \newfontfamily{\FA}{FontAwesome} in your fontawesome.sty file with ...


2

You can use path picture like \fill[pattern color=green, pattern=north east lines, opacity=0.9,path picture={ \node[anchor=south] at (path picture bounding box.center) {DB}; }] plot[domain=-72.5840284:183.69514] ({\x},{0.0018*\x*\x-0.2*\x+10}) -- plot ({\x},{34}) -- cycle; Code: \documentclass[tikz]{standalone} ...


3

You have to add xtick=data so that xticks are taken from data. \documentclass[tikz, border=10pt]{standalone} \usepackage[english]{babel} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} [width=8cm, symbolic x coords={egg,corn,spoon},xtick=data] \addplot plot coordinates{ (egg,2) (corn,6) ...


3

As percusse said in the comment, you could use polar coordinates: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[xmin=-3,ymin=-3,zmin=0,xmax=3,ymax=3,zmax=10] \addplot3 [surf,draw=none,restrict z to domain=0:9, data cs=polar, domain=0:360, y domain=0:3] (x, y, y^2); \end{axis} \end{tikzpicture} ...


2

You need to use mark repeat key to repeat marks at frequent intervals. mark phase will tell at which point the marks should start. For example, make repeat = r, mark phase = p will put the mark first at pth point and then at p+r th and then p+2rth point etc. An example from the manual \documentclass{article} \usepackage{pgfplots} ...


3

You can use label=below:{$f(x)$} as usual. All the position specifiers like right, left below left etc will work. Also, since label is a node, you can pass other options to it too like label={[text=red]below:{$f(x)$}} Code: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \begin{document} ...


4

This is a software defect. A software upgrade of pgfplots to version 1.11 or 1.12 will fix it (tested together with PGF 3.0.0).


2

As already pointed out in comments, smooth and domain restrictions do not work well together in order to fill the area between a curve and the axis. However, you can use the fillbetween library which allows to fill paths between any two plots. In order to use it, we need to add the X axis as an invisible (but named) dummy plot, and use soft clip in order to ...


1

So you are trying to sync the pgfplots cm with that of tikz, and it fails somewhere? What if we manage to avoid this challenge and get the desired effect by means of a slightly different approach? My idea is to apply the slanting to the tick labels only and to rely on the standard formatting of pgfplots to compute the CM as such. I implemented the idea by ...


2

The root cause for the inconsistency between colorbar and surface plot is that "point meta min" and "point meta max" are only specified within the color bar style, but not for the axis as such. The effect is that the colorbar's axis descriptions are overwritten, but the surface plot is entirely unaware of the modification. I do not know if the possibility ...


1

The memory usage of pgfplots is beyond the default configuration of a tex system, especially for huge data sets. The pgfplots reference manual contains a section named "Memory and Speed considerations" which is dedicated to the associated problems. Reducing its section to one sentence results in "lualatex is the simplest approach to get around memory limits ...


4

The simplest way to draw these lines is to define all values as macros and calculate the x-value with \pgfmathparse{(\myY-\pgfplotstableregressionb)/\pgfplotstableregressiona}. The result can be saved as \pgfmathsetmacro\myX{\pgfmathresult}. % % Y-Value % % \def\myY{0.155} % % % % % % % % \def\xMin{0} \def\yMin{0} The minimums are used for the ...


5

You can use xticklabels={}, %% no x tick labels yticklabels={}, %% no y tick labels extra x ticks={-10,10}, extra x tick labels={-10,10}, extra y ticks={-10,10}, extra y tick labels={-10,10}, Code: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle, grid=major, ...


4

Continued from @percuesse's comment: Add the following lines right after your \makeatletter: \makeatletter \def\pgfplotsplothandlerhistadvancebin#1{ \pgfplotsarrayselect{#1}\of{pgfp@hist}\to\pgfplots@loc@TMPa% \pgfplotsutil@advancestringcounter\pgfplots@loc@TMPa \pgfplotsarrayletentry{#1}\of{pgfp@hist}=\pgfplots@loc@TMPa % ↑↑↑↑↑↑↑ old ...


2

The trigonometric functions of pgf assume inputs in of degrees. To input an angle in radians, use the special r operator: replace cos(\w*x/100) with cos(\w*x/100 r). \documentclass{standalone} \usepackage{pgfplots} \def\mycolone{yellow} \def\mycoltwo{green} \pgfplotsset{compat=1.12,every axis legend/.append style={at={(.5,-.2)}, anchor=north}} ...


1

The grid is drawn behind the plots by default, so in your case it's not visible. Set axis on top, and you'll get a grid.


5

From page 95 in the pgfplots documentation. Use the axis background/.style for the axis environment! \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[axis background/.style={fill=gray!10}] \addplot {x^2}; \end{axis} \end{tikzpicture} \end{document}


1

Ok, I ended up doing the following: I first defined a style outside of the actual \tikzpicture: \pgfplotsset{ default style/.style={ xbar, xmin=0, width=12cm,enlarge y limits=0.5, xlabel={Travel time [s]}, ytick=data, nodes near coords, nodes near coords align={horizontal}, every node near coord/.append style={/pgf/number ...


3

A PSTricks solution: \documentclass{article} \usepackage{pstricks-add} % approximation to Euler's number \def\PSEuler{2.71828182845904523536 } % point on x-axis \def\point{1.5 } \begin{document} \psset{yunit = 2} \begin{figure} \begin{pspicture}(-0.73,-0.27)(7.04,2.5)% found manually \psaxes[Dy = ...


1

A MetaPost solution, for whom it interests. The middle of a path is easily found with the Metafun format of MetaPost: it is point .5 along curve if curve is the name of the path. For MetaPost experts, here is the definition of the along binary operator in the Metafun format: primarydef pct along pat = % also negative (arctime (pct * (arclength pat)) of ...


3

You can use this answer by percusse and adjust the anchors \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepackage{filecontents} \begin{filecontents*}{mydata.dat} x_0 f(x) label anchor %some comment 0.5 0.24 0 east 0.5 0.21 0.1 west 0.5 0.18 0.5 east 0.5 0.21 0.9 east \end{filecontents*} \begin{document} ...


2

Replace table with table[meta = label] and you should be fine. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepackage{filecontents} \begin{filecontents*}{mydata.dat} x_0 f(x) label %some comment 0 10 0 0.1 9 0.1 0.5 6 0.5 0.9 5 0.9 \end{filecontents*} \begin{document} \begin{tikzpicture} ...


2

The problems are caused by the different coordinate systems, I believe. Therefore I moved the \path-commands into the axis environment and adjusted their position slightly. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots}\pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture}[scale=0.8] \begin{axis}[clip=false, width=12cm, ...


4

This is just one possibility. \documentclass[tikz,border=3mm]{standalone} %\documentclass{article} \usepackage{pgfplots} %\pgfplotsset{compat=1.7} \begin{document} \begin{tikzpicture}[>=latex] \begin{axis}[grid=both, %grid=none axis x line=center, axis y line=center, black, ...


3

You can control the position of nodes most easily, in this case, by using the co-ordinate system of the plot itself to define co-ordinates/nodes, and drawing them in the normal TiKZ style. Source \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \begin{document} \begin{tikzpicture}[>=latex] \begin{axis}[grid=both, ...


1

Going with simplicity, and the most common use case for the win I'm copying my edits here as the answer. According to How can LaTeX code in a data file be read by pgfplotstable? it is impossible to insert expandable material in headers to be formatted by pgfplotstable. Therefore, as in percusse comment use column name key to access and format any column ...


0

Answering my own "question". I resolved this issue by using the \ifpdf command, which is mentioned in the pstool package documentation, as follows: \usepackage{pstool} \usepackage{tikz} \ifpdf \usepackage{parskip} \fi The \ifpdf command creates a conditional preamble only for the non-graphics sections. I think that this way, the graphics are not subject ...



Top 50 recent answers are included