删除散景中四边形字形之间的线条

Remove lines between quad glyphs in Bokeh

我正在尝试创建一个带有方块(而不是十六进制元素)的 2D 直方图,并且我正在使用四边形来这样做。

首先,我使用 numpy 创建了一个 2D 直方图(为简洁起见未显示)。

然后我使用四边形字形绘制它:

    def plotHist2D(self,name):
        """
        Creates a 2D histogram figure in Bokeh.

        Parameters
        ----------
        name : string
            The name of one of the column data sources in self.files.

        Returns
        -------
        A bokeh plot object.
        """
        cds = ColumnDataSource(self.makeHist2D(name))
        plot_cmap = linear_cmap('tops','Turbo256',0,1,)
        bar_cmap = LinearColorMapper(palette='Turbo256',low=0,high=1)
        p = figure(plot_height=350,plot_width=350,
                   title='kW/mm^2',                                                                                                     x_axis_label='x (m)',
                   y_axis_label='y (m)',
                   x_range=(-0.05,0.05),
                   y_range=(-0.05,0.05),
                   output_backend="webgl",
                   toolbar_location="above")
        p.quad(top='yrights',bottom='ylefts',left='xlefts',right='xrights',
               fill_color=plot_cmap,line_color=plot_cmap,
               line_width=0.1,line_alpha=1.0,
               alpha=1.0,source=cds)
        color_bar = ColorBar(color_mapper=bar_cmap,width=8,
                             border_line_color=None,location=(0,0))
        p.add_layout(color_bar,'right')
        return p

这个功能,因为它创建了一个图形,但是图形在四边形元素之间的边界处有令人不快的线条。

我找不到可以删除这些行的参数 line_width、line_color 和 line_alpha 的任何设置组合。是否有任何设置组合可以完全消除这些线条?

如果不是,我应该如何创建这个带有方块的 2D 直方图?

这样做的诀窍是使用具有相同颜色映射器的 line_color 而不是将 line_width 设置得太小。

以下对 quad 的调用有效。

p.quad(top='yrights',bottom='ylefts',left='xlefts',right='xrights',
               fill_color=plot_cmap,
               line_color=plot_cmap,
               line_width=1.0,line_alpha=1.0,
               alpha=1.0,source=cds)

想要的剧情:

我以为在问这个问题之前我已经尝试了所有排列。我不确定为什么较小的 line_width 会使线条更明显。正如@EugenePakhomov 建议的那样,您也可以完全省略 line_width 。大概这是因为默认设置足够大,不会导致“啮合”。