TransWikia.com

Degree Wheel Label Direction

TeX - LaTeX Asked by beardedIntern on January 11, 2021

I’m new in latex development and I’ve found this code to make a degree wheel :

documentclass[tikz, margin=5mm]{standalone}

usepackage{tikz,pgfplots}
pgfplotsset{compat=newest}
usepackage{eurosym} % écriture du €
usetikzlibrary{arrows.meta}
%usepackage{pgf-pie}

begin{document}

% Define a few constants for easy configuration
defradius{2cm}
defonedegrad{1.8cm}
deffivedegrad{1.75cm}
deftendegrad{1.7cm}
deflabelrad{1.6cm}

begin{tikzpicture}[scale=4]

  % adding a subtle gray tone to add a bit of "personality"
  shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (radius);

  draw (0,0) circle (radius);
  draw[fill=black] (0,0) circle (.02mm);
  node[draw, circle, inner sep=.2mm] (a) at (0,0) {};

  % helper lines
  %foreach x in {-16, 90} draw[very thick, gray!40] (a) -- (x:radius);

  % main lines
  foreach x in {0,...,359} draw (x:onedegrad) -- (x:radius);

  % labels and longer lines at every 10 degrees
  foreach x in {0,10,...,350}
  {
    node[scale=1.4, rotate=x*-1] at (360-x+90:labelrad) {x};
    draw (x:tendegrad) -- (x:radius);
  };

  % lines at every 5 degrees
  foreach x in {0,5,...,355}  draw (x:fivedegrad) -- (x:radius);

end{tikzpicture}
end{document}

I just have some trouble to change the label direction : I’d like to have it in counter clockwise sens! I have this and I want this. Any idea?

Thanks

iOS 10.15.4

MacTeX 2020 Distribution

Working with texmaker

One Answer

@beardedIntern

enter image description here

documentclass[tikz, margin=5mm]{standalone}

usepackage{tikz,pgfplots}
pgfplotsset{compat=newest}
usepackage{eurosym} % écriture du €
usetikzlibrary{arrows.meta}
%usepackage{pgf-pie}

begin{document}
    
    % Define a few constants for easy configuration
    defradius{2cm}
    defonedegrad{1.8cm}
    deffivedegrad{1.75cm}
    deftendegrad{1.7cm}
    deflabelrad{1.6cm}
    
    begin{tikzpicture}[scale=4]
    
    % adding a subtle gray tone to add a bit of "personality"
    shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (radius);
    
    draw (0,0) circle (radius);
    draw[fill=black] (0,0) circle (.02mm);
    node[draw, circle, inner sep=.2mm] (a) at (0,0) {};
    
    % helper lines
    %foreach x in {-16, 90} draw[very thick, gray!40] (a) -- (x:radius);
    
    % main lines
    foreach x in {0,...,359} draw (x:onedegrad) -- (x:radius);
    
    % labels and longer lines at every 10 degrees
    foreach x in {0,10,...,350}
    {
        node[scale=1.4, rotate=0] at (x:labelrad) {x};
        draw (x:tendegrad) -- (x:radius);
    };
    
    % lines at every 5 degrees
    foreach x in {0,5,...,355}  draw (x:fivedegrad) -- (x:radius);
    
    end{tikzpicture}
end{document}

Answered by js bibra on January 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP