Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes issue #1960. Account for right/top spine data offset on transform ... #1964

Merged
merged 3 commits into from

3 participants

@cimarronm
Collaborator

...when doing spine.set_position(). Also includes a testcase for the data locations.

@cimarronm cimarronm Fixes issue #1960. Account for right/top spine data offset on transfo…
…rm when doing spine.set_position(). Also includes a testcase for the data locations.
247689d
lib/matplotlib/spines.py
@@ -323,6 +323,8 @@ def _calc_offset_transform(self):
self._spine_transform = ('identity',
mtransforms.IdentityTransform())
elif position_type == 'data':
+ if self.spine_type in ('right', 'top'):
+ amount -= 1 # translate left by one to account for right/top data offset of one
@pelson Collaborator
pelson added a note

Sorry, the comment doesn't enlighten me. Do you know the root cause of this workaround? Is this one pixel? Are you certain that this isn't a snapping issue?

Apologies for the (possibly silly) questions - I would like to understand the underlying need for this change.

@mdboom Owner
mdboom added a note

It's not one pixel -- it's in axes units which are (0, 1) across the entire axis. Maybe a better comment would be:

The right and top spines have a default position of 1 in axes coordinates.  When specifying the position in data coordinates, we need to calculate the position relative to 0.
@cimarronm Collaborator

That is correct. I updated the code with Michael's suggested comment. Thanks @mdboom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson pelson commented on the diff
lib/matplotlib/spines.py
@@ -323,6 +323,11 @@ def _calc_offset_transform(self):
self._spine_transform = ('identity',
mtransforms.IdentityTransform())
elif position_type == 'data':
+ if self.spine_type in ('right', 'top'):
+ # The right and top spines have a default position of 1 in
+ # axes coordinates. When specifying the position in data
+ # coordinates, we need to calculate the position relative to 0.
+ amount -= 1
@pelson Collaborator
pelson added a note

Thanks @cimarronm - this is much clearer now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson
Collaborator

Just needs an doc/api/api_changes.rst entry since this will change some functionality (for the better - by fixing a bug) and I think it is good to go.

Nice work @cimarronm.

:+1:

@cimarronm
Collaborator

How about:

* Fixed a bug in setting the position for the right/top spine with data 
  position type. Previously, it would draw the right or top spine at
  +1 data offset.

Let me know if that is good or want to improve the wording for doc/api/api_changes.rst

@pelson
Collaborator

Let me know if that is good or want to improve the wording for

That sounds good to me. The api_changes.rst document is there for those who are finding problems when upgrading versions, so something short and to the point is exactly what is needed. Thanks @cimarronm

@cimarronm
Collaborator

Is this good to merge?

@mdboom mdboom merged commit af07100 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 30, 2013
  1. @cimarronm

    Fixes issue #1960. Account for right/top spine data offset on transfo…

    cimarronm authored
    …rm when doing spine.set_position(). Also includes a testcase for the data locations.
Commits on May 1, 2013
  1. @cimarronm
Commits on May 2, 2013
  1. @cimarronm
This page is out of date. Refresh to see the latest.
View
4 doc/api/api_changes.rst
@@ -15,6 +15,10 @@ For new features that were added to matplotlib, please see
Changes in 1.3.x
================
+* Fixed a bug in setting the position for the right/top spine with data
+ position type. Previously, it would draw the right or top spine at
+ +1 data offset.
+
* In :class:`~matplotlib.patches.FancyArrow`, the default arrow head width,
``head_width``, has been made larger to produce a visible arrow head. The new
value of this kwarg is ``head_width = 20 * width``.
View
5 lib/matplotlib/spines.py
@@ -323,6 +323,11 @@ def _calc_offset_transform(self):
self._spine_transform = ('identity',
mtransforms.IdentityTransform())
elif position_type == 'data':
+ if self.spine_type in ('right', 'top'):
+ # The right and top spines have a default position of 1 in
+ # axes coordinates. When specifying the position in data
+ # coordinates, we need to calculate the position relative to 0.
+ amount -= 1
@pelson Collaborator
pelson added a note

