Skip to content

Right and top spine placement: set_position(('data', x)) puts the spine at x + 1 instead of x. #1960

Closed
@technobauble

Description

@technobauble

Python Version 2.7.4
matplotlib version: 1.1.1

Setting the location of the top and right spines to X is locating them at X +1. The left and bottom spines are placed as expected.

I posted this to the users list and it was verified by Goyo goyodiaz@gmail.com.

The following code demonstrates the error:

import matplotlib.pyplot as plt

f=plt.figure(1)
f.clf()
ax=plt.subplot(111)

# spine is located at x = -1.5
ax.spines['left'].set_position(('data', -1.5)) 

# spine should be located at y = 0.5 but is placed at y = 1.5
ax.spines['top'].set_position(('data',0.5)) 

# spine should be located at x = -0.5 but is placed at x = +0.5
ax.spines['right'].set_position(('data',-0.5))

# spine is placed at y = 0.
ax.spines['bottom'].set_position('zero')

ax.set_xlim([-2,2])
ax.set_ylim([-2,2])

plt.show()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions