drawing objects/lines outside of plot

Hi there -

I’m wondering if there is a way to do this, since I haven’t found anything online or in the mailing list archives that covers it. I’d like to draw a line from inside the plot area to outside the plot area (see attached image - the blue line is what I plot, but I’d like to know how to create something like the red line, which goes beyond the axes of the plot). I’m guessing I would create an additional layer in the same figure, but make a layer without axes. However, I’m not exactly sure what I should do - add an additional canvas? a new renderer? If you can point me to the right documentation or give me some idea of how I should be doing this, I would really appreciate it.

Charles

image.png

···

==========

The 2nd Law of Thermodynamics… If you think things are a mess now, JUST WAIT!

charles reid wrote:

Hi there -

I'm wondering if there is a way to do this, since I haven't found anything online or in the mailing list archives that covers it. I'd like to draw a line from inside the plot area to outside the plot area (see attached image - the blue line is what I plot, but I'd like to know how to create something like the red line, which goes beyond the axes of the plot). I'm guessing I would create an additional layer in the same figure, but make a layer without axes. However, I'm not exactly sure what I should do - add an additional canvas? a new renderer? If you can point me to the right documentation or give me some idea of how I should be doing this, I would really appreciate it.

You can turn off the clipping to the axes box on a per-artist basis. Something like this:

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(10)
y = np.ones_like(x)
ll = plt.plot(x,y) # returns a sequence of line objects
ll[0].set_clip_on(False)
plt.axis([0,3,0,3])
plt.show()

Eric

···

Charles

==========

The 2nd Law of Thermodynamics... If you think things are a mess now, JUST WAIT!

------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

That does the trick! Thanks Eric.

···

==========

The 2nd Law of Thermodynamics… If you think things are a mess now, JUST WAIT!

On Sat, Sep 20, 2008 at 12:47 PM, Eric Firing <efiring@…202…> wrote:

charles reid wrote:

Hi there -

I’m wondering if there is a way to do this, since I haven’t found anything online or in the mailing list archives that covers it. I’d like to draw a line from inside the plot area to outside the plot area (see attached image - the blue line is what I plot, but I’d like to know how to create something like the red line, which goes beyond the axes of the plot). I’m guessing I would create an additional layer in the same figure, but make a layer without axes. However, I’m not exactly sure what I should do - add an additional canvas? a new renderer? If you can point me to the right documentation or give me some idea of how I should be doing this, I would really appreciate it.

You can turn off the clipping to the axes box on a per-artist basis. Something like this:

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(10)

y = np.ones_like(x)

ll = plt.plot(x,y) # returns a sequence of line objects

ll[0].set_clip_on(False)

plt.axis([0,3,0,3])

plt.show()

Eric

Charles

==========

The 2nd Law of Thermodynamics… If you think things are a mess now, JUST WAIT!




This SF.Net email is sponsored by the Moblin Your Move Developer’s challenge

Build the coolest Linux based applications with Moblin SDK & win great prizes

Grand prize is a trip for two to an Open Source event anywhere in the world

http://moblin-contest.org/redirect.php?banner_id=100&url=/



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users