Thanks @cimarronm - this is much clearer now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
if self.spine_type in ('left', 'right'):
self._spine_transform = ('data',
mtransforms.Affine2D().translate(
View
BIN  lib/matplotlib/tests/baseline_images/test_spines/spines_data_positions.pdf
Binary file not shown
View
BIN  lib/matplotlib/tests/baseline_images/test_spines/spines_data_positions.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
544 lib/matplotlib/tests/baseline_images/test_spines/spines_data_positions.svg
@@ -0,0 +1,544 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Created with matplotlib (http://matplotlib.org/) -->
+<svg height="432pt" version="1.1" viewBox="0 0 576 432" width="576pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <style type="text/css">
+*{stroke-linecap:square;stroke-linejoin:round;}
+ </style>
+ </defs>
+ <g id="figure_1">
+ <g id="patch_1">
+ <path d="
+M0 432
+L576 432
+L576 0
+L0 0
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="axes_1">
+ <g id="patch_2">
+ <path d="
+M72 388.8
+L518.4 388.8
+L518.4 43.2
+L72 43.2
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="matplotlib.axis_1">
+ <g id="xtick_1">
+ <g id="line2d_1">
+ <defs>
+ <path d="
+M0 0
+L0 -4" id="m0012dd4eef" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_2">
+ <defs>
+ <path d="
+M0 0
+L0 4" id="m476344969c" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_1">
+ <!-- −2.0 -->
+ <defs>
+ <path d="
+M10.5938 35.5
+L73.1875 35.5
+L73.1875 27.2031
+L10.5938 27.2031
+z
+" id="BitstreamVeraSans-Roman-2212"/>
+ <path d="
+M19.1875 8.29688
+L53.6094 8.29688
+L53.6094 0
+L7.32812 0
+L7.32812 8.29688
+Q12.9375 14.1094 22.625 23.8906
+Q32.3281 33.6875 34.8125 36.5312
+Q39.5469 41.8438 41.4219 45.5312
+Q43.3125 49.2188 43.3125 52.7812
+Q43.3125 58.5938 39.2344 62.25
+Q35.1562 65.9219 28.6094 65.9219
+Q23.9688 65.9219 18.8125 64.3125
+Q13.6719 62.7031 7.8125 59.4219
+L7.8125 69.3906
+Q13.7656 71.7812 18.9375 73
+Q24.125 74.2188 28.4219 74.2188
+Q39.75 74.2188 46.4844 68.5469
+Q53.2188 62.8906 53.2188 53.4219
+Q53.2188 48.9219 51.5312 44.8906
+Q49.8594 40.875 45.4062 35.4062
+Q44.1875 33.9844 37.6406 27.2188
+Q31.1094 20.4531 19.1875 8.29688" id="BitstreamVeraSans-Roman-32"/>
+ <path d="
+M31.7812 66.4062
+Q24.1719 66.4062 20.3281 58.9062
+Q16.5 51.4219 16.5 36.375
+Q16.5 21.3906 20.3281 13.8906
+Q24.1719 6.39062 31.7812 6.39062
+Q39.4531 6.39062 43.2812 13.8906
+Q47.125 21.3906 47.125 36.375
+Q47.125 51.4219 43.2812 58.9062
+Q39.4531 66.4062 31.7812 66.4062
+M31.7812 74.2188
+Q44.0469 74.2188 50.5156 64.5156
+Q56.9844 54.8281 56.9844 36.375
+Q56.9844 17.9688 50.5156 8.26562
+Q44.0469 -1.42188 31.7812 -1.42188
+Q19.5312 -1.42188 13.0625 8.26562
+Q6.59375 17.9688 6.59375 36.375
+Q6.59375 54.8281 13.0625 64.5156
+Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
+ <path d="
+M10.6875 12.4062
+L21 12.4062
+L21 0
+L10.6875 0
+z
+" id="BitstreamVeraSans-Roman-2e"/>
+ </defs>
+ <g transform="translate(58.464375 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-32"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_2">
+ <g id="line2d_3">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_4">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_2">
+ <!-- −1.5 -->
+ <defs>
+ <path d="
+M12.4062 8.29688
+L28.5156 8.29688
+L28.5156 63.9219
+L10.9844 60.4062
+L10.9844 69.3906
+L28.4219 72.9062
+L38.2812 72.9062
+L38.2812 8.29688
+L54.3906 8.29688
+L54.3906 0
+L12.4062 0
+z
+" id="BitstreamVeraSans-Roman-31"/>
+ <path d="
+M10.7969 72.9062
+L49.5156 72.9062
+L49.5156 64.5938
+L19.8281 64.5938
+L19.8281 46.7344
+Q21.9688 47.4688 24.1094 47.8281
+Q26.2656 48.1875 28.4219 48.1875
+Q40.625 48.1875 47.75 41.5
+Q54.8906 34.8125 54.8906 23.3906
+Q54.8906 11.625 47.5625 5.09375
+Q40.2344 -1.42188 26.9062 -1.42188
+Q22.3125 -1.42188 17.5469 -0.640625
+Q12.7969 0.140625 7.71875 1.70312
+L7.71875 11.625
+Q12.1094 9.23438 16.7969 8.0625
+Q21.4844 6.89062 26.7031 6.89062
+Q35.1562 6.89062 40.0781 11.3281
+Q45.0156 15.7656 45.0156 23.3906
+Q45.0156 31 40.0781 35.4375
+Q35.1562 39.8906 26.7031 39.8906
+Q22.75 39.8906 18.8125 39.0156
+Q14.8906 38.1406 10.7969 36.2812
+z
+" id="BitstreamVeraSans-Roman-35"/>
+ </defs>
+ <g transform="translate(114.39 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_3">
+ <g id="line2d_5">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="183.6" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_6">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="183.6" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_3">
+ <!-- −1.0 -->
+ <g transform="translate(170.064375 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_4">
+ <g id="line2d_7">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_8">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_4">
+ <!-- −0.5 -->
+ <g transform="translate(225.99 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_5">
+ <g id="line2d_9">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="295.2" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_10">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="295.2" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_5">
+ <!-- 0.0 -->
+ <g transform="translate(286.4521875 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-30"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_6">
+ <g id="line2d_11">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="351.0" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_12">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="351.0" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_6">
+ <!-- 0.5 -->
+ <g transform="translate(342.3778125 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-30"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_7">
+ <g id="line2d_13">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="406.8" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_14">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="406.8" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_7">
+ <!-- 1.0 -->
+ <g transform="translate(398.315625 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_8">
+ <g id="line2d_15">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="462.6" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_16">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="462.6" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_8">
+ <!-- 1.5 -->
+ <g transform="translate(454.24125 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_9">
+ <g id="line2d_17">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0012dd4eef" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_18">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m476344969c" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_9">
+ <!-- 2.0 -->
+ <g transform="translate(509.69625 229.118125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-32"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ <g id="matplotlib.axis_2">
+ <g id="ytick_1">
+ <g id="line2d_19">
+ <defs>
+ <path d="
+M0 0
+L4 0" id="me8a85f7bf6" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_20">
+ <defs>
+ <path d="
+M0 0
+L-4 0" id="m1a32005dea" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="388.8"/>
+ </g>
+ </g>
+ <g id="text_10">
+ <!-- −2.0 -->
+ <g transform="translate(96.72875 392.11125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-32"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_2">
+ <g id="line2d_21">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="345.6"/>
+ </g>
+ </g>
+ <g id="line2d_22">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="345.6"/>
+ </g>
+ </g>
+ <g id="text_11">
+ <!-- −1.5 -->
+ <g transform="translate(96.98 348.91125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_3">
+ <g id="line2d_23">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="302.4"/>
+ </g>
+ </g>
+ <g id="line2d_24">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="302.4"/>
+ </g>
+ </g>
+ <g id="text_12">
+ <!-- −1.0 -->
+ <g transform="translate(96.72875 305.71125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_4">
+ <g id="line2d_25">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="259.2"/>
+ </g>
+ </g>
+ <g id="line2d_26">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="259.2"/>
+ </g>
+ </g>
+ <g id="text_13">
+ <!-- −0.5 -->
+ <g transform="translate(96.98 262.51125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-2212"/>
+ <use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ <use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="179.19921875" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_5">
+ <g id="line2d_27">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_28">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="216.0"/>
+ </g>
+ </g>
+ <g id="text_14">
+ <!-- 0.0 -->
+ <g transform="translate(106.304375 219.31125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-30"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_6">
+ <g id="line2d_29">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="172.8"/>
+ </g>
+ </g>
+ <g id="line2d_30">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="172.8"/>
+ </g>
+ </g>
+ <g id="text_15">
+ <!-- 0.5 -->
+ <g transform="translate(106.555625 176.11125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-30"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_7">
+ <g id="line2d_31">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="129.6"/>
+ </g>
+ </g>
+ <g id="line2d_32">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="129.6"/>
+ </g>
+ </g>
+ <g id="text_16">
+ <!-- 1.0 -->
+ <g transform="translate(106.83125 132.91125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_8">
+ <g id="line2d_33">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="86.4"/>
+ </g>
+ </g>
+ <g id="line2d_34">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="86.4"/>
+ </g>
+ </g>
+ <g id="text_17">
+ <!-- 1.5 -->
+ <g transform="translate(107.0825 89.71125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-31"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-35"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_9">
+ <g id="line2d_35">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#me8a85f7bf6" y="43.2"/>
+ </g>
+ </g>
+ <g id="line2d_36">
+ <g>
+ <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#m1a32005dea" y="43.2"/>
+ </g>
+ </g>
+ <g id="text_18">
+ <!-- 2.0 -->
+ <g transform="translate(106.3925 46.51125)scale(0.12 -0.12)">
+ <use xlink:href="#BitstreamVeraSans-Roman-32"/>
+ <use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-2e"/>
+ <use x="95.41015625" xlink:href="#BitstreamVeraSans-Roman-30"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ <g id="patch_3">
+ <path d="
+M72 216
+L518.4 216" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_4">
+ <path d="
+M239.4 388.8
+L239.4 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_5">
+ <path d="
+M72 172.8
+L518.4 172.8" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_6">
+ <path d="
+M127.8 388.8
+L127.8 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ </g>
+ </g>
+</svg>
View
11 lib/matplotlib/tests/test_spines.py
@@ -19,3 +19,14 @@ def test_spines_axes_positions():
ax.xaxis.set_ticks_position('top')
ax.spines['left'].set_color('none')
ax.spines['bottom'].set_color('none')
+
+@image_comparison(baseline_images=['spines_data_positions'])
+def test_spines_data_positions():
+ fig = plt.figure()
+ ax = fig.add_subplot(1,1,1)
+ ax.spines['left'].set_position(('data', -1.5))
+ ax.spines['top'].set_position(('data', 0.5))
+ ax.spines['right'].set_position(('data', -0.5))
+ ax.spines['bottom'].set_position('zero')
+ ax.set_xlim([-2,2])
+ ax.set_ylim([-2,2])
Something went wrong with that request. Please try again.