Suppose I have a figure canvas with 3 plots... 2 are images of the same dimensions plotted with imshow, and the other is some other kind of subplot. I'd like to be able to link the x and y axes of the imshow plots so that when I zoom in one (using the zoom tool provided by the NavigationToolbar), the other zooms to the same coordinates, and when I pan in one, the other pans as well.
Subplot methods such as scatter and histogram can be passed kwargs specifying an axes for sharex and sharey, but imshow has no such configuration.
I started hacking my way around this by subclassing NavigationToolbar2WxAgg (shown below)... but there are several problems here.
1) This will link the axes of all plots in a canvas since all I've done is get rid of the checks for a.in_axes()
2) This worked well for panning, but zooming caused all subplots to zoom from the same global point, rather than from the same point in each of their respective axes.
Can anyone suggest a workaround?
Much thanks!
-Adam
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
class MyNavToolbar(NavigationToolbar2WxAgg):
def __init__(self, canvas, cpfig):
NavigationToolbar2WxAgg.__init__(self, canvas)
# overrided
# As mentioned in the code below, the only difference here from overridden
# method is that this one doesn't check a.in_axes(event) when deciding which
# axes to start the pan in...
def press_pan(self, event):
'the press mouse button in pan/zoom mode callback'
if event.button == 1:
self._button_pressed=1
elif event.button == 3:
self._button_pressed=3
else:
self._button_pressed=None
return
x, y = event.x, event.y
# push the current view to define home if stack is empty
if self._views.empty(): self.push_current()
self._xypress=[]
for i, a in enumerate(self.canvas.figure.get_axes()):
# only difference from overridden method is that this one doesn't
# check a.in_axes(event)
if x is not None and y is not None and a.get_navigate():
a.start_pan(x, y, event.button)
self._xypress.append((a, i))
self.canvas.mpl_disconnect(self._idDrag)
self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.drag_pan)
# overrided
def press_zoom(self, event):
'the press mouse button in zoom to rect mode callback'
if event.button == 1:
self._button_pressed=1
elif event.button == 3:
self._button_pressed=3
else:
self._button_pressed=None
return
x, y = event.x, event.y
# push the current view to define home if stack is empty
if self._views.empty(): self.push_current()
self._xypress=[]
for i, a in enumerate(self.canvas.figure.get_axes()):
# only difference from overridden method is that this one doesn't
# check a.in_axes(event)
if x is not None and y is not None and a.get_navigate() and a.can_zoom():
self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen()))
self.press(event)
Hi,
Is there a wiki or book, which explains what happens when user enters a link in the browser, and how the dns is resolved, how the router finds the route to the host etc.. I am mainly interested in routing the packets.
Thank you
I am developing a new e-commerce website in java. My index page has links such as Login etc. I had gone through other e-commerce sites such as ebay where they have option of My Account. My question is before signing in to the account ,why do they need this link My Account. what is the significance of this. can any web designer let me know the answer?
I know innerHTML is supposedly evil, but I think it's the simplest way to change link text. For example:
<a id="mylink" href="">click me</a>
In JS you can change the text with:
document.getElementById("mylink").innerHTML = new_text;
And in Prototype/jQuery:
$("mylink").innerHTML = new_text;
works fine. Otherwise you have to replace all of the child nodes first and then add a text node. Why bother?
Obviously you can't just surround the <tr> tag with an <a> tag and call it a day; this is invalid and doesn't even work. I have seen JavaScript used, but then what happens to browsers that don't support JavaScript? What is the best way to make an entire table row <tr> into a link?
i want to learn the server side programing with json parser on the client side and php on the server side.
i want some ebook or link related to the same.
How to make a link button visible after another button has been clicked in asp.net(vb) in button_click()
it says error as "Object reference not set to an instance of an object."
i've done this in my code
Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim receipt As LinkButton = FormView1.FindControl("LinkButton1")
' receipt.Enabled = "true"
' receipt.EnableTheming = "true"
' receipt.EnableViewState = "true"
receipt.Visible = "true"
End Sub
hi,
I'm using
<mx:LinkButton click="navigateToURL(new URLRequest(event.currentTarget.label.toString()))" />
to open a browser window to display the website on the label of my LinkButton. However I cannot correctly pass the link.. you see the problem:
file://localhost/..myapp/bin-debug/www.google.com
thanks
How long will a browser remember a "a:visited" link? Assuming the method isn't uniform across browsers - an answer for any individual browser (or as many as you know) would be helpful.
Also, under which type of memory is it stored? "Web History"? Cache?
A user clicks a link in their HTML email, it then goes to a page that simply opens up their email client.
window.location.href = 'mailto:...';
I don't want this window/tab to stay open, how can I close it?
window.close() doesn't work since it wasn't opened using window.open()
is it possible?
Hi everyone!
I'd like to alter the default behavior of a link that points to an mp3 file. All major browsers always open and play this mp3 file in a new window, and I'd like instead that this file be offered as a download by the browser.
¿Any Idea?
Thanks!!
Hi All,
Is there any way to get CVS e-mail notifications to inlude links to my ViewCVS server where clicking a link could bring up the diff ?
Currently my loginfo file just has entries like this
^installation cat | /usr/bin/Mail -s "[cvs-update installation]" [email protected]
The e-mails we all then get (Afairly standard I imagine) contain the commit message and list of files changed.
Cheers,
Ro
Hello, I was wondering if you can add a link to a website in a C++ program running in the CMD Prompt type window (No GUI)
If it's possible can some one please give me a few examples?
Thanks.
Hi there,
What's the difference between using the two options below to output link HTML?
theme('links', $primary_links, array('class' => 'links primary-links'))
theme_links($primary_links, $attributes = array('class' => 'links primary-links'))
Many thanks
Hi,
I'm wondering how facebook extracts the right picture of the article from a link? they ignore any icons, ads images, or other not related images, & they gives you the right image?
What technique/method they use? because i've tried to extract all images using a php regex but how to find the right one?
Thanks
on the web you can deep link to youtube videos like this:
http://www.youtube.com/v/wiTSbmxssBQ&&start=20
is there a way to make this work on the iphone?
thanks!
Which is the better way of using the image as a link..
<A HREF="javascript:password()">
<IMG SRC="pict1.gif" NAME="pic1" ALT="about us!" BORDER="0" align="left"></A>
or the same thing using onClick in the img tag ??
Which one is advisable?? Are both equally good to use??
I have a document library in a sub site. How do I add a link to that library into the root site's left navigation bar?
Dynamic or static links are fine.