Quantcast
Channel: how can I fix my tikz circle to do what I want - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by hpesoj626 for how can I fix my tikz circle to do what I want

$
0
0

Explanation

Use a polar coordinate instead. Since (3,3) makes an angle of 45 degrees with the positive part of the x-axis, and you have used 2.5 cm as your radius, you can specify the coordinate as (45:2.5cm), which implicitly means (canvas polar cs:angle=45,radius=2.5cm). You can see some more explanations in the pgf manual, page 125 in version 2.10.

Code

%\documentclass[paper=a4, fontsize=12pt]{scrartcl} \documentclass[preview,border=5]{standalone}\usepackage[T1]{fontenc} \usepackage{amsmath,amsfonts,amsthm} % Maths  \usepackage{graphicx} \usepackage{float}\usepackage{tikz}\usetikzlibrary{arrows,%                plotmarks}\begin{document} \begin{figure}[H] \centering   \begin{tikzpicture}    % Axis    \draw[thick,->,black] (-3,0)--(3,0) node[below] {$k_x$}; % x axis    \draw[thick,->,black] (0,-3)--(0,3) node[left] {$k_y$}; % y axis    \draw[black,thick] (0,0) circle (2.5cm);    \draw[ultra thick,blue,dashed=on 2pt off 3pt] (0,0) -- (45:2.5cm); % Use the polar coordinate (<angle>:<length>) instead   \end{tikzpicture}\end{figure}\end{document}

Output

enter image description here

Edit

I didn't see your second concern. Although I should advise you to limit your questions in one post in the future. See the modified code below. Some explanations:

  • \pgflinewidth takes the value of line width key which is given here the value of 0.5pt.
  • I have added fill=white to the nodes of your axis labels to distinguish them from the dotted lines and added some distance in order to not cover the arrows.

%\documentclass[paper=a4, fontsize=12pt]{scrartcl} \documentclass[preview,border=5]{standalone}\usepackage[T1]{fontenc} \usepackage{amsmath,amsfonts,amsthm} % Maths  \usepackage{graphicx} \usepackage{float}\usepackage{tikz}\usetikzlibrary{arrows,%                plotmarks,patterns}\begin{document} \begin{figure}[H] \centering   \begin{tikzpicture}   \draw [line width=0.5pt, line cap=round, dash pattern=on 0pt off 2\pgflinewidth] (-3,-3) grid (3,3);    % Axis    \draw[thick,->,black] (-3,0)--(3,0) node[below=1.75pt, fill=white] {$k_x$}; % x axis    \draw[thick,->,black] (0,-3)--(0,3) node[left=1.75pt, fill=white] {$k_y$}; % y axis    \draw[black,thick] (0,0) circle (2.5cm);    \draw[ultra thick,blue,dashed=on 2pt off 3pt] (0,0) -- (canvas polar cs:angle=45,radius=2.5cm);   \end{tikzpicture}\end{figure}\end{document}

Reference

See Dotted lines in TikZ with round dots for the different approaches for producing the dotted lines in tikz.

enter image description here


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>