理查森数的图形

理查森数的图形

我受到了图片的启发月球朔望周期, 由...制作切面。我在这里插入代码。我尝试创建比例定义,以便可以缩放图形和文本,但我对此并不完全满意。

我可以寻求一些优化代码的建议吗?谢谢

\documentclass[a4paper,portrate]{article}
\usepackage[T1]{fontenc} 
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage[margin=0.3in]{geometry}
\usepackage{tikz}
\usetikzlibrary{scopes}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}

\usepackage{mwe}
\usepackage{lmodern}
\makeatletter
\DeclareMathSizes{\@xpt}{\@xpt}{5}{4}
\DeclareMathSizes{\@xipt}{\@xipt}{6}{5}
\DeclareMathSizes{\@xiipt}{\@xiipt}{6}{5}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xpt}{6}
\makeatother

\begin{document}
\begin{tikzpicture} [
scale=0.5,
node font=\small,
dashed axis/.style={dash pattern=on 4pt off 2pt},
moon line/.style={dash pattern=on 8pt off 4pt},
information text/.style={rounded corners, fill=Info Color, inner sep=1ex}
]

\definecolor{Earth Color}{HTML}{358af3};
\definecolor{Sun Color}{HTML}{fffc00};
\definecolor{Moon Color}{HTML}{ddbd4c};
\definecolor{Info Color}{HTML}{eeeeee};

\def\ax{0}; %Posizione centrale assi%
\def\ay{0}
%%--Scale Factor --------------------
\def\sca{1}
\def\scaa{0.9}
% Asse x e y
\draw[{Stealth[length=0.01cm]}-{Stealth[length=0.2cm]}] (-16, 0) -- (16, 0) node [scale=\sca,right=0.1em] {$P_{G}$}; % Asse 
\draw[{Stealth[length=0.001cm]}-{Stealth[length=0.2cm]}] (0, -0) -- (0, 16) node [scale=\sca,above=0.1em] {$P_{M}$};

%%--------------------------------------------------------------------------------
\path (0, 0) node [scale=\sca,shift={(7,1)}] {CL};
\path (0, 0) node [scale=\sca,shift={(4.2,0.2)}] { $P_{G}>>P_{M}$};
\path (0, 0) node [scale=\sca,shift={(4.5, 4)}, anchor=north west] {CM};
\path (0, 0) node [scale=\sca,shift={(2.5, 3)}, anchor=north west] {$P_{M}\approx P_{G}$};
\path (0, 0) node [scale=\sca,shift={(0,7)},draw=black,fill=white] {CF};
\path (0, 0) node [scale=\sca,shift={(0,6)},draw=black,fill=white] {$P_{M}>>P_{G}$};
\path (0, 0) node [scale=\sca,shift={(0,5)},draw=black,fill=white] {$R_{i}=0$};
\path (0, 0) node [scale=\sca,shift={(-4.5, 4)}, anchor=north west] {TFS};
\path (0, 0) node [scale=\sca,shift={(-4.5, 3)}, anchor=north west] {$P_{M}>0,P_{G}<0$};
\path (0, 0) node [scale=\sca,shift={(-7,1)}] {FS};
\path (0, 0) node [scale=\sca,shift={(-4.2,0.2)}] { $P_{M}\approx 0,P_{G}<0$};
%------------------------------------------------------------------------------------
\path (0, 0) node [scale=\sca,shift={(6.5,0)},draw=black,fill=white] {$R_{i}=+\infty$};
\path (0, 0) node [scale=\sca,shift={(-6.5,0)},draw=black,fill=white] {$R_{i}=+\infty$};
%
\begin{scope}[rotate around={-75:(0, 0)}]
\draw[{Stealth[length=0.01cm]}-{Stealth[length=0.01cm]}] (0, -0) -- (0, 15) node [scale=\sca,rotate = 45, above=-1em] {};
\end{scope}

\begin{scope}[rotate around={75:(0, 0)}]
\draw[-] (0, -0) -- (0, 15) node [ rotate = -15, right = 20,left=0.5em] {};
\end{scope}

\path (0, 0) node [scale=\sca,shift={(-3.7,1)}, draw=black,fill=white,rotate = -15] {$R_{i}\approx+1$};
\path (0, 0) node [scale=\sca,shift={(3.7,1)}, draw=black,fill=white,rotate = 15] {{ $ R_{i}\approx-1$}};

% draw line
\begin{scope}[rotate around={-20:(0, 0)}]
\draw[moon line] (0, 0) -- (0, 15);
\node [shift={(-0.8,1)}] at (0, 7) {};];
\end{scope}
% draw line
\begin{scope}[rotate around={20:(0, 0)}]
\draw[moon line] (0, 0) -- (0, 15);
\end{scope}


\foreach \i in {5,...,1}
{
    \pgfmathparse{(160/3.8)*(\i)-396};
    \node[scale=\sca] at (\pgfmathresult:5cm) {\i};
};

