检索选项的线宽ultra thick

检索选项的线宽ultra thick

我现在有的是:

\documentclass{article}

\usepackage{pgfplots}
\usepackage{pgfplotstable}

\begin{document}



\pgfplotstableread{
     A B C
     0 5 -1
     0.5 2 0
     1 7 1
     1.5 11 1.5
}\mytable %


\begin{tikzpicture}
\begin{axis}[
    colorbar
]

\addplot[scatter, only marks, scatter src=explicit, mark=*,scatter/@pre marker code/.append style=
                {/tikz/mark size={1+\pgfplotspointmetatransformed/650}}]
    table[meta expr=abs(\thisrow{C})] {\mytable};
\end{axis}
\end{tikzpicture}


\end{document}

我想要实现的目标:

  • 去除填充周围的黑圈。

  • 使第二个点(带有 的点meta value0的直径等于带有选项的线ultra thick

答案1

可以使用选项scatter/use mapped color将标记的绘制颜色更改为与填充颜色相同。(该值none不起作用。)

的线宽ultra thick为1.6 pt,默认绘制线宽为0.4 pt,标记的尺寸(半径)值应设置为 (1.6 pt - 2 * 0.4 pt/2)/2 = 0.6 pt。

\documentclass{article}

\usepackage{pgfplots}
\usepackage{pgfplotstable}

\begin{document}

\pgfplotstableread{
     A B C
     0 5 -1
     0.5 2 0
     1 7 1  
     1.5 11 1.5
}\mytable

\begin{tikzpicture}
\begin{axis}[
    colorbar 
]

\addplot[
  scatter,
  only marks,
  scatter src=explicit,
  mark=*,
  scatter/use mapped color={
    draw=mapped color,
    fill=mapped color,
  },
  scatter/@pre marker code/.append style=
                {/tikz/mark size={.6pt+\pgfplotspointmetatransformed/650}}]
    table[meta expr=abs(\thisrow{C})] {\mytable};
\end{axis}
\end{tikzpicture}
\end{document}

结果

通过使用新的标记类型,可以完全删除标记的绘制:

\documentclass{article}

\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}

\pgfdeclareplotmark{filled circle}{%
  \pgfpathellipse
    {\pgfpointorigin}%
    {\pgfqpoint{\pgfplotmarksize}{0sp}}%
    {\pgfqpoint{0sp}{\pgfplotmarksize}}%
  \pgfusepathqfill% mark=* uses \pgfusepathqfillstroke instead
}

\begin{document}

\pgfplotstableread{
     A B C
     0 5 -1
     0.5 2 0
     1 7 1
     1.5 11 1.5
}\mytable

\begin{tikzpicture}
\begin{axis}[
    colorbar
]

\addplot[
  scatter,
  only marks,
  scatter src=explicit,
  mark=filled circle,
  mark options={draw=none},
  scatter/@pre marker code/.append style={%
    /tikz/mark size={.8pt+\pgfplotspointmetatransformed/650},
  },
]
  table[meta expr=abs(\thisrow{C})] {\mytable};
\end{axis}
\end{tikzpicture}
\end{document}

检索选项的线宽ultra thick

Optionultra thick是 的快捷方式line width=1.6pt,用于设置 dimen 寄存器\pgflinewidth。这可用于以编程方式获取值:

\path[ultra thick] \pgfextra{\xdef\LineWidthUltraThick{\the\pgflinewidth}};

或者

\begin{scope}[ultra thick]
  \xdef\LineWidthUltraThick{\the\pgflinewidth}
\end{scope}

相关内容