Skip to content
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

imshow bug on GTKCairo and GTK3Cairo #4154

Closed
OceanWolf opened this issue Feb 25, 2015 · 11 comments
Closed

imshow bug on GTKCairo and GTK3Cairo #4154

OceanWolf opened this issue Feb 25, 2015 · 11 comments
Assignees
Milestone

Comments

@OceanWolf
Copy link
Contributor

On master, the following code fails (works fine on master with GTK3Agg and with GTK3Cairo on 1.3.1 (debian))

import matplotlib
matplotlib.use('GTK3Cairo')
import matplotlib.pyplot as plt
import numpy as np

data = np.linspace(0, 10, 80).reshape(10, 8)

plt.imshow(data)
plt.show()
File "matplotlib/lib/matplotlib/backends/backend_cairo.py", line 169, in in draw_image
    buf, cairo.FORMAT_ARGB32, cols, rows, cols*4)
TypeError: Cannot use string as modifiable buffer
@tacaswell
Copy link
Member

python 2 or 3? My guess is that this is related to the str -> (byte, unicode) conversion + conversion using six.

@OceanWolf
Copy link
Contributor Author

python2.7, using python-cairo version 1.8.8 on both mpl-1.3.1 and master.

@OceanWolf
Copy link
Contributor Author

Ooh, debian has just upped, to mpl-1.4.2 on debian-testing...

Just tested on 1.4.2 (which uses six) and I don't see the problem, but the upgrade has also upgraded a few other things as well, and borked my access to my testing directory of python, so I shall try and fix that tomorrow and test again and come back with some news.

@OceanWolf
Copy link
Contributor Author

Okay, tested it again and I still see it on master, fine using 1.4.2, bad on master, both using python 1.7.8 and python-cairo version 1.8.8.

@OceanWolf
Copy link
Contributor Author

Okay, some poking in the code:

mpl_version print(type(buf))
1.4.2 <type 'buffer'>
master <type 'str'>

I will try and follow the code back further, to see why this happens.

@OceanWolf
Copy link
Contributor Author

Okay, my skills run dead as this looks like a bug in the c to python code _image. I have no idea about that layer of code.

@tacaswell
Copy link
Member

This is probably related to the major cxx removal refactor then attn @mdboom

@tacaswell tacaswell added this to the next point release milestone Feb 25, 2015
@mdboom mdboom self-assigned this Feb 25, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Feb 25, 2015
@mdboom
Copy link
Member

mdboom commented Feb 25, 2015

Try #4163.

mdboom added a commit to mdboom/matplotlib that referenced this issue Feb 25, 2015
@OceanWolf
Copy link
Contributor Author

I can't seem to pull this, I have weak git-foo...

git fetch upstream pull/4154/head:pr4154
fatal: Couldn't find remote ref pull/4154/head

@mdboom
Copy link
Member

mdboom commented Feb 25, 2015

Use 4163. 4154 is just an issue (with no code attached).

@tacaswell
Copy link
Member

Closed by 2a028c0

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