New answers tagged

2

You can specify the column index for each coordinate using the x index or y index keys, as in\addplot file [x index=0, y index=1] {Fre.dat};. 0 is the index of the first column, as explained in the pgfplots manual section 4.3.2. Example (removed everything not essential to the problem at hand): \documentclass[tikz,border=5pt]{standalone} ...


0

The \tiny stuff in your plots has the same size in both figures -- as well as all the other text in the plots. As you mentioned already by yourself in your question it is a very bad idea to scale an externalized picture, bechause then the mess of mixing up sizes starts, especially when you resize your picture not maintaining the aspect ratio. When you want ...


0

In the meantime Christian has added feature to PGFPlots and your first given code in the question works fine without any modification, if you update PGFPlots to v1.13 and gives the result of Christians answer. It also seems that there was a very similar question here.


2

You can use scaled x ticks to scale the axis first and then play a bit with the number format for the ticklabels to get the desired output. \documentclass{standalone} \usepackage{pgfplots} %This package also loads tikz \pgfplotsset{ % Global Styles axis lines=middle, xlabel=$x$, ylabel=$y$, no markers, ...


1

Edit: This solution in comparison with your MWE differ in the following: in preamble is added \pgfplotsset{compat=1.13}, so in the notation of node and drawing coordinates can be omitted axis cs: added are TikZ libraries \usetikzlibrary{calc,positioning} for determination of nodes coordinates the ymax in both axes are changed from 500 to 200 and 8000 to ...


0

This might be a good starting point ... \begin{filecontents}{Lit.bib} @book{tadros2006applied, title={Applied surfactants: principles and applications}, author={Tadros, Tharwat F}, year={2006}, publisher={John Wiley \& Sons}, } @book{binks1998modern, title={Modern aspects of emulsion science}, author={Binks, Bernard P}, ...


3

The main mistake is that you use axis y line=center which implies that the axis should go through 0, or in the case of a log axis through 1. When you change this to axis y line=left and at least the xmin value, you should get the desired result. But then the ylabel is positioned left in the middle (again). This can be modified using the ylabel style key. ...


2

You don't need to merge all the data to one file. The trick is to use \pgfplotsinvokeforeach instead of \foreach which allows expansion. Here the code which gives the same resulting image as in the answer of John Kormylo. \documentclass[varwidth]{standalone} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{tikz} \usepackage{pgfplots} ...


1

In your answer you just show the colorbar in log values, but didn't "transform" the meta data. To do so use meta expr={log10(\thisrowno{2})}. But then the \foreach loop does result in an error, because the meta expr doens't get expanded. To overcome this issue replace the loop with \pgfplotsinvokeforeach. So that others can reproduce that it works, I have ...


1

I've found how to have a log axis, I should have read the colorbar part in the manual better. I just had to add ymode=log: colorbar style={ylabel=$C_{ligne,si}$,ymode=log,ytick={1e-6,1e-5,1e-4,1e-3}}, Here is the end result: Now the problem is, the axis changed, but the colors are incorrect: the colors in the figure have not changed even though the ...


1

As percusse and cmhughes have pointed out already in their comments, one can try to accomplish your needs with the pgfplotstable package. Here some code for a starting point, which I think works quite well for vertical tables, but lack for horizontal tables. Although the solution isn't perfect, it hopefully is a good starting point to experiment with. ...


5

As percusse has stated in his comment you can use the set layers feature and move the filled are to any layer you like. Here an example where you can play a bit what happens, when you change the layer with the resulting image. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{ pgfplots.fillbetween, } ...


2

Usually this should not happen. From the documentation on page 381 about axis on top: Please note that this feature does not a ffect plot marks. I think it looks unfamiliar if plot marks are crossed by axis descriptions. So there seems to be a bug in the fillbetween library. As a workaround you could not use it and instead create the filling ...


2

I don't think that it is possible to have an "unbalanced"/uneven file so you need to fill it up at least with NaNs. But also then you will receive an error message when you want to use x=AgentTypesS. To work around this, just use x expr=\coordindex which will result in the line number. This is given to the axis xtick=data and with xtickslabels from table you ...


2

Besides making your example TeXable you need to define a value for each bar so that xtick doensn't get confused. And because you want to ignore the "zeros" I used ybar stacked. Last I moved the lables to the top of the bars which would otherwise be centered in the bars. I think that is your desired output, right? \documentclass{standalone} \usepackage{tikz} ...


1

Because -- at least for me -- the question is not very precise I'll start with a very basic answer, assuming that Zarko's comment is right and you mean Kronecker's pulse functions. Here I also simplify this solution in that way, that one will not be able from the resulting picture to distinguish, if the functions will be relations (because at the step values ...


0

You can define a new style labels at axis tips like this: \pgfplotsset{ labels at axis tips/.style 2 args={ compat=1.12, xlabel=#1, x label style={ at={(current axis.right of origin)}, anchor=west }, ylabel=#2, y label style={ at={(current axis.above origin)}, ...


1

I think you need to update your version of MikTeX. I had been struggling with similar issues using TeXstudio and MikTex 2.9.4xxx. Upgrading to the latest version (2.9.5840) fixed my issues. I just tried compiling your tex file (with the latest MikTex) and it works for me.


3

For this simple case, you can fake it \begin{tikzpicture} \begin{axis}[ trig format plots=rad, axis lines = middle, enlargelimits, clip=false, legend entries={Maxima,Minima} ] \addplot[domain=-2*pi:2*pi,samples=101, black,forget plot] {sin(x)}; \addplot[domain=-3*pi/2:pi/2,samples=2,only marks,mark options=red] ...


3

Plot a mathematical expression instead, and add the tangent "by hand"... \documentclass[border=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{width=8cm,compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[ xtick = \empty, ytick = \empty, xlabel = {$t$}, x label style = ...


1

You can plot two functions in one graph by using the pgfplots package, an axis environment and two addplot commands, see the corresponding manual. You should also print the words 'if' and 'otherwise' as usual text (using the \text command) as not a mathematical variables.


2

Some LaTeX symbols contain font-commands because they are bond to corresponding fonts. Such font-commands are rather dangerous in that you cannot put them into an \edef. However, most magics of PGFPLOTS are achieved by enormous \edef's. Therefore it becomes a "feature", instead of a bug, that one must try their best to avoid those symbols, as well as font ...


2

It seems like you have to specify date ZERO manually if you use custom xticks. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \usepgfplotslibrary{dateplot} \begin{document} \begin{tikzpicture} \begin{axis}[ date coordinates in=x, date ZERO=2014-01-01, % ADDED LINE xtick={ 2014-01-01, 2016-01-01 }, xmin=2014-01-01, xmax=2016-07-01 ...


3

The loglogaxis environment, in general a log-axis, uses log number format basis/.code 2 args to typeset the ticks. That is the key you can play with. In the following example right axis and top axis are treat separately so that one can define different log number format basis. for right axis, it is currently ...


1

The library dateplot would define x coord trafo so that it can translate dates (and times) to floating number. However, restrict x to domain does not include the information from x coord trafo. That is to say, PGFPLOTS will try to parse your date-inputs presuming they are floating number, ending up with the "cannot parse" error. One might want to write a ...


1

Try something like this: \foreach \tool in \tools { \addplot table[x expr=\coordindex, y={\tool}] {file.dat}; \expandafter\addlegendentry\expandafter{\tool} } This error is caused by the way TikZ reads the code before executing the for loop.


6

Is this good enough? \documentclass[border=9,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{% ,compat=1.12 ,colormap={mygreen}{rgb255(0cm)=(255,255,255); rgb255(1cm)=(255,255,255)} } \begin{document} \begin{tikzpicture} \begin{axis}[ hide axis, unit vector ratio=1 1 1, view={-30}{45} ] \addplot3 [ surf, shader=faceted ...


5

There has been a significant change in the definition of the internal macro \pgfmathparse@. The older version includes a set of compatibility lines for use with calc which have (presumably deliberately) been removed. Adding those back in but otherwise keeping the new definition gives \makeatletter \def\pgfmathparse@#1{% % Stuff for calc compatiability. ...


3

guessing the intended meaning, you can do this: \documentclass{minimal} \usepackage{tikz} \begin{document} \newlength\zzz \settoheight\zzz{$\pi/2$} \begin{tikzpicture} \node[text height=\zzz] {Text}; \end{tikzpicture} \end{document}


1

As mentioned in comment, you have to toggle the usage of xmajorticks in your first plot like here: % arara: pdflatex \documentclass[a4paper]{article} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \begin{groupplot}[% ,group style={% ,group size=1 by 2 ...


2

I guess it is not necessary to use PGFPLOTS whenever there are data to plot. My approach is divided into two parts. First, I use PGFPLOTSTABLE to read the table. This package is good at reading tables. It should be able to read your CSV file. Second is about how to draw. In comments (and in general) we would suggest PGFPLOTS because it has built-in ...


1

In your case you need ybar as option in axis instead of \addplot. Also you will need enlarge x limits to enlarge x axis. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{figure}[h] \centering \begin{tikzpicture} \begin{axis}[ symbolic x ...


3

definition of \basefunc modified to take one argument \foreach... --> \multiframe... use of siunitx package to format the number in the legend pdflatex --shell-escape ... \documentclass{beamer} \usepackage{pgfplots} \usepackage{animate} \usepackage{siunitx} \newcommand\basefunc[1]{% ...


0

You can overlays multiple axes, only there are a lot of things to be set manually. The trick is that, using symbolic x coords, one is able to arrange data points in the most direct way. Together with xmin and xmax one can filter out data points (in the most direct way). Notice that this trick works only if your data points are "discontinuous". For ...


1

If matlab2tikz doesn't pick up modifications you have done to your plots in Matlab I think the best thing to do is to let the author know about this, by making a bug report at https://github.com/matlab2tikz/matlab2tikz/issues That said, I don't know what you've done in Matlab, or with matlab2tikz, but you can certainly add some ExtraAxisOptions to make a ...


4

1. The Labels: you can add the description to the xticklabels field. There you can enter the text, and add "normal" linebreaks with \\. In order for this to work, you'll have to change the style of xticklabel to e.g. align=center (you also do this for "normal" TikZ nodes, if you want linebreaks. You can also make the font smaller, so more words fit on one ...


0

I have something similar in my examples. May be it will help you. I drew an extra line which is optional \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{calc, intersections} \begin{document} \begin{tikzpicture} \begin{axis}[% major grid style=gray, axis lines=center, xmin=0, xmax=0.7, ymin=0, ymax=7, ...


3

Here's a suggestion with just one tikzpicture environment, and the four axis environments placed relative to each other. I also shortened the title of each axis and added a line break to make them narrower, and removed the ylabels from the axes on the right. Finally I moved the label for 2012 Q4 in the first axis. As a sidenote you may be interested in the ...


3

Your question lacks a minimal working example, so I'm going to make some assumptions. Since PGFplots use decimal point by default, and since you also explicitely use \usepackage[english]{babel} and \decimalpoint, my best guess is that somewhere in your code (or in other includes) you have this line present: \pgfplotsset{/pgf/number format/use comma} ...


2

A number of suggestions in the comments led to the solution. By default, pgfplots will slightly enlarge the plot viewport when it automatically detects axis limits based on the plot data. The key settings enlargelimits=false or enlarge x limits=false may be used to prevent this for all axes or individual axes, respectively. However, in this case, the ...


3

Here's a way, given that I've understood your request correctly. It is a little bit of work, as each of the hour-ticks has to specified manually. \documentclass[border=3mm]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel=Time, ...


2

You can draw almost any arbitrary functional expression in the coordinate expressions \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[domain=1:10,no marks,xlabel=$V$,ylabel=$A$,grid=both] \addplot ({(4*pi*(x)^3)/3},{4 *pi * (x)^2}); \end{axis} \end{tikzpicture} \end{document}


2

Instead of fill=white for the second plot, use fill opacity=0,text opacity=1. This only works for a white page, but that is most cases I suppose. \documentclass[a4paper,twoside,11pt]{scrreprt} \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable} \usetikzlibrary{positioning} \usetikzlibrary{decorations.pathmorphing} ...


2

The second intersection isn't marked because you've ended the path with ; before drawing the node at intersection-2. So in the code in question, i.e. \path[name intersections={of=A and xaxis}] node[draw,fill,circle,inner sep=2pt%,pin={above left:Intersection}] ] at (intersection-1) {}; node[draw,fill,circle,inner sep=2pt%,pin={above ...


1

There might be some expanding issue regarding \foreach and \addplot. In my humble opinion, \addplot will read the file name without expanding it. So the three images being included are not image1, image2, and image3, instead, they are \imageName, \imageName, and \imageName. When PGFPLOTS tries to include the images, the three \imageName tokens will all ...


3

How does this look? I positioned all the axes relative to each other, by giving them names and using e.g. at={(otheraxisname.north east)},anchor=north west. Also turned off the yticklabels on most of the axes, and set the tickwidth to zero. Unrelated note: Don't use math mode for italics, if that's what you wanted with $Run$ $Time$. If italics was what you ...


3

A complementary approach to percusse's answer would be to use the LaTeX3 FPU (this provides an IEEE 754 floating point implementation in an expandable form): \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \fpeval \fp_eval:n \ExplSyntaxOff \protected\def\fpset#1#2{\edef#1{\fpeval{#2}}} \begin{document} ...


3

There is a strict limitation in TeX about how big numbers can get which is plus minus 16384. Hence anything going above or anything that comes sufficiently close to zero in the divisor causes overflows. Here exp(-9...) is practically zero for TeX and it is done. Instead you can use more precise calculation engines written for TeX for example FP or TikZ' ...


2

In parameters of your axes you need to add area style and each plot end width \closedcycle: \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \pgfplotsset{compat=1.12} \usetikzlibrary{fillbetween} \usepackage{filecontents} \begin{filecontents*}{data.csv} date,backlog,wip,finished 2015-01-06,54,27,3 2015-01-13,55,27,5 ...


1

If you don't want to use unique names, you can adapt the solution from How keep a running list of strings and then process them one at a time and keep a list of the the undef that need to be done. So, instead of the \csxdef{Tick Used \tick}{}% you instead use \MarkTickAsUsed{Tick Used \tick}% Adding the following to the preamble will then clear this ...



Top 50 recent answers are included