Skip to content

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

@dguest

Description

@dguest

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy