Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

enter image description here

share|improve this question
2  
What 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. Verron Feb 12 '13 at 7:11
1  
What 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? –  Psirus Feb 12 '13 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? –  tikzlearner Feb 12 '13 at 7:31
3  
@user1280282: The function is given in the metadata for the Wikipedia image you posted. –  Jake Feb 12 '13 at 7:33
add comment

1 Answer

up vote 10 down vote accepted

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}
share|improve this answer
2  
Don't try it for "real" scientific papers, of course. :-) –  T. Verron Feb 12 '13 at 7:40
9  
@T.Verron: Not without adding some noise, of course, otherwise people will get suspicious! –  Jake Feb 12 '13 at 7:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.