1

I am looking to place points around two circles like this:

enter image description here

Using tikz I can draw for example the two circles but how can I either i)plot small circles like \fill (x,y) circle[radius=3pt]; on the given circles or ii)around the circle. I can't find each point satisfying the equation for a large number of points as this would be very time consuming. Thanks

2
  • 1
    Welcome! Please provide code showing what you've got/tried, preferably in the form of a minimal example which we can copy-paste-compile. If you are representing data, aren't you using the data to determine the plot?
    – cfr
    Jun 25, 2017 at 21:41
  • Hello and thank you for you comment. I'm trying to make an example, no given data needed.
    – John
    Jun 25, 2017 at 21:44

1 Answer 1

4

Quick and dirty with pgfplots, plotting cos(x)+random number against sin(x)+random number.

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
  cycle list={
    only marks,mark=*,fill=red,draw=black,mark size=1pt\\
    only marks,mark=*,fill=cyan,draw=black,mark size=1pt\\
  },
  domain=0:360,
  samples=500,
  title={N=500,\dots},
  grid,
  axis equal
]

\addplot ({(0.5+0.07*rand)*cos(x)},{(0.5+0.07*rand)*sin(x)});
\addplot ({(1+0.1*rand)*cos(x)},{(1+0.1*rand)*sin(x)});

\end{axis}
\end{tikzpicture}
\end{document}
5
  • @John I edited the code slightly. Jun 25, 2017 at 21:49
  • Nice - a small detail; if the points are to be spread concentric around the circle, you need to multiply the random factor - not add it. Something like: {(0.9+0.2*rnd)*cos(x)},{(0.9+0.2*rnd)*sin(x)} (not tested). Jun 26, 2017 at 3:12
  • @hpekristiansen Thanks. It doesn't appear to make much of a difference in this case (see imgur.com/a/9wlVM -- left is addition, right multiplication). I should have used rand though (numbers between -1 and 1), and not rnd (between 0 and 1). Jun 26, 2017 at 7:00
  • You would need a lot of points to see that with addition, the ring is no longer perfectly round. Jun 26, 2017 at 11:45
  • @hpekristiansen Indeed, 100 000 points (with matplotlib) made that easier to see. Thanks again. Jun 26, 2017 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .