# Tag Info

3

When you do shift={(axis direction cs:-\rawx,0)} you shift the node to x = 0. However, in your case the axis starts at about x = 980, so the nodes end up 980 axis units left of the axis. The shift you need to do is xmin - \rawx, which will be the length of the individual xbar. You can access xmin with \pgfkeysvalueof{/pgfplots/xmin}, so the needed shift is ...

3

If I understand you correctly you want the position of the lines and arrows, relative to the axes, to be the same in both plots. For such cases the rel axis cs coordinate system is helpful. It is a coordinate system which has (0,0) in the lower left of the axis, and (1,1) in the upper right. You can use it as for example \node at (rel axis cs:0.5,0.5) {stuck ...

0

Just for finalizing the question with PSTricks. \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot,pst-eucl} \def\f{x RadtoDeg sin 2 mul 3 add} \def\g{x RadtoDeg cos 2 mul 3 add} \begin{document} \begin{pspicture}[saveNodeCoors,PointName=none,PointSymbol=none](-1,-1)(7,6) \pstInterFF{\f}{\g}{1}{A} \pstInterFF{\f}{\g}{4}{B} ...

3

Another alternative is use of the clip twice, without fillbetween library. First, fill the area below sine curve and then clean the area above cosine curve. Code: \documentclass{article} \usepackage[papersize={11cm,10cm}]{geometry} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \thispagestyle{empty} \begin{document} \begin{tikzpicture} ...

7

This can be done by the fillbetween library which is shipped with pgfplots version 1.10: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} % \usetikzlibrary{} \usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture} \begin{axis}[axis on top,set layers] \addplot[blue,name path=A,domain=0:2.3] ...

4

One option: the inset is saved in a box and then placed at the desired position using a \node and the axis coordinate system for the main plot (See Section 4.17.1 Accessing Axis Coordinates in Graphical Elements): \documentclass{article} \usepackage{pgfplots} \newsavebox\mybox \begin{document} % the box is filled with the inset \savebox\mybox{% ...

4

See How can I add a zero line to a plot? Find the inverse of the function, plug in the value. \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat = 1.9} \pgfmathsetmacro\result{-ln(1-0.63)*5} \begin{document} \begin{tikzpicture} \begin{axis}[ ymax = 1.15, ymin = 0, xmin = 0, xmax = 20, ytick = {0, .63, ...

2

You are absolutely right @Johannes_B, something so small can produce so many problems when someone has never used tikz. Thank you all for your time and effort. I will also post the updated version just in case that someone might occur the same error as me. \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes,arrows,automata} ...

0

I think this was fun figuring out by myself. Since there appears as though there is no direct convenient method, I simply solved it using the following code for the tikzpicture block. I added the original x tick labels to be in integer positions and extra tick labels at 0.5,1.5,... positions and changed the style of the extra ones to be much longer. But, I ...

1

You could reduce the size of each axis and place it along with the \caption in a minipage, and then place all four minipages in the same figure. With all the axis labels it may become a bit cramped though, so I'll suggest another way, using groupplots. To make the bars vertical you need to switch from xbar to ybar, and also switch all x<things> to ...

2

You can use the feature of adding extra ticks. Include the key extra y ticks={<ymin>, <ymax>} where you can manually write the values <ymin> and <ymax> to the axis environment. You can also use extra y ticks={\pgfkeysvalueof{/pgfplots/ymin}, \pgfkeysvalueof{/pgfplots/ymax}} since you have already explicitly specified the limits ymin ...

2

You are testing if number (##1) is negative or not. When it's negative convert it to positive with -##1. \documentclass{article} \usepackage[table]{xcolor} \usepackage{pgfplotstable} \pgfplotstableset{ color cells/.style={ col sep=comma, string type, postproc cell content/.code={% \pgfkeysalso{@cell ...

1

Two more options: 1.- Divide your plot for x^2 in two plots, one without fill option and domain=-0.15:0 and a second one with fill option and domain=0:1. \begin{tikzpicture} \begin{axis}[enlargelimits=0.1] \addplot[domain=-.15:0]{x^2}; \addplot[domain=-0:1,fill=gray!50] {x^2}\closedcycle; \addplot [thick,color=blue,mark=o,fill=blue, ...

4

Pgfplots has a tick scale binop option for this: It is located under the /pgfplots path, hence: \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[/pgfplots/tick scale binop=\times] \begin{axis} [xmin=0, xmax=10000, ymin=0, ymax=10000] \addplot plot coordinates {(5000, 5000)}; \end{axis} ...

1

Another approach is to clip and fill the plot twice. The first scope clips and fills (in blue) triangle containing the two curves, then the second scope clips and fills (in white) the area above x^2, yielding Code \documentclass{article} \usepackage[papersize={12cm,10cm}]{geometry} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \thispagestyle{empty} ...

2

Use \closedcycle for addplot: \documentclass{article} \usepackage{pgfplotstable} \begin{document} \begin{figure}[!h] \centering \begin{tikzpicture} \begin{axis}[enlargelimits=0.1] \addplot[domain=-.15:1,fill=gray!50] {x^2}\closedcycle; \addplot [thick,color=blue,mark=o,fill=blue, fill opacity=0.05]coordinates { ...

7

For a single plot, you can use the option update limits=false. For several plots, you can wrap them in the environment pgfplotsinterruptdatabb. In both cases, the result is the same: the given plots do not contribute to the computation of the bounding box. \documentclass{article} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} ...

7

Hopefully this will work with \input too. You can use a node to put your .tikz files \documentclass{article} \usepackage{graphicx,array,booktabs,tikz} \usetikzlibrary{calc} \begin{document} \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} \begin{table}[htb!] \centering \begin{tabular}{P{5.5cm} P{5.5cm}} \toprule R220expt21 & ...

5

Version 1.10 of pgfplots has been released just recently, and it comes with a new solution for the problem to fill the area between plots. Note that the old solution is still possible and still valid; this here is merely an update which might simplify the task. In order to keep the knowledge base of this site up-to-date, I present a solution based on the ...

6

Use xticklabels={0, 1, 2, 3, 4+},: \documentclass[12pt,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture} %If you do not like this style just delete it. %But you will need to add to \addplot[color] this "line width=2pt, rounded corners" to change line width and add rounded corners. \tikzset{ every ...

1

Following what @ferahfeza mentioned, I just changed your source. Is this what you want? \documentclass[tikz]{standalone} \usepackage{pgfplots,pgfplotstable} \usetikzlibrary{calc} \usepackage{tikz-3dplot} \begin{document} \begin{tikzpicture} \begin{axis}[ view = {-40}{20}, xmin=0,xmax=10, ymin=1,ymax=100, ...

0

you need add (for example) ytick={0.12,0.125,0.13} since the range of your data is different. Then you can customize the labels too. adding scaled ticks=false, removes the $10^{-2}$ and then using xticklabels you can name them 0.01, 0.02 and so on. Here is an example of figure 1 \begin{tikzpicture} \begin{axis}[ scale only axis, xlabel={\textit{Applied ...

3

In my documents, I usually have the following in the preamble: \pgfplotsset{every axis/.append style={ line width=.6pt, tick style={line width=0.6pt,black}, grid style={line width=0.6pt,dotted,gray}}} If I now just write \begin{axis}[% grid style={line width=6pt,dotted,gray},...] within a figure this will overwrite the predefined setting.

4

Just use every axis y label/.style for that axis. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{ every axis y label/.style={at={(-0.1,0.5)},rotate=90}, width=6cm } \setlength\parindent{0pt} \begin{document} \begin{tikzpicture} \begin{axis}[ylabel=thing] \addplot {x^2}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[% ...

2

You can always define styles. There are lots of styles available, among them every axis post : allows to override all options after \begin{axis} set in your .tikz file every tikzpicture : allows to define default options for every tikz picture. Useful keys could be trim axis left, trim axis right, and baseline. Please refer to Section "Alignment Options" ...

2

The problem with "Dimension too large" is a weakness in pgfplots: it has to map all coordinates into TeX's limited number range eventually, and it fails to detect that it cannot do so without discarding coordinates. In your case, the input range of the y coordinates is much greater than the actually displayed portion. I'd suggest to add restrict y to ...

4

A PSTricks solution: \documentclass{article} \usepackage{pst-func} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff % function \def\Gauss[#1,#2]#3{\calc{1/(sqrt(2*pi)*#2)*exp(-(#3-#1)^2/(2*#2^2))}} % settings \psset{xunit = 2, yunit = 5} % parameters \def\mue{2.5} \def\sigma{0.4} \def\pointA{1.5} \def\pointB{2.2} ...

4

Another alternative is the use of scope environment via \clip command. \begin{scope}[yshift=-\pgflinewidth] \clip (axis cs:1,0) rectangle (axis cs:2,0.24); \addplot [draw=none,fill=blue] {gauss(x, 3, 1)}; \end{scope} Code \documentclass[border=2cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \begin{document} ...

2

There are several possible interpretations of your question. The first is that you want to draw a surface representing the "outer shell" (convex hull? interpolation by a smooth surface?) of some data points given in no particular order. Mathematical algorithms for producing such surfaces virtually always produce triangulated surfaces. Since you insist on a ...

5

You can just treat the required 2d plot as a 3d plot with z=0. So using \addplot3 ({sin(deg(x))},{cos(deg(x))},0)` you get: Code: \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[ axis equal, view={45}{30}, compat=1.8, ...

2

What you need is possible with a style set up which configures the non-linear transformation for the rain axis computes suitable (coupled) axis limits for both y axes computes suitable (coupled) units for both y axes requires manual input to decide where both axes start/end. From what I understand from your use-case, this input consists of the the min ...

13

4

The option legend image post style is precisely what you need: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \pgfplotscreateplotcyclelist{mycyclelist}{ {loosely dashed, blue}, {red} } \begin{document} \begin{tikzpicture} \begin{axis}[ cycle list name = mycyclelist, legend entries={a, b}, ...

2

Would this be what you want? To plot a stacked ybar, replace ybar by ybar stacked and add more addplot commands with y=stationary replaced, etc etc. Also remove ymax=210 or reset it. Or in a cleaner way automatically as shown in the second plot. \foreach \i in {Electricity,Stationary,Transport,Fugitive,Industrial,Agriculture,Waste}{% \addplot table [x ...

4

Since, from the question, only the \cdot for the multiplier of the y-axis must bechanged, you can use ytick scale label code/.code={$\times 10^{#1}$}, (the only change from the default definition is that \cdot was replaced by \times). If the \cdot of both axis multiplier is to be changed, you can change the definition of tick scale binop instead, using ...

1

The first questions is answered by adding tick scale binop=\times to the axis options. All the things you can with that number is described in the pgfplots manual section Tick Scaling - Common Factors In Ticks working on the precision for the x ticks...

5

I can not say, what the best way is to do it, from a design point of view. -but I can show what I did in a similar case. -using colors and marks. \documentclass{standalone} \usepackage{siunitx} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{semilogxaxis} [ width=\figwidth, height=0.75*\figwidth, ...

2

Thanks alfC, with your help and a little further research I was able to achieve a solution I am pretty ok with: \documentclass{scrreprt} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage{pgfplots} ...

2

You need to tell pgfplots that you are plotting an expression, and give it a domain: \addplot expression[domain=0:1]{1}; % arara: pdflatex \documentclass[tikz]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=0, xmax=.1, ymin=0, ymax=2] \addplot expression[domain=0:1]{1}; \end{axis} ...

7

Your data seems to be arranged in set of rectangular patches. So the key patch type=rectangle. Use opacity options to avoid (for the most part) the superposition problem (with axis) produced by current limitations of pgfplots. (For absolute control over the 3D object and lighs use Asymptote instead, in any case pgfplots will get you 99% there and it will be ...

4

Is it like this? \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tipa} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \begin{document} \begin{tikzpicture} \pgfplotsset{width=10 cm} \begin{axis} [ symbolic x coords={Label 1,Label 2}, xtick={Label 1, Label 2}, x tick label style={rotate=45, anchor=east, align=center}, axis lines=left, y ...

3

We can't use numbers in LaTeX macros- see Defining commands/abbreviations that contain numbers and the links within for details. We can achieve close to your desired approach using a pgfplots-based approach by using styles: \pgfplotsset{ mystyle/.style={ solid, red, every mark/.append style={solid, fill=red}, mark=o}, ...

3

With the recently released pgfplots 1.10 and its fillbetween library (I learned it from Elke here) it's much easier. Load the library: \usepgfplotslibrary{fillbetween} Give the plots a name: \addplot[name path=curve,orange, ... Add a fill plot: \addplot fill between[ of = curve and line, split, % calculate segments every even ...

2

You will need to cycle the path by hand, which is definitely not the best solution, but it works. So I'm doing the following: \addplot3[area plot] table[x index=0,y expr=#1,z index=#1] {\datatablePX} -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},#1,\pgfkeysvalueof{/pgfplots/zmin}) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmin},#1,\pgfkeysvalueof{/pgfplots/zmin}) ...

10

You can add fill=none to the legend style key as in this approach. \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture} \begin{axis}[ legend style={fill=none} ] \addplot {x}; \addlegendentry{$x$}; \end{axis} \end{tikzpicture} ...

4

Version 1.10 of pgfplots has been released just recently, and it comes with a new solution for the problem to fill the area between plots. For your simple case, the answer of percusse is the way to go. However, for anything which is slightly more complex, the following approach might be good to know: it allows to fill the area between any two plots by ...

8

Version 1.10 of pgfplots has been released just recently, and it comes with a new solution for the problem to fill the area between plots in a "compile-time-optimized way". \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture}[/pgf/declare ...

4

Version 1.10 of pgfplots has been released just recently, and it comes with a new solution for the problem to fill the area between plots. Note that the old solution is still possible and still valid; this here is merely an update which might simplify the task. In order to keep the knowledge base of this site up-to-date, I present a solution based on the ...

1

Version 1.10 of pgfplots has been released just recently, and it comes with a new solution for the problem to fill the area between plots. Note that the old solution is still possible and still valid; this here is merely an update which might simplify the task. In order to keep the knowledge base of this site up-to-date, I present a solution based on the ...

2

Version 1.10 of pgfplots has been released just recently, and it comes with a new solution for the problem to fill the area between plots. Note that the old solution is still possible and still valid; this here is merely an update which might simplify the task. In order to keep the knowledge base of this site up-to-date, I present a solution based on the ...

Top 50 recent answers are included