How to draw this graph in LaTeX?   Here is an orientation code:  \begin{tikzpicture} \begin{axis}[xlabel=$x$, ylabel=$y$, grid=major, xmin=-7, xmax=7, ymin=-30, ymax=30, height=60mm, width=70mm] \plot[blueline, line width=1pt] plot[domain=-4:4, samples=100] expression{x^2}; \end{axis} \end{tikzpicture}
103215
Having trouble writing the right code for this graph If anyone could help I'll be thankful.  y=ax^2 α={-2.4,-2.1,...2,4}
107917
The following code I got from:     \documentclass{article}   \usepackage{pgfplots}  \usetikzlibrary{patterns}  \makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother \pgfplotsset{only axis on top/.style={axis on top=false, after end axis/.code={              \pgfplotsset{axis line style=opaque, ticklabel style=opaque, tick style=opaque,                           grid=none}\pgfplotsdrawaxis}}}  \newcommand{\drawge}{-- (rel axis cs:1,0) -- (rel axis cs:1,1) -- (rel axis cs:0,1) \closedcycle} \newcommand{\drawle}{-- (rel axis cs:1,1) -- (rel axis cs:1,0) -- (rel axis cs:0,0) \closedcycle}  \begin{document}    \begin{figure}[htpb]      \centering      \label{fig:p3:c1}      \begin{tikzpicture}        \begin{axis}[only axis on top,         axis line style=very thick,          axis x line=middle,          axis y line=middle,           ymin=-1,ymax=5.99,xmin=-1,xmax=5.99,           xlabel=$x$, ylabel=$y$,grid=major        ]          \addplot [draw=none, pattern=north west lines, pattern color=blue!40, domain=-10:12]                  {3-3/2*x} \drawge;         \addplot[very thick, domain=-1:2.5,&lt;-&gt;] {3-3/2*x};        \end{axis}      \end{tikzpicture}      \caption{Problem 4, Part A}    \end{figure}   \end{document}   The question here is how can I get it to work with a setting like the following:    \documentclass[dvipsnames]{article} \usepackage{amsmath,pgfplots,tikz} \usetikzlibrary{arrows,calc} \begin{document}      \begin{tikzpicture}[transform shape,scale=0.6]     \draw[step=1cm,gray,very thin] (-4,-3) grid (4,5);     \draw [-latex,thick](-4,0) -- (4,0) node[right] {$x$} coordinate(x axis);     \foreach \x in {-3,-2,-1,1,2,3}              \draw (\x,0.1) -- (\x,-0.1) node [fill=white,below] {$\x$};     \foreach \y in {-2,-1,1,2,3,4}              \draw (0.1,\y) -- (-0.1,\y) node [fill=white,left] {$\y$};     \draw [-latex,thick](0,-3) -- (0,5) node[above] {$y$} coordinate(y axis);     \node at (-0.25,-0.3375) {0};     \draw[color=Cerulean,latex-latex,domain=-1.3:4] plot (\x,-3/2*\x+3);     \filldraw[OrangeRed] (0,3) circle (1.5pt) node[inner sep=2pt,right,fill=white,shift={(0.25,0)}] {$(0,3)$};     \filldraw[OrangeRed] (2,0) circle (1.5pt) node[inner sep=2pt,right,fill=white,shift={(0.25,0.35)}] {$(2,0)$};     \end{tikzpicture} \end{document}   That is, I would like to represent the solution set of the inequality in a similar manner as is done using pgfplots in my last example above. Is this possible?
109781
I have a graph that consists of x and y from Z/11. Is it possible to programmatically draw the lines that have a slope of 2?  Like from (0,0) to (5,10) and (6,12) would become (6,1) because of modulo 11. Just like the graph below.    For that graph I use the following code. But I have to manually calculate the start and end points.      \begin{tikzpicture}     \coordinate (Origin)   at (0,0);     \coordinate (XAxisMin) at (0,0);     \coordinate (XAxisMax) at (11,0);     \coordinate (YAxisMin) at (0,0);     \coordinate (YAxisMax) at (0,11);      \draw [thick, gray,-latex] (XAxisMin) -- (XAxisMax);% Draw x axis     \draw [thick, gray,-latex] (YAxisMin) -- (YAxisMax);% Draw y axis      \foreach \x in {0,1,...,10}{% Two indices running over each       \foreach \y in {0,1,...,10}{% node on the grid we have drawn          \node[draw,circle,inner sep=1pt,fill] at (\x,\y) {};             % Places a dot at those points       }     }      \draw [thin, blue,-latex] (Origin) -- (5,10);       \draw [thin, blue,-latex] (6,1) -- (10,9); \end{tikzpicture}
85537
Because I often use the same options for multiple axes in my LaTeX documents, I use the following code to simplify my life.  \documentclass{article} \usepackage{pgfplots} \newcommand{\linecolora}{blue} \newcommand{\marka}{o} \newcommand{\plotoptsa}{color=\linecolora,mark=\marka} \newcommand{\xlabela}{Test test 123} \newlength\figurewidth \setlength{\figurewidth}{\columnwidth} \newcommand{\axisoptsa}{width=100,xlabel=\xlabela} \newcommand{\axisoptsb}{ymin=-8,ymax=-3} \begin{document}     \begin{tikzpicture}         \begin{axis}[\axisoptsa,\axisoptsb]             \expandafter\addplot\expandafter[\plotoptsa] coordinates                 {                     (2,-2.8559703)                     (3,-3.5301677)                     (4,-4.3050655)                     (5,-5.1413136)                     (6,-6.0322865)                     (7,-6.9675052)                     (8,-7.9377747)                 };          \end{axis}          \end{tikzpicture} \end{document}   It works like a charm! However, if I change width=100 into the defined width=\figurewidth, I get Missing \endcsname inserted. error. Using  \expandafter\begin{axis}\expandafter[\axisoptsa,\axisoptsb]   does not help.
19150
I am facing difficulties in drawing the following diagram in latex :-  I need to draw it in the same orientation but bold edges and mid points of my choice.
5853
I have problem to draw graphic with LaTeX (especially TikZ)?  Like this:
77575
I am trying to get these plots:    and    Code:  \documentclass{article} \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:10, samples=100,   axis lines*=left, xlabel=$score$, ylabel=$freq$,   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 [fill=blue!50,very thick,cyan!40!black] {gauss(6.5,1)} \closedcycle;  \end{axis}  \end{tikzpicture} \end{document}   I would like some help to add the annotations and 2nd curves on each plots.  Thanks for your help and time.
115016
I am attempting to draw the following graph in tikz.   My attempt so far has gotten me to here.   \documentclass[border=3mm]{standalone} \usepackage[dvipsnames]{xcolor} \usepackage{pgfplots} \pgfplotsset{width=8cm,compat=newest} \usetikzlibrary{arrows}    \begin{document}      \begin{tikzpicture}     \begin{axis}[  xtick = \empty,    ytick = \empty, xlabel = {$t$}, x label style = {at={(1,0)},anchor=west}, ylabel = {$q$}, y label style = {at={(0,1)},rotate=-90,anchor=south}, axis lines=left, enlargelimits=0.2,                 ]               \addplot[mark=none, blue] coordinates {(1.85,1.1)(0.0,3)};  \addplot[color=red,smooth,thick,-] coordinates  {     (0.3,2.7) (1.3,1) (2.5,2) (4,0.65)  (6,0.8)};       \end{axis}     \end{tikzpicture} \end{document}   The output is;     This has taken me most of the day to draw. I can't understand how to write the coordinates to get the shape of the tangent curve I want. I am wondering is there a knack to this and can anyone offer me advice on how to shape things correctly. There must be a better way than I am currently going about things!
40689
I have to draw function with \plot but it says "Dimension too large", this is my code:   \begin{tikzpicture}  \begin{axis}[grid=major, xmin=0, xmax=3, ymin=-1.5, ymax=1.5, xlabel=$t$, ylabel=$x(t), y(t)$, scale=0.3]  \plot[blue] plot[samples=100, smooth] expression{(1 + 2 * x)*exp(-2*x) * sin(280* 3.14 * x)};  \plot[red, dashed] plot[samples=100, smooth] expression{ (1+2*x) * exp(-2*x)};  \end{axis} \end{tikzpicture}   Hope you can help me because I need it in few days, there are picture how it should look:    and this are functions:
105946
When I try to plot a function on a small range, the output is an empty graph from 0 to 1 on the x and y axis. What can I do to fix this? My tex looks like this:  \begin{tikzpicture} \begin{axis}[ xmin=4.0, xmax=4.001, samples=60, xlabel=$time$, ylabel={$acceleration$} ]   \addplot [very thick, blue] {5*x-x^2};  \end{axis} \end{tikzpicture}
97234
I'm trying to draw a relatively simple chart of a number line, and when one of the nodes is too close to the edge of the plot, it gets cut off.  The code:  \documentclass{article}  \usepackage{natbib} \usepackage{graphicx} \usepackage{pgfplots}  \begin{document}  \begin{tikzpicture} \begin{axis}[   width=\columnwidth,   axis y line=none,   axis lines=left,   axis line style={-},   xmin=0,   xmax=1,   ymin=0,   ymax=1,   xlabel=$\mu$,   scatter/classes={o={mark=*}},   restrict y to domain=0:1,   xtick={0,1} ] \draw[ultra thin] (axis cs:0, 0) -- (axis cs:0,.05); \draw[ultra thin] (axis cs:.4, 0) -- (axis cs:.4,.05); \node[coordinate,label=above:{$B$}] at (axis cs:0.0,0.05) {}; \node[coordinate,label=above:{$A$}] at (axis cs:0.4,0.05) {}; \node[coordinate,label=above:{$b$}] at (axis cs:0.2,0.02) {}; \node[coordinate,label=above:{$a$}] at (axis cs:0.7,0.02) {}; \end{axis}; \end{tikzpicture} \end{document}   The Result:    How do I get the B to fully render?
73989
I am new to 'drawing' in LaTeX with pgfplots, tikz, etc. I am trying to plot a Poisson distribution with varying means. Here is what I have tried (based on )  \documentclass{article} \usepackage{pgfplots} \pgfmathdeclarefunction{poiss}{1}{%   \pgfmathparse{(#1^x)*exp(-#1)/(x!)}% } \begin{document} \begin{figure} \begin{tikzpicture} \begin{axis}[every axis plot post/.append style={   mark=none,domain=0:20,samples=20},   axis x line*=bottom,   axis y line*=left,   enlargelimits=upper]   \addplot {poiss(1)};   \addplot {poiss(2)};   \addplot {poiss(3)}; \end{axis} \end{tikzpicture} \end{figure} \end{document}   What happens next is very strange to me; if I plot this with domain=0:20,samples=20, it looks like the following:    However, if I change domain=0:10,samples=10, it looks like the following:    You can see that the higher mean distributions are 'taller' than they should be, depending on the number of samples; the larger the number samples, the more correct the distributions look but obviously a graph going from 0 to 50 on the x-axis with nothing interesting after 10 is no good!  I'm wondering why is this happening, and how can I fix it? Forgive me if it's something painfully obvious. Thanks.
99007
For an example relation R: A -> B, I have the following TikZ code:  \documentclass[tikz]{standalone} \usepackage{tikz} \usetikzlibrary{shapes,backgrounds,decorations.text,patterns} \usetikzlibrary{plotmarks}  \begin{document} \begin{tikzpicture}   \begin{scope}[mark=*,mark size=1pt] % sets A &amp; B   \draw (0,0) node[ellipse, minimum height=50pt,minimum width=30pt,draw,label=above:A]{};   \draw (2,0) node[ellipse, minimum height=50pt,minimum width=30pt,draw,label=above:B]{}; % draw line and label origin a to c   \draw[-&gt;] plot coordinates {(0,10pt)} (0,10pt) node[above]{a} -- (1.9,16pt); % add end point   \node at (2,16pt) {\pgfuseplotmark{*}}; % add end label   \node[above] at (2,16pt) {c}; % draw line and label origin a to e   \draw[-&gt;] plot coordinates {(0,10pt)} (0,10pt) node[above]{a} -- (1.9,-15pt); % add end point   \node at (2,-15pt) {\pgfuseplotmark{*}}; % add end label   \node[above] at (2,-15pt) {e}; % draw line and label origin b to d   \draw[-&gt;] plot coordinates {(0,-10pt)} (0,-10pt) node[above]{b} -- (1.6,2pt);  % add end point   \node at (1.7,2pt) {\pgfuseplotmark{*}}; % add end label   \node[above] at (1.7,2pt) {d};   \end{scope} \end{tikzpicture} \end{document}   Produces:    Is there a simpler way of accomplishing this in TikZ?  It seems like a lot of work.
48015
I would like to plot these four equations :   $$y=\dfrac{3}{2x+1}, y=3x-2, x=2   y=0$$   and i don't know how to draw vertical line of equation x=2 and  shade a region like the picture below      \documentclass{article} \usepackage{pgfplots} \usepackage{pst-plot} \usepackage{pstricks}  \begin{document}  \begin{table}[h] \centering     \begin{tikzpicture}         \begin{axis}[              extra y ticks       = 2,       extra y tick labels = z,       extra y tick style  = { grid = major },              axis lines=middle,              grid=major,               xmin=-1,                 xmax=3,         ymin=-1,         ymax=3,         xlabel=$x$,         ylabel=$y$,                 xtick={-1,-0.5,0,...,3},         ytick={-1,-0.5,0,...,3},         legend style={at={(axis cs:-.5,0,1)}, anchor=north west,width=90cm, draw=none,opacity=.9, inner sep=2pt,fill=gray!10}]             %\addlegendentry{$f(x)=2^{x}$}             %\addlegendentry{$f(x)={\left(\dfrac{1}{2}\right)}^x$}             smooth,                 enlargelimits=false,         axis line style={latex-latex},  \addplot[thick, samples=100, domain=0:6,blue] {3/(2*x+1)}; %node[right] {$f(x)=2^{x}$}; \addplot[thick, samples=50, smooth,domain=0:6,olive] {3*x-2}; % node[right]{$f(x)={\dfrac{1}{2}}^x$};     \end{axis} \end{tikzpicture} \end{table}  \end{document}   which produces :
74588
I want to plot this graph, but I don't know how to code the words in the nodes.     Here is my code:  \documentclass{article} \usepackage{amsmath} \usepackage{titletoc} \usepackage{tikz} \usetikzlibrary{trees,positioning,fit}  \begin{document}{\allowdisplaybreaks[4]}  \tikzstyle{bag} = [text width=2em, text centered] \tikzstyle{end} = []  \begin{center} \begin{tikzpicture}[sloped] \node (a) at ( 0,0) [bag] {$\ln r_0$}; \node (b1) at ( 3,1.5) [bag] {$\ln r_{10} + \sigma_1\sqrt{\Delta t_1}$}; \node (b2) at ( 3,-1.5) [bag] {$\ln r_{10}$}; \node (c1) at ( 6,3) [bag] {$\ln r_{20} + 2\sigma_2\sqrt{\Delta t_2}$}; \node (c2) at ( 6,1.5) [bag] {$\textrm{Mean} = \ln r_{20} + \dfrac{3}{2}\sigma_2\sqrt{\Delta t_2}$\\$\textrm{Mean Change} = \mu_{11}\Delta t_2 = \ln\dfrac{r_{20}}{r_{10}} + \dfrac{3}{2}\sigma_2\sqrt{\Delta t_2} - \sigma_1\sqrt{\Delta t_1}$}; \node (c3) at ( 6,0) [bag] {$\ln r_{20} + \sigma_2\sqrt{\Delta t_2}$}; \node (c4) at ( 6,-1.5) [bag] {$\textrm{Mean} = \ln r_{20} + \dfrac{3}{2}\sigma_2\sqrt{\Delta t_2}$\\$\textrm{Mean Change} = \mu_{11}\Delta t_2 = \ln\dfrac{r_{20}}{r_{10}} + \dfrac{3}{2}\sigma_2\sqrt{\Delta t_2} - \sigma_1\sqrt{\Delta t_1}$}; \node (c5) at ( 6,-3) [bag] {$\ln r_{20}$}; \draw [-&gt;] (a) to node [below] {} (b1); \draw [-&gt;] (a) to node [above] {} (b2); \draw [-&gt;] (b1) to node [below] {} (c1); \draw [-&gt;] (b1) to node [below] {} (c2); \draw [-&gt;] (b1) to node [below] {} (c3); \draw [-&gt;] (b2) to node [below] {} (c3); \draw [-&gt;] (b2) to node [below] {} (c4); \draw [-&gt;] (b2) to node [below] {} (c5); \end{tikzpicture} \end{center}  \end{document}       Update code use  \draw [-&gt;] (a) to node [below] {} (b1.south east); \draw [-&gt;] (a) to node [above] {} (b2.north east); \draw [-&gt;] (b1.south east) to node [below] {} (c1.west); \draw [-&gt;] (b1.south east) to node [below] {} (c2.west); \draw [-&gt;] (b1.south east) to node [below] {} (c3.west); \draw [-&gt;] (b2.north east) to node [below] {} (c3.west); \draw [-&gt;] (b2.north east) to node [below] {} (c4.west); \draw [-&gt;] (b2.north east) to node [below] {} (c5.west);
84823
How do I create a graph multiple Y axes(more than 2) stacked one over the other with a common X axis?    See attached figure.   Each zero in y direction represents the beginning of new y axis.
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}