latex - “填充之间”的pgfplots“软剪辑”不适用于loglogaxis
问题描述
在使用对数轴时,我正在努力软剪裁填充。软剪辑域似乎完全关闭了;即设置soft clip={domain=1:1}
产生与没有域相同的结果。
然而,域soft clip={domain=0:10000000000}
会导致水平剪辑:
pgfplots 手册没有给出在对数轴上进行剪辑的示例,可能是它根本不受支持吗?如果是的话,谁能指点我如何剪辑到soft clip={domain=3.7E4:5.5E5}
?
我的 MWE:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\def\xmin{1E4}
\def\xmax{1E7}
\begin{loglogaxis}[
xmin=\xmin,xmax=\xmax,
ymin=1E-2,ymax=1000,
xlabel={Re [-]},
small,
height=4cm,
width=15cm,
xtick={1E4,1E5,1E6,1E7},
extra x ticks={3.7E4,5.5E5},
extra x tick labels ={3.7E4,5.5E5},
extra x tick style={
tickwidth=\pgfkeysvalueof{/pgfplots/minor tick length},
tick label style={yshift=-0.5mm}
},
ytick={1E-2,1E-1,1,10},
yticklabels={,,1},
extra y ticks={1E-2,1E-1},
grid=major,
domain=1E4:1E7,
]
\def\D{1.4}
\def\yplus{30}
\addplot[name path = C,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\def\yplus{300}
\addplot[name path = D,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\addplot [gray!30] fill between[of=C and D, soft clip={domain=3.7E4:5.5E5}];
\end{loglogaxis}
\end{tikzpicture}%
\end{document}
解决方案
您可以使用以下技术对其进行剪辑:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\def\xmin{1E4}
\def\xmax{1E7}
\begin{loglogaxis}[
xmin=\xmin,xmax=\xmax,
ymin=1E-2,ymax=1000,
xlabel={Re [-]},
small,
height=4cm,
width=15cm,
xtick={1E4,1E5,1E6,1E7},
extra x ticks={3.7E4,5.5E5},
extra x tick labels ={3.7E4,5.5E5},
extra x tick style={
tickwidth=\pgfkeysvalueof{/pgfplots/minor tick length},
tick label style={yshift=-0.5mm}
},
ytick={1E-2,1E-1,1,10},
yticklabels={,,1},
extra y ticks={1E-2,1E-1},
grid=major,
domain=1E4:1E7,
]
\def\D{1.4}
\def\yplus{30}
\addplot[name path = C,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\def\yplus{300}
\addplot[name path = D,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\draw [
help lines,
name path=clippath]
(3.7E4,1E-2) rectangle (5.5E5,1E3);
\addplot [gray!30] fill between[of=C and D,soft clip={clippath}];
\end{loglogaxis}
\end{tikzpicture}%
\end{document}
推荐阅读
- scala - 关于 Scala 隐含多个类型参数的问题
- c# - cefsharp中js脚本的顺序注册
- javascript - 使用 addEventListener 后未定义
- ruby-on-rails - Intellij 附加到进程正在爆炸
- c++ - 使用逗号打印数字
C++ - c - 从多少个可重定位文件中构建一个 Elf 执行文件?
- java - 如何在 Java AWS 开发工具包的上下文中获取正在使用/打开的连接的文件描述符数量?
- python - 将 List 映射到 concurrent.futures 提前结束任务?- Python
- c++ - 堆栈上分配的内存在释放时是否会被清除?
- graphql - 具有某些参数组合的graphql查询