How can I draw this circular crop calendar in TikZ? The sowing and harvesting seasons of a crop is shown by tapered ends. There are some crops (e.g. sugarcane) which overlap few months since the crop remain more than 12 months in the field.
Asked
Active
Viewed 604 times
3
Harun Rashid
- 123
-
1What have you tried so far? There are a number of questions regarding circular/polar graphics already in this website, did you have a look there? Maybe take a look at the (
: – Huang_d Jun 05 '18 at 13:40) syntax for polar coordinates in Tikz. -
What is the package for the letters that are not Latin? – J Leon V. Jun 05 '18 at 22:03
1 Answers
7
Just for fun, a code based on some recycled examples on drawings in polar coordinates (like Draw Life Wheel, Is there a way to make “sunburst charts” (multi-level pie charts) in LaTeX?), Simplest way to create a ring diagram in tikz with multiple connected rings? and creation of decorations), sorry for the code is half dark because there are things that I have not understood, maybe ask a question about how to define a decoration that starts thin , expand in the center and finish thin, for non-latin text use the malaylam package, it needs to be installed from your package manager.
MWE:
% arara: pdflatex: {synctex: yes, action: nonstopmode}
% By J. Leon V. Share as Beerware philosophy
\documentclass[border=20pt]{standalone}
\usepackage{xcolor}
\definecolor{back}{HTML}{A59E99}
\usepackage{tikz}
\usepackage{pgfmath}
\usepackage{xifthen}
\usepackage[keli]{malayalam}
\usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings,decorations.pathmorphing}
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macro from Alain Matthes https://tex.stackexchange.com/a/14295/154390
\makeatletter
\pgfkeys{
/pgf/decoration/.cd,
start color/.store in =\startcolor
}
\pgfdeclaredecoration{width and color change}{initial}{
\state{initial}[
width=0pt,
next state=line,
persistent precomputation={%
\pgfmathdivide{10pt}{\pgfdecoratedpathlength}%
\let\increment=\pgfmathresult%
\def\x{0}%
}
]{}
\state{line}[
width=0.5pt,
persistent postcomputation={%
\pgfmathadd@{\x}{\increment}%
\let\x=\pgfmathresult%
}
]
{%
\pgfsetlinewidth{\x pt}%
\pgfsetarrows{-}%
\pgfpathmoveto{\pgfpointorigin}%
\pgfpathlineto{\pgfqpoint{1pt}{0pt}}%
\pgfsetstrokecolor{\startcolor}%
\pgfusepath{stroke}%
}
\state{final}{%
\pgfsetlinewidth{\pgflinewidth}%
\pgfpathmoveto{\pgfpointorigin}%
\color{\startcolor}%
\pgfusepath{stroke}%
}
}
\makeatother
\begin{document}
\begin{tikzpicture}[
% Environment Cfg
font=\Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=3pt,
color=black!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% Year from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
\def\Year#1#2#3#4{%
%Drawing the border
\draw[Border,fill=back!50] (0,0) circle [radius=#1+2.5];
\draw[Border] (0,0) circle [radius=#1];
%Drawing features separations.
\foreach \m [count=\i] in {0,1,...,#3}{
\draw[Separator] (0,0) -- (360/#3*\i: #1+1) -- (360/#3*\i+15: #1+2) -- (360/#3*\i+30: #1+1);
\draw[Separator] (360/#3*\i+15: #1+2) -- (360/#3*\i+15: #1+2.5);
\draw[Separator] (0,0) -- (360/#3*\i+15: #1);}
%Drawing the names
\foreach \o/\p [count=\j] in {#4}{
\pgfmathparse{int(360/#3*\j)}
\ifthenelse{ \pgfmathresult >180}
{% True
\path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|\huge\bf|\o},
text align = center,
reverse path
},
decorate
]
(360/#3*\j:#1+0.7) arc (360/#3*\j:360/#3*(\j-1):#1+0.7);%\path
}
{%False
\path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|\huge\bf|\o},
text align = center
},
decorate
]
(360/#3*\j:#1+0.7) arc (360/#3*\j:360/#3*(\j-1):#1+0.7); %Path
}
}
%Drawing the names in non latin
\foreach \o/\p [count=\j] in {#4}{
\pgfmathparse{int(360/#3*\j+15)}
\ifthenelse{ \pgfmathresult >180}
{% True
\path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|\huge\bf\mm|\p},
text align = center,
reverse path
},
decorate
]
(360/#3*\j+15:#1+1.7) arc (360/#3*\j+15:360/#3*(\j-1)+15:#1+1.7);%\path
}
{%False
\path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|\huge\bf\mm|\p},
text align = center
},
decorate
]
(360/#3*\j+15:#1+1.7) arc (360/#3*\j+15:360/#3*(\j-1)+15:#1+1.7); %Path
}
}
%Drawing the center
\draw[line width=3pt,fill=back!50] (0,0) circle [radius=3.8];
\draw[line width=3pt,fill=back!50] (0,0) circle [radius=3.5];
\path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|\huge\bf|RABI SEASON},
text align = center
},
decorate
]
(90:2) arc (90:-90:2); %Path
\path[%Normal
decoration={
raise = -2ex,
text along path,
text = {|\huge\bf|KARIF SEASON},
text align = center
},
decorate
]
(90:2) arc (90:270:2); %Path
\path[%Normal
decoration={
raise = 1ex,
text along path,
text = {|\huge\bf\mm|RABI SEASON},
text align = center
},
decorate
]
(90:2.8) arc (90:-90:2.8); %Path
\path[%Normal
decoration={
raise = -2ex,
text along path,
text = {|\huge\bf\mm|KARIF SEASON},
text align = center
},
decorate
]
(90:2.8) arc (90:270:2.8); %Path
\draw[Border] (90:#1+1) -- (270:#1+1);
}
% Period from Andrew code with modifications:
%Variables: 1: Color, 2:Radious 3:Start 4: normalize width 5:normalize width 6:End
\def\Period[#1]#2(#3)(#4)(#5)(#6){
\draw[
line width=.4pt,
decoration={
width and color change,
start color=#1
},
decorate
]
(#3:#2cm) arc (#3:#4:#2cm);
\draw[
line width=.4pt,
decoration={
width and color change,
start color=#1
},
decorate
]
(#6:#2cm) arc (#6:#5:#2cm);
\draw[line width = 20pt,color=#1]
(#4:#2cm) arc (#4:#5:#2cm);
}
% This function draws the Year
%\Year{levels}{grid}{number of features}{Mont_name/Non_latin};
\Year{16}{2}{12}{
DECEMBER/Pausha,
NOVEMBER/Agahana,
OCTOBER/Kartik,
SEPTEMBER/Bhadra,
AUGUST/Shraavana,
JULY/Ashadha,
JUNE/Ashvin,
MAY/Jyeshtha,
APRIL/Vaisakha,
MARCH/Chaitra,
FEBRUARY/Phalguna,
JANUARY/Magha
};
\definecolor{C1}{HTML}{A16765}
\definecolor{C2}{HTML}{9D845B}
\definecolor{C3}{HTML}{62879A}
\definecolor{C4}{HTML}{5A535B}
\definecolor{C5}{HTML}{BA8C96}
\definecolor{C6}{HTML}{8C7881}
\definecolor{C7}{HTML}{748693}
\definecolor{C8}{HTML}{80826D}
\definecolor{C9}{HTML}{4F5B68}
\definecolor{C10}{HTML}{9A5665}
\Period[C1]{5}(-75)(-45)(45)(75);
\Period[C2]{6}(-105)(-65)(65)(105);
\Period[C2]{7}(255)(165)(85)(15);
\Period[C3]{8}(-105)(-45)(15)(75);
\Period[C5]{9}(105)(165)(225)(285);
\draw[line width=.4pt,decoration={width and color change,start color=C4},decorate]
(-45:9cm) arc (-45:75:9cm);
\draw[line width=.4pt,decoration={width and color change,start color=C4},decorate]
(75:10cm) arc (75:15:10cm);
\draw[line width = 20pt,color=C4](15:10cm) arc (15:-270:10cm);
\draw[line width = 20pt,color=C4](90:10cm) .. controls (2,10) and (1,9) .. (75:9cm);
\Period[C6]{11}(30)(-30)(-90)(-135);
\Period[black]{12}(105)(65)(-45)(-75);
\Period[C7]{13}(5)(75)(270)(315);
\Period[C8]{14}(5)(75)(135)(180);
\Period[C9]{15}(105)(75)(0)(-45);
\Period[C10]{15}(135)(180)(225)(295);
\end{tikzpicture}
\end{document}
J Leon V.
- 11,533
- 16
- 47
