Closed pepijndevos closed 13 years ago
Great features both!
But I don't know why I get very strange errors when I click a line in the graph with the toggle feature. It happens when the function calls fig.canvas.draw()
, and the traceback is:
Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__ return self.func(*args) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 261, in button_press_event FigureCanvasBase.button_press_event(self, x, y, num, guiEvent=event) File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1196, in button_press_event self.callbacks.process(s, mouseevent) File "/usr/lib/pymodules/python2.6/matplotlib/cbook.py", line 163, in process func(*args, **kwargs) File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1101, in pick self.figure.pick(mouseevent) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 314, in pick a.pick(mouseevent) File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 2631, in pick martist.Artist.pick(self,args[0]) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 314, in pick a.pick(mouseevent) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 307, in pick self.figure.canvas.pick_event(mouseevent, self, **prop) File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1162, in pick_event self.callbacks.process(s, event) File "/usr/lib/pymodules/python2.6/matplotlib/cbook.py", line 163, in process func(*args, **kwargs) File "./mian.py", line 204, in on_pick fig.canvas.draw() File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 215, in draw FigureCanvasAgg.draw(self) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py", line 314, in draw self.figure.draw(self.renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 773, in draw for a in self.axes: a.draw(renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1735, in draw a.draw(renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 539, in draw drawFunc(renderer, gc, tpath, affine.frozen()) File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 876, in _draw_lines self._lineFunc(renderer, gc, path, trans) File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 920, in _draw_solid renderer.draw_path(gc, path, trans) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py", line 98, in draw_path self._renderer.draw_path(gc, path, transform, rgbFace) TypeError: float() argument must be a string or a number
Tkinter bug? no idea... but when this traceback happens the graph, sometimes, don't let you zoom/pan or use other features, other times the line doesn't toggle. Also, for me, the line never toggles back to solid line. :/
Could you tell me a bit about your system? OS, version numbers, etc...
Did you try upgrading Matplotlib, or using another backend? Macports lets me use QT, wxWidgets, GTK, etc...
It could be that you need to replace None with 1, and change some logic:
thisline.set_alpha(1)
@pepijndevos: Can you please rebase this on top of origin/master, so we get a nice linear history?
I use Ubuntu 10.04 LTS, and the computer is a old laptop of 32bits.
No, I didn't try to update Matplotlib, I have the version 0.99.1. How can I change the backend of mian?
I tried changing the code as you said and it works perfectly with:
def on_pick(pickevent): thisline = pickevent.artist print "Toggeling", thisline.get_label() if thisline.get_alpha() == 1: thisline.set_alpha(0.3) else: thisline.set_alpha(1)
Maybe this is more compatible with older versions of Matplotlib
Okay, I'll rebase and patch.
Okay, I did as you said, rebased to origin/master, solved a bunch of conflicts, fixed the issue, but it still shows all 4 commits.
Hm, the diff looks okay though, but it still had one conflict.
mmmh... re-do the pull request? That worked for me in wrong pull requests.
I think it might be okay this way. The diff is good, and the history will be flat: https://github.com/l0b0/mian/network
great, waiting for the merge
Going for it..
Looks good, but I'd like your input on a few ideas in this regard:
@everyone: Who thinks this should be merged now, as-is, and who thinks it should be changed in any way first? Either is fine, but I'm not sure whether to read the last few comments as "unsolved, but working on it" or "not really an issue".
Ouch, is this still around? I'd say make the radius smaller and merge. I'll do that if no one has objections.
Thanks for merging this!
This patch allows one to fade lines by clicking them.
I did something stupid with the branching, so the logarithmic commits got included as well. I'm sorry for that.
With these combined commits, I'd like to propose a larger set of default blocks. Since it is now possible to discern coal and clay on the same graph, and either one can be faded.