Skip to content

Hatches filling an empty color contour not saved in pdf  #8431

@andres0l1

Description

@andres0l1

I am trying to create a contour plot with the contours filled with hatches and no color. The following example works if I save it to .png but when I save it to .pdf the output is just the axis.
github

import numpy as np
import matplotlib.pyplot as plt



delta = 0.025

x = y = np.arange(-3.0, 3.01, delta)


X, Y = np.meshgrid(x, y)
Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10 * (Z1 - Z2)


levels=[0,1]
plt.contourf(X, Y, Z/X, 
                  levels,
                  #alpha=0.5,
                  colors='none', label='AGH',
                   hatches=['\\'])

plt.tight_layout()   

plt.savefig('GitHub.pdf')
plt.show()

I am using Matplotlib2.00 in Linux, installed from source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions