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

BUG: manual clabel positioning broke between 1.2 and 1.3 #2475

Closed
efiring opened this issue Sep 29, 2013 · 6 comments
Closed

BUG: manual clabel positioning broke between 1.2 and 1.3 #2475

efiring opened this issue Sep 29, 2013 · 6 comments
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone

Comments

@efiring
Copy link
Member

efiring commented Sep 29, 2013

The bug is reported to the matplotlib-users list by Felix Patzelt on Sept. 28:
http://matplotlib.1069221.n5.nabble.com/Broken-clabel-manual-True-in-1-3-0-td42124.html.

Below is a slightly edited version of the script he provided to make it easy to reproduce the problem. I have verified that the error occurs in master.

import numpy as np
from matplotlib import mlab
import pylab as plt

# Broken manual labelling demo
# Adapted from pylab_examples example code: contour_demo.py
delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)

plt.figure()
CS = plt.contour(X, Y, Z)
plt.clabel(CS, inline=1, fontsize=10, manual=True)
plt.title('Position labels manually')
plt.show()
@mdboom
Copy link
Member

mdboom commented Sep 30, 2013

Strange -- I can't reproduce with 1.3.x or master, with either the above script or the one produced in the linked mailing list post.

Does this happen only with certain figure sizes? Is this on a non-Agg backend?

@mdboom
Copy link
Member

mdboom commented Sep 30, 2013

For the record, I've tried both Linux (GtkAgg) and Mac (MacOSX backend), and still no sign of the artifacts in the mailing list post.

@efiring
Copy link
Member Author

efiring commented Sep 30, 2013

@mdboom, I have verified the problem on the mac with the macosx, qt4agg and tkagg backends and on a linux virtual machine with the qt4agg and gtkagg backends. I haven't tried any others. On both systems I did a clean build (following git clean -dfx) and on the linux system I also deleted all mpl things from the installation destination.
The builds are from commit 518afd8.

To reproduce the problem, I run the test script as a standalone script, and start clicking on contours. For each click, an incorrectly rotated number is shown, with a line running off to the upper right.

@mdboom
Copy link
Member

mdboom commented Oct 1, 2013

Ah -- the clicking on contours part is what I was missing. I am now able to reproduce.

@miili
Copy link

miili commented Feb 13, 2014

I reproduce this problem on Linux w matplotlib 1.3.0

bwkeller added a commit to bwkeller/matplotlib that referenced this issue Feb 13, 2014
… manually

produce ugly spikes in the contours.  The problem was that screen
coordinates were being passed as data coordinates when the contour was
split to add room for the label.
tacaswell pushed a commit to tacaswell/matplotlib that referenced this issue Feb 21, 2014
… manually

produce ugly spikes in the contours.  The problem was that screen
coordinates were being passed as data coordinates when the contour was
split to add room for the label.

Incorporate my fix and miili's matplotlib#2806 change
@tacaswell
Copy link
Member

I have been trying to track this down and It looks like the problems originated in #1865.

I am not sure of the solution proposed in #2809 / #2818 because it makes that part of the code ignore the value of transform, but I don't fully understand find_nearest_contour.

@tacaswell tacaswell modified the milestones: v1.4.0, v1.3.x blocker Apr 17, 2014
efiring added a commit that referenced this issue Jul 10, 2014
BUGFIX:  This change fixes #2475, where contour labels added manually
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

No branches or pull requests

4 participants