我正在使用 pgfplots 绘制两幅具有极坐标的图像。即使我指定了代表 100% 值的相同值(两个红色圆圈的半径均为 100,它们是两个图像中的最后一个图),pgfplots 也会以不同的尺寸绘制它们,这些尺寸似乎与其他值有关(用蓝线表示的其他体积)。
我尝试过在坐标中添加测量单位,但结果是一样的。另一种尝试是设置 y 范围,但输出结果相同。
我总是可以手动缩放图像,但这会导致图例出现问题。我得到相同红色圆圈的唯一情况是当蓝线的值小于 100 时。
我已附上用于生成图像的代码。可在此链接上找到这两个表格:
https://www.dropbox.com/s/7u9g82zsw5eh55k/Tables.rar?dl=0
有没有办法解决这个问题并使 100% 值圆相等,而无需手动缩放图像?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{graphicx}
\pgfplotsset{compat=newest, legend cell align = left}
\usepgfplotslibrary{units}
\usepgfplotslibrary{polar}
\usetikzlibrary{hobby}
\newcommand{\addlegendentrySI}[3][]{%
\begingroup\edef\x{\endgroup
\noexpand\addlegendentry{
\sisetup{zero-decimal-to-integer}
$T_{m,\n}=\SI[#1]{#2}{#3}$}}\x
}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
legend style={at={(0,.5)}, anchor=east, draw=none},
transpose legend,
legend columns=5,
axis line style = {transparent},
grid=none,
ticks=none,
clip=false,
clip marker paths=true,
cycle list name=mark list*]
\pgfplotstableread{k_magma.txt}{\mytable}
\pgfplotstablegetrowsof{\mytable}
\pgfmathsetmacro{\rows}{\pgfplotsretval-1}
\foreach \i in {0,...,\rows}{%
\pgfplotstablegetelem{\i}{Vp}\of{\mytable}
\let\r\pgfplotsretval
\pgfplotstablegetelem{\i}{Angles}\of{\mytable}
\let\a\pgfplotsretval
\pgfplotstablegetelem{\i}{kmagma}\of{\mytable}
\let\p\pgfplotsretval
\pgfmathparse{int(\i+1)}
\let\n\pgfmathresult
\addplot+[color=blue, thick, solid, mark size=2] coordinates {(0,0)(\a,\r)};
\addlegendentrySI{\p}{\watt(\meter\kelvin)^{-1}}
}%
\addplot [hobby, dotted, no markers, color=blue, forget plot] table [x=Angles,y=Vp]{\mytable};
\addplot [blue, fill=blue, forget plot, domain=0:360, samples=360] {4};
\addplot [dotted, no markers, color=red, fill=red, fill opacity=0.1, samples=720, domain=0:360] {100};
\addlegendentry{$100\%V_b$}
\end{polaraxis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{polaraxis}[
legend style={at={(0,.5)}, anchor=east, draw=none},
transpose legend,
legend columns=5,
axis line style = {transparent},
grid=none,
ticks=none,
clip=false,
clip marker paths=true,
cycle list name=mark list*]
\pgfplotstableread{Cp_crust.txt}{\mytable}
\pgfplotstablegetrowsof{\mytable}
\pgfmathsetmacro{\rows}{\pgfplotsretval-1}
\foreach \i in {0,...,\rows}{%
\pgfplotstablegetelem{\i}{Vp}\of{\mytable}
\let\r\pgfplotsretval
\pgfplotstablegetelem{\i}{Angles}\of{\mytable}
\let\a\pgfplotsretval
\pgfplotstablegetelem{\i}{Cpcrust}\of{\mytable}
\let\p\pgfplotsretval
\pgfmathparse{int(\i+1)}
\let\n\pgfmathresult
\addplot+[color=blue, thick, solid, mark size=2] coordinates {(0,0)(\a,\r)};
\addlegendentrySI{\p}{\joule(\kilo\gram\kelvin)^{-1}}
}%
\addplot [hobby, dotted, no markers, color=blue, forget plot] table [x=Angles,y=Vp]{\mytable};
\addplot [blue, fill=blue, forget plot, domain=0:360, samples=360] {4};
\addplot [dotted, no markers, color=red, fill=red, fill opacity=0.1, samples=720, domain=0:360] {100};
\addlegendentry{$100\%V_b$}
\end{polaraxis}
\end{tikzpicture}
\end{document}