Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

hatch_demo.py does not correctly save all the hatches in pdf #12367

Open
@ftesser

Description

@ftesser

Bug report

Bug summary

Code for reproduction
The same code available in

https://matplotlib.org/2.0.2/examples/pylab_examples/hatch_demo.html

with just two addition:matplotlib.use('Agg') andplt.savefig in different formats.

# Paste your code here"""Hatching (pattern filled polygons) is supported currently in the PS,PDF, SVG and Agg backends only."""importmatplotlibmatplotlib.use('Agg')#the same happen also without this line backend TkAggimportmatplotlib.pyplotaspltfrommatplotlib.patchesimportEllipse,Polygonfig=plt.figure()ax1=fig.add_subplot(131)ax1.bar(range(1,5),range(1,5),color='red',edgecolor='black',hatch="/")ax1.bar(range(1,5), [6]*4,bottom=range(1,5),color='blue',edgecolor='black',hatch='//')ax1.set_xticks([1.5,2.5,3.5,4.5])ax2=fig.add_subplot(132)bars=ax2.bar(range(1,5),range(1,5),color='yellow',ecolor='black')+ \ax2.bar(range(1,5), [6]*4,bottom=range(1,5),color='green',ecolor='black')ax2.set_xticks([1.5,2.5,3.5,4.5])patterns= ('-','+','x','\\','*','o','O','.')forbar,patterninzip(bars,patterns):bar.set_hatch(pattern)ax3=fig.add_subplot(133)ax3.fill([1,3,3,1], [1,1,2,2],fill=False,hatch='\\')ax3.add_patch(Ellipse((4,1.5),4,0.5,fill=False,hatch='*'))ax3.add_patch(Polygon([[0,0], [4,1.1], [6,2.5], [2,1.4]],closed=True,fill=False,hatch='/'))ax3.set_xlim((0,6))ax3.set_ylim((0,2.5))#plt.show()plt.savefig('hatch_demo.pdf')plt.savefig('hatch_demo.png')plt.savefig('hatch_demo.eps')print(matplotlib.__version__)print(matplotlib.get_backend())

Actual outcome

The pdf saved image does not show all the hatch.

hatch_demo.pdf

Instead, the png and the eps ones show all the hatch correctly.

Expected outcome

The same shown in

https://matplotlib.org/2.0.2/mpl_examples/pylab_examples/hatch_demo.pdf

Matplotlib version

  • Operating system: Ubuntu 18.04 x86_64
  • Matplotlib version: v3.0.0 (but the same happen also whit v2.1.1)
  • Matplotlib backend (print(matplotlib.get_backend())):Agg (but the same happen also whitTkAgg)
  • Python version: Python 3.6.6
  • Jupyter version (if applicable):
  • Other libraries:

Matplotlib installed with pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp