# How to make an inline pgfplot

I have the following code to graph a function with a height of 2em, and in line with some text, but it gives an error.

\documentclass{article}
\usepackage{pgfplots}

\begin{tikzpicture}
\begin{axis}[axis lines=none,height=2em]
\end{axis}
\end{tikzpicture}}

\begin{document}
\end{document}


Package pgfplots Error: Error: Plot width 23.1882pt' is too small.
This cannot be implemented while maintaining constant size for labels.
Sorry, label sizes are only approximate. You will need to adjust your width.


Which is kinda silly considering I've removed the labels. I want an output like so:

-
You can draw big and then put inside a \scalebox{<scale>}{plot}. Hiding axis lines or emptying the ticks don't mean that you skip the whole plotting mechanism (though plausible alternative). –  percusse Apr 6 '14 at 10:46

If you set scale only axis, there's no minimum height:

\documentclass{article}
\usepackage{pgfplots}
\begin{tikzpicture}
\begin{axis}[hide axis, scale only axis, height=2ex]

Works perfectly! Thanks for fixing the spacing too, but I don't quite get how appending {}` added empty space, I've never seen that trick before. –  mcjohnalds45 Apr 6 '14 at 15:43