1

I have a set of points to be shown on a 2-dimensional plot and have written a part of code for.

  1. First, How can I label the points (from 1 to 20 for example) within a loop and represent them by bullet.

  2. Second, any of these points has a magnitude and the size of its bullet should be proportional to the magnitude. Imagine that these points are some location coordinates and the magnitude value represents the severity of a disaster happened there. How can I figure it out?

I appreciate any help in advance

\begin{figure}[H]
\centering
\newcounter{ga} 
\setcounter{ga}{1}
\begin{tikzpicture}[x=2cm,y=2cm]
 \draw[latex-latex, thin, draw=gray] (0,0)--(10,0) node [right] {$x$};
 \draw[latex-latex, thin, draw=gray] (0,0)--(0,10) node [above] {$y$}; 

\foreach \Point in {
(1,2),
(2,1),
(3,4),
(2.4,3.2),
(3.1,4,1),
(5,6),
(7,9)}
{
 \node at \Point {\textbullet};
}
\end{tikzpicture}
\end{figure}
4

1 Answer 1

3

like this?

enter image description here

above solution not consider dependance of dots size from magnitude because it is not known, which distance is meaning for magnitude (from origin? from x-axes?)

\documentclass[tikz, margin=3mm]{standalone}

\begin{document}
    \begin{tikzpicture}[%x=2cm,y=2cm
    dot/.style = {circle, fill,
                  minimum size=3pt,% here should be value dependend on magnitude,
                                   % which so far is not defined, so temporary sie is fixed
                  }
                        ]
\draw[-latex, thin, draw=gray] (0,0)--(10,0) node [right] {$x$};
\draw[-latex, thin, draw=gray] (0,0)--(0,10) node [above] {$y$};
%
\foreach \Point [count=\i] in {
(1,2),
(2,1),
(3,4),
(2.4,3.2),
(3.1,4,1),
(5,6),
(7,9)}
{
 \node[dot,label=\i] at \Point {};
}
    \end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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