I want to draw this plot. I know how to do it with data. But here I don't have any data. And I want to draw this. How would I do it?
-
2What you need is an expression for the function drawn by these dots. As such, maybe this question would be a better fit for math.stackexchange.com or stats.stackexchange.com .– T. VerronFeb 12, 2013 at 7:11
-
1What you mean by draw plot without data? Do you want the axes only? Do you want to extract the data somehow from the image you have?– PsirusFeb 12, 2013 at 7:12
-
I don't have equation or the data. Is there any way to extract the data from this? Or how to find the equation and plot it?– tikzlearnerFeb 12, 2013 at 7:31
-
3@user1280282: The function is given in the metadata for the Wikipedia image you posted.– JakeFeb 12, 2013 at 7:33
1 Answer
As others have said, if you don't have the data values, you need to generate them using a function. The easiest way is to use PGFPlots and simply plot a function f(x) where x is sampled at regular intervals within some range. For example, to plot f(x)=x^3, you could use the following code:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot [only marks, fill=cyan, mark size=1.5] {x^3};
\end{axis}
\end{tikzpicture}
\end{document}
For more complicated functions, and especially when your x samples aren't regularly spaced, you can either calculate the data outside of TeX and simply include it in your document, or you could use PGFPlotstable to generate a data table inside the document.
Here's an example where I created a table with three columns: x, an intermediate step, and y, based on the code found in the metadata included with the Wikipedia image you used:
\documentclass{article}
\usepackage{pgfplots, pgfplotstable}
\begin{document}
\pgfplotstablenew[
create on use/x/.style={
create col/expr={rnd}
},
create on use/intermediate/.style={
create col/expr={ln(\thisrow{x}/(1-\thisrow{x}))}
},
create on use/y/.style={
create col/expr={
\thisrow{intermediate}/(abs(\thisrow{intermediate}))*abs(\thisrow{intermediate})^1.4
}
},
columns={x,intermediate, y}]
{75}
\datatable
\begin{tikzpicture}
\begin{axis}
\addplot [only marks, fill=cyan, mark size=1.5] table [x=x, y=y] {\datatable};
\end{axis}
\end{tikzpicture}
\end{document}
-
2
-
9@T.Verron: Not without adding some noise, of course, otherwise people will get suspicious!– JakeFeb 12, 2013 at 7:41