Skip to content

Workaround needed to make example in Transformations Tutorial work with log axis #3809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dguest opened this issue Nov 16, 2014 · 1 comment

Comments

@dguest
Copy link

dguest commented Nov 16, 2014

I found some rather weird behavior (maybe a bug) when trying to use axes.transData.transform((1,1)) with a log axis. The basic code to reproduce the error is below

#!/usr/bin/env python3
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import numpy as np

fig = Figure(figsize=(8,6))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(1,1,1)
ax.set_yscale('log')          # <--- works fine without this line
ax.transData.transform((1,1)) # <--- exception thrown here

The odd thing is that it seems to work fine if I give transform a 1x2 shaped array, i.e.

ax.transData.transform(np.array((1,1)).reshape(1,-1))

Unfortunately, this means the examples in the transformations tutorial don't work with a log axis.

@tacaswell tacaswell added this to the v1.4.3 milestone Nov 17, 2014
@tacaswell
Copy link
Member

I suspect that this is a bug in the tutorial. From looking at gitblame, my guess is that this is related to 8bbe2e5 and pr #731 .

attn @pelson

@pelson pelson self-assigned this Nov 17, 2014
maxalbert added a commit to maxalbert/matplotlib that referenced this issue Nov 29, 2014
maxalbert pushed a commit to maxalbert/matplotlib that referenced this issue Nov 29, 2014
@pelson pelson closed this as completed in 543a222 Dec 9, 2014
pelson added a commit that referenced this issue Jan 13, 2015
Fix log transforms (fixes #3809).
Conflicts:
	lib/matplotlib/tests/test_transforms.py

cherry-pick diff picked up too many tests in test_transforms.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants