Esempio n. 1
0
def test_clipped_to_axes():
    # Ensure that _fully_clipped_to_axes() returns True under default
    # conditions for all projection types. Axes.get_tightbbox()
    # uses this to skip artists in layout calculations.
    arr = np.arange(100).reshape((10, 10))
    fig = plt.figure(figsize=(6, 2))
    ax1 = fig.add_subplot(131, projection='rectilinear')
    ax2 = fig.add_subplot(132, projection='mollweide')
    ax3 = fig.add_subplot(133, projection='polar')
    for ax in (ax1, ax2, ax3):
        # Default conditions (clipped by ax.bbox or ax.patch)
        ax.grid(False)
        h, = ax.plot(arr[:, 0])
        m = ax.pcolor(arr)
        assert h._fully_clipped_to_axes()
        assert m._fully_clipped_to_axes()
        # Non-default conditions (not clipped by ax.patch)
        rect = Rectangle((0, 0), 0.5, 0.5, transform=ax.transAxes)
        h.set_clip_path(rect)
        m.set_clip_path(rect.get_path(), rect.get_transform())
        assert not h._fully_clipped_to_axes()
        assert not m._fully_clipped_to_axes()
Esempio n. 2
0
#   Camera lens rays
ax.add_patch(Polygon(np.array([[24,-9],[33,-47.5],[80,-47.5],[25,-7.2]]),closed=True,ls='dashed',fc='#CCE6FF'))
ax.add_patch(Polygon(np.array([[73.9481,-7.45807],[20,-47.5],[67,-47.5],[76.1553,-9.29489]]),closed=True,ls='dashed',fc='#CCE6FF'))
ax.add_patch(Polygon(np.array([[24,-9],[33,-47.5],[80,-47.5],[25,-7.2]]),closed=True,ls='dashed',fc='none', ec='black'))
ax.add_patch(Polygon(np.array([[73.9481,-7.45807],[20,-47.5],[67,-47.5],[76.1553,-9.29489]]),closed=True,ls='dashed',fc='none', ec='black'))


#   Cameras
c1 = Rectangle((20, -10.0), 10, 20, angle=40.0, fc='k')
c2 = Rectangle((80, -10.0), 20, 10, angle=50.0, fc='k')
c1l = Rectangle((23, -10.0), 5, 2, angle=40.0, fc='k')
c2l = Rectangle((77, -10), 2, 5, angle=50.0, fc='k')

a = Rectangle.get_patch_transform(c1)
print Rectangle.get_path(c1)
ax.add_patch(c1)
ax.add_patch(c1l)

ax.add_patch(c2)
ax.add_patch(c2l)




#   Supports
ax.add_patch(Rectangle((20, -50.), 15, 2.5, fc='White', ec='Black'))#, hatch='\\'))
ax.add_patch(Rectangle((65, -50.), 15, 2.5, fc='White', ec='Black'))#, hatch='\\'))
#   bottom left
ax.add_patch(Rectangle((20, -55), 26.5, 5, fc='White', ec='Black'))#, hatch='/'))
#   bottom mid