小编Elb*_*t85的帖子

直方图中的Matplotlib 2.0条纹

当使用matplotlib 2.0.2,python2.7,Win7,64bit创建直方图时,我在bin之间得到垂直条纹,在pdf和png中都可见.我使用latex来创建PDF,我将在pdflatex文档中使用includegraphics.创建的PNG只是一个快速检查.

在Matplotlib 1.5.3中并非如此.如何摆脱分隔各个箱子的这些白线?

事情尝试:

  • 打开/关闭抗锯齿(在hist命令中aa = True/False)
  • 在hist命令中绘制一条线(ls =" - "/ ls ="none")
  • 有一点可以做的就是为箱子提供宽度(宽度= 2.3),但这对于所有缩放值的PDF也不起作用.

用于生成图像的代码

import matplotlib as mpl
mpl.use('pgf')
pgf_with_latex = {                      # setup matplotlib to use latex for output
    "pgf.texsystem": "pdflatex",        # change this if using xetex or lautex
    "text.usetex": True,                # use LaTeX to write all text
    "font.family": "serif",
    "font.serif": [],                   # blank entries should cause plots to inherit fonts from the document
    "font.sans-serif": [],
    "font.monospace": [],
    "axes.labelsize": 10,               # LaTeX default is 10pt …
Run Code Online (Sandbox Code Playgroud)

python matplotlib pgf python-2.7

6
推荐指数
1
解决办法
366
查看次数

标签 统计

matplotlib ×1

pgf ×1

python ×1

python-2.7 ×1