%draw information box
\draw[shift={(6, 10)}] node[scale=\scaa,above right, text width=4cm,information text] {
    \small
    {\boldmath
        \textbf{\underline{Indice}} }
    \vspace{1ex}
    \small
    \begin{description}
    {\boldmath
        \item[CL]: Libera;
        \item[CM]: Mista;
        \item[CF]: Forzata;
        \item[TFS]: Turbolenza in FS;
        \item[FS]: Flussi Stratificati;
    }
    \end{description}
};
\node[scale=\sca,above right] at (-3, -1.2) {\textbf{Fig. 1} \hspace{0.1cm} TKE};

\end{tikzpicture}

%\end{tikzpicture}


\end{document}

在此处输入图片描述

答案1

这是为了简化一些事情。我去掉了所有的rotate arounds,转而使用极坐标和键sloped、空节点、几个显式坐标等等。如果您想按因子缩放所有节点,只需将其添加every node/.append style={scale=\sca}到 tikzpicture 的选项中即可。也可以使用\gg而不是>>等等。这绝不是完全优化的代码,但也许是朝这个方向迈出的一步。

\documentclass[a4paper,portrate]{article}
\usepackage[T1]{fontenc} 
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{caption}
\usepackage[margin=0.3in]{geometry}
\usepackage{tikz}
\usetikzlibrary{scopes}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}

\usepackage{lmodern}
\makeatletter
\DeclareMathSizes{\@xpt}{\@xpt}{5}{4}
\DeclareMathSizes{\@xipt}{\@xipt}{6}{5}
\DeclareMathSizes{\@xiipt}{\@xiipt}{6}{5}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xpt}{6}
\makeatother
\captionsetup[figure]{labelfont=bf}
\begin{document}
\begin{tikzpicture} [scale=0.5,
node font=\small,
dashed axis/.style={dash pattern=on 4pt off 2pt},
moon line/.style={dash pattern=on 8pt off 4pt},
information text/.style={rounded corners, fill=Info Color, inner sep=1ex},
prg/.style={draw,fill=white}
]

\definecolor{Earth Color}{HTML}{358af3};
\definecolor{Sun Color}{HTML}{fffc00};
\definecolor{Moon Color}{HTML}{ddbd4c};
\definecolor{Info Color}{HTML}{eeeeee};

\def\ax{0}; %Posizione centrale assi%
\def\ay{0}
%%--Scale Factor --------------------
\def\sca{1}
\def\scaa{0.9}
% Asse x e y
\draw[{Stealth[length=0.01cm]}-{Stealth[length=0.2cm]}] (-16, 0) -- (16, 0) 
node [right=0.1em] {$P_{G}$} 
node[pos=2/32,above=0.8cm]{FS}
node[pos=1/4,above=3.8cm]{$P_{M}>0,P_{G}<0$}
node[pos=1/4,above]{$P_{M}\approx 0,P_{G}<0$}
node[pos=24.4/32,above]{$P_{G}\gg P_{M}$}
node[pos=30/32,above=0.8cm]{CL}
{[nodes=prg]  node[pos=0.1]{$R_{i}=+\infty$}
node[pos=0.9]{$R_{i}=+\infty$}}; % Asse 
\draw[{Stealth[length=0.001cm]}-{Stealth[length=0.2cm]}] (0, -0) -- (0, 16) 
node [above=0.1em] {$P_{M}$}
{[nodes=prg] node[pos=14/16]{CF} node[pos=12/16]{$P_{M}\gg P_{G}$}
node[pos=10/16] {$R_{i}=0$}};

%%--------------------------------------------------------------------------------
\path (2.5, 3)node [anchor=north west] {$P_{M}\approx P_{G}$}
(-4.5, 4) node [anchor=south east] {TFS};
%------------------------------------------------------------------------------------
%
\draw[{Stealth[length=0.01cm]}-{Stealth[length=0.01cm]}] (0, -0) -- (15:15) 
node[prg,midway,sloped]{ $ R_{i}\approx-1$};

\draw[-] (0, -0) -- (165:15) node[prg,midway,sloped] {$R_{i}\approx+1$};

\draw[moon line] (110:15) -- (0, 0) -- (70:15);


\foreach \i in {5,...,1}
{
    \node at ({(160/3.8)*(\i)-396}:5cm) {\i};
};

%draw information box
\draw[shift={(6, 10)}] node[scale=\scaa,above right, text width=4cm,information text] {
    \small
    {\boldmath
        \textbf{\underline{Indice}} }
    \vspace{1ex}
    \small
    \begin{description}
        \item[CL]: Libera;
        \item[CM]: Mista;
        \item[CF]: Forzata;
        \item[TFS]: Turbolenza in FS;
        \item[FS]: Flussi Stratificati;
    \end{description}
};
\node[anchor=north,align=center,text width=4cm] at (0,-0.2) {\captionof{figure}{TKE.}};

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容