在 tikz 中绘制圆形作物日历

在 tikz 中绘制圆形作物日历

我怎样才能绘制这个圆形农作物日历TikZ?作物的播种和收获季节用锥形末端表示。有些作物(例如甘蔗)的播种和收获季节重叠几个月,因为作物在田地中生长的时间超过 12 个月。在此处输入图片描述

答案1

只是为了好玩,一个基于一些极坐标绘图的回收示例的代码(如绘制生命之轮有没有办法在 LaTeX 中制作“旭日图”(多层饼图)?)在 tikz 中创建具有多个连接环的环形图的最简单方法?创造装饰品), 抱歉代码有点暗,因为有些东西我还没有理解,也许可以问一个问题,关于如何定义一个从细开始,从中心扩展,最后变细的装饰,对于非拉丁文本使用 malaylam 包,它需要从你的包管理器中安装。

结果: 在此处输入图片描述

梅威瑟:

% 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}

相关内容