This is a continuation of my , but now I want to use pgfplots.  In an axis environment, I add a node using the axes coordinate system. I would like to use let to retrieve the coordinates of a node in the axes coordinate system.  In the example below:  \documentclass{standalone} \usepackage{tikz,pgfplots} \usetikzlibrary{calc} \begin{document}     \begin{tikzpicture}         \begin{axis}[xmin=0,xmax=10,ymin=0,ymax=10]             \node [circle,fill,inner sep=2pt]  (d1) at (axis cs:4,2) {};             \draw let \p1=(d1) in (d1) coordinate[label=below:\x1]{} ;         \end{axis}     \end{tikzpicture} \end{document}   The label, which should give me the horizontal coordinate of the node, currently reads: 77.999988pt.     Where does that number come from?  Since the node is placed at (4,2), I would like instead get the label as 4 times 28.45274pt = 113.81096pt. (I would then transform it for display.)
58742
I am unable to get the right coordinate values for (A) and (B) in the following axis. Did I misunderstand some conversion step or is it because of the data?  Picture    MWE  \documentclass[ a4paper ]{scrartcl}  \usepackage{     newtxtext,     amsmath,     tikz,     pgfplots } \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}  \usetikzlibrary{     calc }  \listfiles  \begin{document}  \begin{center}     \begin{tikzpicture}[font=\small]     \begin{axis}[     height=6cm,     width=14cm,     %     scale only axis=true,     xlabel={Distance in mm},     ylabel={Voltage in volt},     ]     \addplot [sharp plot, no marks, x=Wegnormiert] table [col sep=tab] {data.txt} coordinate [pos=0.5] (A) coordinate [pos=0.6] (B);     \draw (A) -| (B);     \filldraw let \p1= (A) in (\x1,\y1) circle [radius=1pt] node[pin={[pin distance=1.1cm]270:{{\pgfmathparse{\x1}\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,pt}}}] {};     \filldraw let \p2= (B) in (\x2,\y2) circle (1pt) node[yshift=-0.5cm, pin=270:{{\pgfmathparse{\x2/2.845274}\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,mm}}] {};     \end{axis}     \end{tikzpicture} \end{center}  \end{document}   Data    Additional  code for y-coordinate  \documentclass[ a4paper ]{scrartcl}  \usepackage{     newtxtext,     amsmath,     subcaption,     biblatex } \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}  \usepackage{     tikz,     pgfplots     } \usetikzlibrary{     calc }  \listfiles  \begin{document}  \begin{center}     \centering     \begin{tikzpicture}[font=\small]     \begin{axis}[     height=6cm,     width=14cm,     %     scale only axis=true,      xlabel={Distance in mm},      ylabel={Voltage in volt},     ]     \addplot [sharp plot, no marks, x=Wegnormiert] table [col sep=tab] {data.txt} coordinate [pos=0.5] (A) coordinate [pos=0.6] (B);     \draw (A) -| (B); %   \filldraw let \p1= (A) in (\x1,\y1) circle [radius=1pt] node[pin={[pin distance=1.1cm]270:{{\pgfmathparse{\x1}\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,pt}}}] {};     \filldraw let \p2= (B) in (\x2,\y2) circle (1pt) node[yshift=-0.5cm, pin=270:{{\pgfplotsconvertunittocoordinate{x}{\x2}\pgfmathprintnumber[fixed,precision=1]{\pgfmathresult}}}] {} node[yshift=0.5cm, pin={355:{{\pgfplotsconvertunittocoordinate{y}{\y2}\pgfmathprintnumber[fixed,precision=1]{\pgfmathresult}}}}] {};     \end{axis}     \end{tikzpicture} \end{center}  \end{document}
21035
I'm trying to put some arrows on the left and right side of the maximum of a curve. The arrows should point along the curve. My problem is that if I use the [pos=X] notation I don't know where I am in relation to the maximum. And if I use absolute coordinates the node is not sloped.   \documentclass{article} \usepackage{pgfplots} \usetikzlibrary{shapes.geometric} \pgfplotsset{compat=1.7}  \begin{document} \begin{tikzpicture} \tikzset{myarrow/.style=          {sloped,isosceles triangle,anchor=apex,fill=black,inner sep=2pt}} \begin{axis} \addplot [smooth] {-x^2}  node[pos=0.4,myarrow,rotate=180]{} %ok  node[pos=0.6,myarrow]{}; %ok  \addplot[smooth,green] {-x^2+2*x-4}  node[pos=0.4,myarrow,rotate=180]{}  node[pos=0.6,myarrow]{} %wrong side  node[myarrow,fill=red] at (axis cs:4,-12){}; %wrong rotation! \end{axis}  \end{tikzpicture}  \end{document}     Edit: Some remark about Jake's answer  Jake's code (naturally) works but    for my case it is a bit too complicated. Jake gets the correct rotation for the arrow by drawing a short path from x-1pt to x (cool idea). He gets the coordinates for this small path with intersections. But as my plot is based on a function I can simply calculate the values (e.g. with \pgfmathparse) and then draw the small path after the plot:  \path  (axis cs:3.99,-11.94012) -- (axis cs:4,-12) node[pos=1,myarrow]{};   The same can also be achieved by redrawing the plot but with a restricted domain:  \addplot[draw=none,domain=3.99:4] {\MyFunction{x}}  node[pos=1,myarrow,fill=yellow]{};  I also looked if there is a way to decide where I am relative to the maximum (so that I can change the rotation) and in theory it is possible: If I use the code found here  \pgfplots@metamax is known after the plot and can be used in calculations.
63424
I'm trying to reproduce the following diagram in TikZ and pgfplots.   My MWE with regenerated graph is below:  \documentclass{standalone} \usepackage{pgfplots}  \begin{document}  \pgfmathdeclarefunction{gauss}{2}{%   \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}% }  \begin{tikzpicture} \begin{axis}[   no markers,    domain=0:6,    samples=100,   axis lines*=left,    xlabel=$x$,   every axis y label/.style={at=(current axis.above origin),anchor=south},   every axis x label/.style={at=(current axis.right of origin),anchor=west},   height=5cm,    width=12cm,   xtick=\empty,    ytick=\empty,   enlargelimits=false,    clip=false,    axis on top,   grid = major   ]   \addplot [very thick,cyan!50!black] {gauss(3, 1)}; \draw [yshift=1.4cm, latex-latex](axis cs:2, 0) -- node [fill=white] {$0.683$} (axis cs:4, 0); \draw [yshift=0.3cm, latex-latex](axis cs:1, 0) -- node [fill=white] {$0.954$} (axis cs:5, 0);   \end{axis}  \node[below] at (1, 0)  {$\mu - 2\sigma$};  \node[below] at (2, 0)  {$\mu - \sigma$};  \node[below] at (3, 0)  {$\mu$};    \end{tikzpicture}  \end{document}     Issues   Nodes are not properly placed. How to remove y-axis? How to draw vertical dotted line?   Any help will be highly appreciated. Thanks
115581
I want to create a horizontal bar chart with different labels on the y-axis for each bar. Also, the value should be displayed on the right-hand side of each bar.  Fx:   "Test A" ... red bar ... 400  "Test B" ... orange bar...150 etc.  Current output    Current code  \documentclass{article}  \usepackage{xcolor} \usepackage{tikz} \usepackage{pgfplots}  \newlength{\xdim}  \definecolor{findOptimalPartition}{HTML}{D7191C} \definecolor{storeClusterComponent}{HTML}{FDAE61} \definecolor{dbscan}{HTML}{ABDDA4} \definecolor{constructCluster}{HTML}{2B83BA}  \begin{document} \begin{figure} \centering \begin{tikzpicture} \begin{axis}[     xbar stacked,     legend style={     legend columns=4,         at={(xticklabel cs:0.5)},         anchor=north,         draw=none     },     ytick=data,     axis y line*=none,     axis x line*=bottom,     tick label style={font=\footnotesize},     legend style={font=\footnotesize},     label style={font=\footnotesize},     xtick={0,100,200,300,400,500,600},     width=.9\textwidth,     bar width=6mm,     yticklabels={{Test A},      {Test B},      {Test C},      {Test D},      {Test E},      {Test F}},     xmin=0,     xmax=600,     area legend,     y=8mm,     enlarge y limits={abs=0.625}, ] \addplot[findOptimalPartition,fill=findOptimalPartition] coordinates {(400,0) (0,0) (0,0) (0,0) (0,0) (0,0)}; \addplot[storeClusterComponent,fill=storeClusterComponent] coordinates {(0,0) (150,1) (0,0) (0,0) (0,0) (0,0)}; \addplot[dbscan,fill=dbscan] coordinates {(0,0) (0,0) (250,2) (0,0) (0,0) (0,0)}; \addplot[constructCluster,fill=constructCluster] coordinates {(0,0) (0,0) (0,0) (50,3) (0,0) (0,0)}; \addplot[blue,fill=blue] coordinates {(0,0) (0,0) (0,0) (0,0) (350,4) (0,0)}; \addplot[green,fill=green] coordinates {(0,0) (0,0) (0,0) (0,0) (0,0) (100,5)}; \end{axis}   \end{tikzpicture} \caption{X} \label{fig:stats} \end{figure} \end{document}
71376
I want to add information to each column of a histogram. every node near coord is probably the best approach. It works well with bar plots but not with the histogram:  \documentclass{article}  \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{pgfplots.statistics}  \begin{document}  \begin{tikzpicture} \begin{axis}[ ybar interval, xticklabel=\pgfmathprintnumber\tick--\pgfmathprintnumber\nexttick, % Code to generate labels nodes near coords={ \pgfmathprintnumber{\pgfkeysvalueof{/data point/y}} }, every node near coord/.style={ anchor=south,xshift=9mm, }, % ] \addplot+[hist={bins=3}] table[row sep=\\,y index=0] { data\\ 1\\ 2\\ 1\\ 5\\ 4\\ 10\\ 7\\ 10\\ 9\\ 8\\ 9\\ 9\\ }; \end{axis} \end{tikzpicture}  \end{document}   I used every node near coord/.style to shift the labels.  The problem is that I have four labels for three columns/bars:    I addition I would like to center the labels. A workaround will be a manual adjustment (every node near coord/.style) just like in the shown example.  Update  Maybe clipping is a possibility. Is there a way to clip the labels (in this case the 7 in the right) away?  Like this:
43936
I am using LaTeX, TikZ and PGFplot in order to automatically generate several series of diagrams, one of which is comprised of bar charts. Each bar in each bar chart may have a unique label and height -- I have used PGFplot before and I know that I can read in coordinates from files, but would it be possible for me to create labels for each bar using textual data stored in a tab-separated file? If so, how would I do this? A simplified example of a file I might use is shown below.  # foo.dat # Label | X-Position | Height  A    1    15 B    2    20 C    3    12 D    4    24   Thanks for your help!
91164
What is the  difference between \node and \coordinate in TikZ? Exchanging them does no visual effect in my (to be honest: still simple) pictures.  When to use what?
36649
I'm trying to plot an image file in a pdfplots axis. This is a minimal example (the files fig2a.eps and fig2a.png both contain the image that should be plotted):   \documentclass{standalone} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot graphics[xmin=-0.15, xmax=0.15, ymin=0.0, ymax=0.2] {fig2a}; \end{axis} \end{tikzpicture} \end{document}   When compiling with pdflatex, I get exactly what I want. With latex (producing a dvi file), the tick labels are all on top of each other inside the image, so something goes wrong with the positioning.  I suppose version information is useful in this case -- from the output to the screen I have this when running both latex and pdflatex:  This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)   What am I doing wrong?
56358
When i use scale ticks in my plots i can't get those multiplicators to move anywhere. So basically i use plots like:   \documentclass[border=5mm]{standalone} \usepackage{pgfplots}  \begin{document}   \begin{tikzpicture}      \begin{axis}[scaled ticks=true]     \addplot coordinates { (20000,0.0005) (40000,0.0010) (60000,0.0020)};      \end{axis}   \end{tikzpicture}%  \end{document}   which gives:     So my Question is: How can i get this x tick scale label to move onto the right side of the right y-axis? So that it is above the x-axis?  (The mind behind this question is, that i sometimes have large x-labels, which then are very close to the scale label)
89393
The following code is compiled by pgfplots to graph an exponential function and its inverse. I have some questions about the code, and I would like to modify some of the features of the graphs.  How is pgfplots instructed to draw grid lines 5 units apart? Why is the graph of the exponential function between the vertical lines x=-5 and x=3.8, I guess?  Why is the graph of the line y=x between the vertical lines x=-5 and x=5?  Why does the label for the logarithmic function interfere with the graph of the logarithmic function?  I would like the numbers on the axes to be in white nodes - so that the grid lines are not drawn over them.  The grid lines are drawn too high and too far to the right. I would like either the grid lines to be drawn a bit shorter or the axes to be drawn a bit longer.  The domain of the exponential function (that is graphed) should be from -6 to 4, and the domain of the linear function should be from -6 to 16.  \documentclass[10pt]{amsart} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings} \usepackage{tkz-euclide} \usetkzobj{all} \usepackage{pgfplots} \pgfplotsset{compat=1.11}    \begin{document} \begin{tikzpicture} \begin{axis}[grid=both,           xmax=18,ymax=17,           axis lines=middle,           restrict y to domain=-7:17,           enlargelimits] \addplot[dashed]{x} node[fill=white, above, right]{$y=x$}; \addplot[green]  {pow(2,x)} node[fill=white, above, right]{$y=2^x$}; \addplot[blue,domain=1/2^6:16,samples=100]  {log2(x)} node[fill=white, below] {$y=\log_2(x)$}; \end{axis} \end{tikzpicture}  \end{document}
98688
I've been trying to figure out how to change the chart from scientific notation to just show the 5 digit numbers. I've tried scale and scale ticks with not success.  How can I change the y-axis and data values to show the decimals not in scientific notation?  \begin{tikzpicture} \centering \begin{axis}[     width=300pt,     height=250pt,     axis lines*=left, % Don't display the top and right lines     ybar, % Display it as a bargraph     enlarge y limits={upper,value=0.2},     legend style={at={(0.5,-0.20)}, % -.20 y-axis     anchor=north,legend columns=-1},     ylabel={Densities},     nodes near coords,     every node near coord/.append style={ anchor=mid west, rotate=90},     symbolic x coords={Class1,Class3,Class5,Class7,Class9,Class11,Class13,Class15,Class17,Class19,Class21,Class23},     xtick=data,     xticklabel style={ inner sep=0pt, anchor=north east, rotate=70 },     nodes near coords align={vertical}, ] \addplot coordinates { (Class1,0.0968) (Class3,0.0887) (Class5,0.1452) (Class7,0.0726)     (Class9,0.0403) (Class11,0.0081) (Class13,0.0161) (Class15,0.0000)     (Class17,0.0161) (Class19,0.0081) (Class21,0.0000) (Class23,0.0081) }; \end{axis} \end{tikzpicture}
53161
I'm trying to do something similar to this epsilon-delta graph I've found.  Specifically, I'd like to copy the placements and arrows, like the L+e and L-e coming out of L. Same thing with the x0 + d and x0-d coming out of the x0. Can someone help me with this? This is what I have so far.    \begin{tikzpicture} \begin{axis}[ ,         legend pos=north east,         axis x line=middle,         axis y line=middle,         x tick label style={/pgf/number format/fixed,                             /pgf/number format/fixed zerofill,                             /pgf/number format/precision=1},         y tick label style={/pgf/number format/fixed,                             /pgf/number format/fixed zerofill,                             /pgf/number format/precision=1},         grid = major,         width=8cm,           height=6cm,         grid style={dashed, gray!30},         xmin=0   ,     % start the diagram at this x-coordinate         xmax= 4,    % end   the diagram at this x-coordinate         ymin= 0,     % start the diagram at this y-coordinate         ymax= 11,   % end   the diagram at this y-coordinate %axis background/.style={fill=white},         xlabel=$x$,         ylabel=$f(x)$,         tick align=outside,         enlargelimits=false] % plot the stirling-formulae %\addplot[domain=0:200, red, ultra thick,samples=100] {K/(1 +    ((K-X0)/X0) * exp(r*x))    }; \addplot[domain=0:200, red, ultra thick,samples=100] {3*x-1 };  \addplot[line width=1pt, dashed, mark=none, black] coordinates {(0,8) (3,8)}; \addplot[line width=1pt, dashed, mark=none, black] coordinates {(3,0) (3,8)}; \addplot[line width=1pt, dashed, mark=none, blue] coordinates {(3.33,0) (3.333,9)}; \addplot[line width=1pt, dashed, mark=none, blue] coordinates {(2.666,7) (2.666,0)}; \addplot[line width=1pt, dashed, mark=none, blue] coordinates {(2.666,7) (0,7)}; \addplot[line width=1pt, solid, mark=none, blue] coordinates {(3.333,9) (0,9)}; \addplot[holdot] coordinates{(60,8.66)};  % 1\addlegendentry{$f(x) = 10 \sin (x)$}  \end{axis}   \end{tikzpicture}   which gives
97394
I'm displayed three lines on a pgfplot. I want to show a marker for the slope of each line and the difference in height between lines.     I'm showing the slopes by adding triangles under the lines  (at a manual position) and placing an annotation inside the triangle (at a manual position). I'm showing the difference between the height of the lines by adding a brace manually as well.   How can I place the braces on the plot and anchor them at a certain point on each line? The triangles can be added at the end of each line declaration, but doing it like this is ok. The braces are put in place manually, which is not sustainable as I create more plots.   I want to avoid using xshift, yshiftand manual adjustment to put the braces,traingles and annotations in the right place. How can I do this?      \documentclass{article} \usepackage{pgfplots}  \pgfplotsset{compat=1.9}  \begin{document}   \begin{tikzpicture}[scale=0.45,trim axis left, trim axis right]     \begin{axis}[ylabel={$\hat{S(4)}$},xlabel={$S{^*}_{breakeven}$},ylabel style={rotate=-90},domain=1:25, legend style={legend pos=north west,font=\scriptsize}, legend cell align=left]  \addplot+[samples=200,mark=none]                                    {6.26 + 0.28*x} coordinate[pos=0.5](x) coordinate[pos=0.9] (y) (x)-| (y) node [midway,xshift=-0.6cm,yshift=0.3cm] {\footnotesize $Slope X$};;  \addplot+[samples=200,mark=none, dotted, thick]             {2.66 + 0.28*x}  coordinate[pos=0.3](a) coordinate[pos=0.6] (b) (a)-| (b) node [midway,xshift=-0.5cm,yshift=0.2cm] {\footnotesize $Slope 1$};  \draw [decorate,decoration={brace,amplitude=5pt,raise=4pt},xshift=4pt]  (225,107) -- (225,73)  node [midway,xshift=0.6cm] {\footnotesize $\beta_1$};  \end{axis} \end{tikzpicture} \end{document}
95450
Here is the minimum working example:  \documentclass{article} \usepackage{tikz} \usepackage{float} \usepackage{listings} \usepackage{color} \usepackage{textcomp} \usetikzlibrary{shapes,positioning} \begin{document} \centering \begin{tikzpicture}   \node[draw] (PersonLocation Graph) {     \begin{minipage}{.85\linewidth} \begin{lstlisting}[language=XML,escapechar=!]   &lt;collection name=PersonLocation BiMap&gt;   &lt;edge&gt;    &lt;ref&gt;//collection[name=Locations]/loc[name=XXYY]   ! \tikz \node[shape=circle,draw](srchead) {H};!   &lt;/ref&gt;   &lt;ref&gt;//collection[name=Persons]/person[id=4564]   ! \tikz \node[shape=circle,draw](deshead) {E};      %(srchead) edge[&lt;-&gt;, bend left] (deshead.south);    !     &lt;/ref&gt;    &lt;/edge&gt;   ...   ...   ...   &lt;/collection&gt; \end{lstlisting} \end{minipage}  }; \end{tikzpicture} \end{document}   I want to draw an edge from node H to E. I tried  using statement srchead) edge[&lt;->, bend left] (deshead.south); (commented out in the code). Thanks in advance for your input.
82379
I am trying to plot a function but something is incorrectly written... Could anyone please help me?  \documentclass[12pt,a4paper]{article} \usepackage{amsmath, tikz} \usepackage[margin=3cm]{geometry} \usepackage{pgfplots}      \begin{document}  \begin{tikzpicture}[scale=0.45] \draw[-&gt;] (-1,0) -- (10,0) node[below] {$x$}; \draw[-&gt;] (0,-1) -- (0,10) node[above] {$y$}; \draw[dotted] (1.4,3.33) -- (1.4,0); \draw[dotted] (0,3.33) -- (1.4,3.33)  node[left = 0.65cm] {$\frac{10}{3}$}; \draw [domain=0.1:10] plot (\x,{2/(\x-0.8)}) node[right] {$f(x)=\frac{10}{5x-4}$}; \end{tikzpicture} \end{document}
48741
I have the following code  \documentclass[border=10pt]{standalone}  \usepackage{tikz} \usepackage{pgfplotstable} \usepackage{pgfplots}  \pgfplotsset{compat=1.13}  \begin{document}  \begin{tikzpicture}  \pgfplotstableread[col sep=comma]{./data/crash_1987.csv}{\loadedtable};  \begin{axis}[     width=20cm,     height=8cm,     grid=both,     enlarge x limits=false,     % no marks,     xticklabels from table={\loadedtable}{Date},     xtick distance={1},     x tick label style={rotate=90},     y tick label style={         /pgf/number format/fixed,         /pgf/number format/precision=5     },     scaled y ticks=false,     legend style={at={(0.025,0.95)},anchor=north west},     ylabel={Value (\$)},     y label style={at={(ticklabel* cs:1.01)}, anchor=south, rotate=-90} ]  \pgfplotsinvokeforeach{SP 500}{     \addplot+[ultra thick] table [x expr=\coordindex, y=#1] {\loadedtable};     \addlegendentry{#1}; }  \end{axis}  \end{tikzpicture}  \end{document}   that produces the plot,    using the data  Date,SP 500,DIJA 1987-10-06,319.220001,2548.629883 1987-10-07,318.540009,2551.080078 1987-10-08,314.160004,2516.639893 1987-10-09,311.070007,2482.209961 1987-10-12,309.390015,2471.439941 1987-10-13,314.519989,2508.159912 1987-10-14,305.230011,2412.699951 1987-10-15,298.079987,2355.090088 1987-10-16,282.700012,2246.729980 1987-10-19,224.839996,1738.739990 1987-10-20,236.830002,1841.010010 1987-10-21,258.380005,2027.849976 1987-10-22,248.250000,1950.430054 1987-10-23,248.220001,1950.760010 1987-10-26,227.669998,1793.930054 1987-10-27,233.190002,1846.489990 1987-10-28,233.279999,1846.819946 1987-10-29,244.770004,1938.329956 1987-10-30,251.789993,1993.530029 1987-11-02,255.750000,2014.089966 1987-11-03,250.820007,1963.530029 1987-11-04,248.960007,1945.290039 1987-11-05,254.479996,1985.410034   The first x tick label won't show on the graph. How can I change this, so the plot doesn't match coordinates like (x_{n+1}, y_n)?
59697
I have a xbar chart in pgfolots. I want to have multiple addplot commands. I use symbolic y coords and ytick = data. Problem 1 is that I want all bars centered in respect to the ytick. Problem 2 is that the labels of the second addplot are missing. Background: I want this special layout because I want to have nodes near coords later in the addplot command (only for specific bars).     \documentclass[border=5mm,tikz]{standalone}  \usepackage{tikz} \usepackage{pgfplots}  \begin{document}  \begin{tikzpicture} \begin{axis}[     xbar,     symbolic y coords = {A,B,C,D,E},     enlarge y limits = 0.15,     ytick = data,     width = 160mm,     height = 90mm,     xmin = 0,     xmax = 10,     title = {One \texttt{\textbackslash addplot}},     ] \addplot[fill=green] coordinates {(1,A) (2,B) (3,C) (4,D) (9,E)}; \end{axis} \end{tikzpicture}  \begin{tikzpicture} \begin{axis}[     xbar,     symbolic y coords = {A,B,C,D,E},     enlarge y limits = 0.15,     ytick = data,     width = 160mm,     height = 90mm,     xmin = 0,     xmax = 10,     title = {Two \texttt{\textbackslash addplot}},     ] \addplot[fill=green] coordinates {(1,A) (2,B)}; % A-B \addplot[fill=green] coordinates {(3,C) (4,D) (9,E)}; % C-E \end{axis} \end{tikzpicture}  \end{document}