# Wrapping text around Tikz picture

I have problem with wrapping text around my tikz picture. The text pushes the picture down on the left side. The right side of the picture is just white blank space. Here is the code I am using:

\documentclass[10pt]{article} \usepackage{pgf,tikz} \usepackage{mathrsfs} \usetikzlibrary{arrows} \pagestyle{empty} \begin{document}     \definecolor{ffxfqq}{rgb}{1.,0.4980392156862745,0.}     \definecolor{ffqqqq}{rgb}{1.,0.,0.}     \definecolor{ttzzqq}{rgb}{0.2,0.6,0.}     \definecolor{ffvvqq}{rgb}{1.,0.3333333333333333,0.}     \definecolor{qqqqff}{rgb}{0.,0.,1.}     \definecolor{ccqqqq}{rgb}{0.8,0.,0.}     \definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}     \definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882} \begin{wrapfigure}{l}         \begin{tikzpicture}[scale=5.0][line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]         \draw [color=cqcqcq,, xstep=0.2cm,ystep=0.5cm] (-0.1,-0.2) grid (1.01,1.9);         \draw[->,color=black] (-0.1,0.) -- (1.01,0.);         \foreach \x in {,0.2,0.4,0.6,0.8,1.}         \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};         \draw[->,color=black] (0.,-0.2) -- (0.,1.9);         \foreach \y in {,0.5,1.,1.5}         \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};         \clip(-0.1,-0.2) rectangle (1.01,1.9);         \draw[line width=1.2pt,color=qqwuqq,smooth,samples=100,domain=-0.1:1.01] plot(\x,{(\x)*(1.0-(\x))});         \draw[line width=1.2pt,color=ccqqqq,smooth,samples=100,domain=-0.1:1.01] plot(\x,{4.0*(\x)*(1.0-(\x))^(2.0)});         \draw[line width=1.2pt,color=qqqqff,smooth,samples=100,domain=-0.1:1.01] plot(\x,{9.0*(\x)*(1.0-(\x))^(3.0)});         \draw[line width=1.2pt,color=ffvvqq,smooth,samples=100,domain=-0.1:1.01] plot(\x,{16.0*(\x)*(1.0-(\x))^(4.0)});         \draw [color=ttzzqq](0.18243947642766176,0.3440435383967781) node[anchor=north west] {$\mathbf{n=1}$};         \draw [color=ffqqqq](0.16216842349125493,0.7017667929520731) node[anchor=north west] {$\mathbf{ n=2}$};         \draw [color=qqqqff](0.10058496467045104,1.1070148535690674) node[anchor=north west] {$\mathbf{n=3}$};         \draw [color=ffxfqq](0.06083458820803932,1.4072463768115956) node[anchor=north west] {$\mathbf{n=4}$};         \draw[color=cyan, line width=1.2pt,smooth,samples=100,domain=-0.1:1.01] plot(\x,{25.0*(\x)*(1.0-(\x))^(5.0)});         \draw [color=cyan](0.08687594115602958,1.7874779000541237) node[anchor=north west] {$\mathbf{n=5}$};         \begin{scriptsize}         \draw[color=qqwuqq] (-1.3436812232132522,-3.245895724337) node {$f$};         \draw[color=ccqqqq] (-0.3793582763813274,-3.245895724337) node {$g$};         \draw[color=qqqqff] (-0.17085601760685717,-3.245895724337) node {$h$};         \draw[color=ffvvqq] (-0.09266767056643087,-3.245895724337) node {$p$};         \draw[color=black] (-0.049229699988416246,-3.245895724337) node {$r$};         \end{scriptsize}         \end{tikzpicture} \end{wrapfigure}     \end{document} 


Replay

Adding {0pt}as the last argument of wrapfigure works:

Here your code with pgfplots, which can be used to customize axis ( ticks, grid, labels, legends, .....) simply with key=value syntax.

Code

\documentclass[10pt]{article}
\usepackage{lipsum}
\usepackage{wrapfig}
\usepackage{pgfplots}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}

\definecolor{color1}{rgb}{0.,0.39,0.}
\definecolor{color2}{rgb}{0.8,0.,0.}
\definecolor{color3}{rgb}{0.,0.,1.}
\definecolor{color4}{rgb}{1.,0.34,0.}
\colorlet{color5}{cyan}

\pgfplotsset{width=7cm,height=9cm,plotstyle/.style={line width=1.2pt,smooth,samples=100,domain=-0.05:1.01}}

\begin{document}

\begin{wrapfigure}{r}{6cm}
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=1,
ymin=0,ymax=2,
axis lines=middle,
grid=major,
xtick={0,0.2,...,1},
ytick={0,0.5,...,2},
enlargelimits={abs=5mm},
xlabel={$x$},
ylabel={$y$},
xlabel style={below},
ylabel style={left}]
\addplot[plotstyle,color1] {(x)*(1.0-(x))}node[pos=0.4,above,font=\footnotesize]{$n=1$};
\addplot[plotstyle,color2] {4.0*(x)*(1.0-(x))^(2.0)}node[pos=0.46,above,font=\footnotesize]{$n=2$};
\addplot[plotstyle,color3] {9.0*(x)*(1.0-(x))^(3.0)}node[pos=0.53,above,font=\footnotesize]{$n=3$};
\addplot[plotstyle,color4] {16.0*(x)*(1.0-(x))^(4.0)}node[pos=0.575,above,font=\footnotesize]{$n=4$};
\addplot[plotstyle,color5] {25.0*(\x)*(1.0-(\x))^(5.0)}node[pos=0.61,above,font=\footnotesize]{$n=5$};
\end{axis}
\end{tikzpicture}
\end{wrapfigure}

\lipsum[1-2]

\end{document}



Output

Category: tikz pgf Time: 2016-07-28 Views: 3
Tags: tikz pgf

## Related post

• Wrap text around a picture except for the first line 2012-03-13

As the following minimal sample shows, a text wrapping around a picture starts wrapping with the first line. Including the wrapfigure in the text leads to strange paragraph breaks. %---- \documentclass[bibliography=totoc,listof=totoc,12pt,a4paper,one

• How to wrap text around a TikZ image? 2011-06-23

I'm trying to wrap text around a TikZ image using the wrapfigure package, but it doesn't seem to be working--the document compiles, but the image is pushed down with new text. The error I get on the log is that wrapfigure is being used in a conflicti

• Remove whitespace around tikz picture in running text 2015-09-01

I'm trying to draw a star in text brackets using tikz and I can't figure out how to remove the large white space to the left and right. The code is: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \newcommand{\yellowstar}{

• wrap text around picture on another picture 2015-12-07

I have a small picture on top of a larger photo. I am trying to wrap text around the small picture. To keep type on top of the large photo, I need to select "ignore text wrap" which does not allow me to wrap type rung the small photo on top. How

• Why can't I wrap text around grouped images in Word? 2010-03-26

When I paste two images into Microsoft Word and I set Wrap Text To Square: and then group them so they stick nicely together, I can no longer Wrap Text around this newly grouped image. Any explanation why text wrapping is disabled for grouped images?

• How can I use tikzpicture and wrapfigure and get text around the picture on a beamer frame 2015-11-13

I've tried the following, but now the last lines are not on the page anymore.... I want to be able to have text around a picture (hence the wrapfigure), have the picture scaled, and use tikz (code generated by GeoGebra). But the text is not arount th

• Wrap text around symbol 2011-02-12

How is it possible to wrap text around a symbol? This is my code so far: \documentclass{report} \usepackage[english]{babel} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{fourier} \usepackage{blindtext} \newcomma

• Wrap text around pseudocode 2011-12-12

I use algorithm/algorithmic packages to write some pseudocode. The width of the box spans across the entire page and I was wondering if there is any way to constrain it (since the actual code doesn't exceed the mid of the page). Practically, I want t

• Replacement for picins, for wrapping text around some construct within multicols? 2012-02-08

Within the multicols environment I would like to wrap text around a makebox construct. The description of picins in The LaTeX Companion, 2nd ed., makes it sound ideal, but it's no longer being distributed with TeXLive and I'd prefer to use something

• How can I wrap text around a circle? 2012-05-18

How can I wrap text around a circle? For example: the text in the sectors of this chord plot. Perhaps one could use FilledCurve[] and then apply a GeometricTransformation[]? --------------Solutions------------- The following response borrows shameles

• Wrapping text around figure 2012-12-28

I have the following command to display EPS figures and wrapping text around the figure: \begin{wrapfigure}{r}{0.5\textwidth} \begin{center} \includegraphics[width=0.48\textwidth]{figures/flowchart} \end{center} \caption{A gull} \end{wrapfigure} The

• How to wrap text around theorem box? 2013-09-11

I'm using the thmtools to create theorem boxes. \usepackage{thmtools} \usepackage[unq]{unique} \usepackage[usenames,dvipsnames,svgnames,table]{xcolor} \usepackage{wrapfig} \usepackage{float} \declaretheoremstyle[ spaceabove=6pt, spacebelow=6pt, headf

• How to make the wrap text around the image? 2014-12-15

How to make the wrap text around the image, as in this example? There are no restrictions. I can use any options --------------Solutions------------- If I understand well your problem, you should use the cuted package (from the sttools bundle) and it

• Can LuaLaTeX make wrapping text around figures easier? 2015-04-07

If there is one thing LaTeX has never been good at, it is wrapping text around figures. Well, I have grown used to LuaLaTeX always providing a solution to what seemed impossible before. So does there exist some effective LuaLaTeX solution to wrapping

• How to wrap text around a textbox which overlays a table with multiple columns 2015-08-28

How can I wrap text around a textbox or image which overlays a table with multiple columns? --------------Solutions------------- You can't place a text box over a table border AND wrap text around Workaround: Create two additional text boxes and plac

• Weird text wrapping problem (wrapfigure, wraptable) - trying to wrap text around an image and a table 2015-10-10

I'm pretty new to LaTeX - I've done a few very basic homework assignments but this is my first time trying to publish a lab report. I've sort of mickey-moused a template that works but I'm having trouble wrapping text around two figures, a table and

• How do you code a circular image then wrap text around it? 2016-01-24

What I'm trying to do is wrap text around an image. I have managed to do it with an image but I can't understand how to insert a circle in the HTML. I have added the style: shape-outside: circle(); but now I just need to add it into the HTML. Can any

• knitr: How to wrap text around a table generated around code chunk? 2016-03-01

I would like to wrap text around a table generated by a knitr code chunk. I found a solution for a regular table here, but I didn't manage to re-implement it for a table generated by a code chunk. For a figure generated by a code chunk I just enclose

• Wrapping text around image in memoir document class 2016-07-13

I am using the memoir document class and I want to wrap text around an image. The image should be on the left and the text beside it. This is my main syntax: \documentclass[a4paper,oneside]{memoir} \usepackage[inner=3cm,outer=3cm]{geometry} \usepacka