Thanks to visit codestin.com
Credit goes to github.com

Skip to content

plt.imshow: clip_on=False has no effect #15546

Closed
@Tal-Golan

Description

@Tal-Golan

Bug report

Bug summary

Images plotted by plt.imshow are always clipped, reglardless of the clip_on argument.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.cbook import get_sample_data

fig = plt.figure(figsize=(10,5))
ax = plt.subplot(111)
plt.subplots_adjust(left=0.25, bottom=0.1, right=0.75, top=0.9, wspace=0, hspace=0)

# plot a line. When clip_on is set to False, the line is extended beyond the axes
ax.plot(np.linspace(0,2),np.sin(np.linspace(0,2)),clip_on=False)
plt.xlim([0,1])
plt.ylim([0,1])

# plot a bitmap. Although clip_on is set to False, it is clipped by the axes
logo = plt.imread(get_sample_data("logo2.png", asfileobj=False))
left,right, bottom, top=0.25,0.25+1.12,0.25,0.25+0.24
ax.imshow(X=logo,extent=(left, right, bottom, top),clip_on=False)

Actual outcome

image

Expected outcome
The matplotlib logo shouldn't be clipped by the axes, since clip_on was set to False.

Matplotlib version

  • Operating system: Ubuntu 18.04
  • Matplotlib version: : 3.1.1 (pip installation)
  • Matplotlib backend: Qt5Agg
  • Python version: 3.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions