From: Nate <ten...@ya...> - 2008-12-01 15:20:13
|
Is there a way to plot lines with drop shadows? Thanks, Nate |
From: John H. <jd...@gm...> - 2008-12-01 15:58:45
|
On Mon, Dec 1, 2008 at 9:17 AM, Nate <ten...@ya...> wrote: > Is there a way to plot lines with drop shadows? > Nothing built-in -- but you can fake it:: import matplotlib.pyplot as plt import numpy as np t = np.arange(0.0, 2.0, 0.01) s = np.sin(2*np.pi*t) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(t+0.01, s-0.01, color='gray', lw=2) ax.plot(t, s, color='blue', lw=3) plt.show() JDH |
From: twentypoundtrout <twe...@ya...> - 2008-12-01 20:43:13
|
John Hunter-4 wrote: > > On Mon, Dec 1, 2008 at 9:17 AM, Nate <ten...@ya...> wrote: >> Is there a way to plot lines with drop shadows? >> > > Nothing built-in -- but you can fake it:: > > import matplotlib.pyplot as plt > import numpy as np > > t = np.arange(0.0, 2.0, 0.01) > s = np.sin(2*np.pi*t) > > fig = plt.figure() > ax = fig.add_subplot(111) > ax.plot(t+0.01, s-0.01, color='gray', lw=2) > ax.plot(t, s, color='blue', lw=3) > plt.show() > > JDH > > So there is no way to say plot a line. Grab that image. Apply a standard SVG filter (like Gaussian). And overlay the blur? I do not know the PIL well enough to know if this is feasible. -- View this message in context: http://www.nabble.com/plot-with-drop-shadow-tp20773979p20780129.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Mike H. <mh...@us...> - 2008-12-01 21:12:16
|
Along similar lines, has anyone figured out a way to have a drop shadow effect for text on a plot? twentypoundtrout <twe...@ya...> 12/01/08 01:43 PM To mat...@li... cc Subject Re: [Matplotlib-users] plot with drop shadow John Hunter-4 wrote: > > On Mon, Dec 1, 2008 at 9:17 AM, Nate <ten...@ya...> wrote: >> Is there a way to plot lines with drop shadows? >> > > Nothing built-in -- but you can fake it:: > > import matplotlib.pyplot as plt > import numpy as np > > t = np.arange(0.0, 2.0, 0.01) > s = np.sin(2*np.pi*t) > > fig = plt.figure() > ax = fig.add_subplot(111) > ax.plot(t+0.01, s-0.01, color='gray', lw=2) > ax.plot(t, s, color='blue', lw=3) > plt.show() > > JDH > > So there is no way to say plot a line. Grab that image. Apply a standard SVG filter (like Gaussian). And overlay the blur? I do not know the PIL well enough to know if this is feasible. -- View this message in context: http://www.nabble.com/plot-with-drop-shadow-tp20773979p20780129.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------- 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 Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Alan G I. <ai...@am...> - 2008-12-01 21:25:37
|
Mike Hearne wrote: > Along similar lines, has anyone figured out a way to have a drop shadow effect for text on a plot? Out of curiosity, what is the payoff (in communication or aesthetics) of such a thing? Thanks, Alan Isaac |
From: twentypoundtrout <twe...@ya...> - 2008-12-01 21:40:16
|
Alan G Isaac wrote: > > Mike Hearne wrote: > > Along similar lines, has anyone figured out a way to have a drop shadow > effect for text on a plot? > > Out of curiosity, what is the payoff > (in communication or aesthetics) > of such a thing? > > I don't think that it communicates any more information, but it can often add depth to an otherwise benign figure and can also make the presentation softer to view. Just makes if fancy I guess. -- View this message in context: http://www.nabble.com/plot-with-drop-shadow-tp20773979p20781124.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Mike H. <mh...@us...> - 2008-12-02 00:27:35
|
The long answer is: I have a map with a varying background. I'd like to be able to create a white drop-shadow behind darker text, so that the text can stand out reasonably clearly against most colored backgrounds. The short answer is that my customers want it. --Mike Alan G Isaac <ai...@am...> 12/01/08 02:25 PM To mat...@li... cc Subject Re: [Matplotlib-users] plot with drop shadow Mike Hearne wrote: > Along similar lines, has anyone figured out a way to have a drop shadow effect for text on a plot? Out of curiosity, what is the payoff (in communication or aesthetics) of such a thing? Thanks, Alan Isaac ------------------------------------------------------------------------- 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 Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Alan G I. <ai...@am...> - 2008-12-02 02:19:16
|
On 12/1/2008 7:27 PM Mike Hearne apparently wrote: > The long answer is: I have a map with a varying background. I'd like to be able to create a white drop-shadow behind darker text, so that the text can stand out reasonably clearly against most colored backgrounds. OK. I can imagine this. If I wanted a quick pass at a cheap substitute for that kind of effect in PostScript, I'd probably stroke the text outline in white and then fill in the dark color. Do not know if that is possible in mpl or desirable for you. > The short answer is that my customers want it. Reason enough. Thanks, Alan |
From: Mike H. <mh...@us...> - 2008-12-03 20:53:03
|
How can I get the actual x,y data that represents the contour lines that are drawn with the contour() function? I'd like to be able to redraw portions of those lines with different styles (dashed, dotted, etc.) For example, given the following sample code (lifted from the sourceforge example): from pylab import * from numpy import * delta = 0.025 x = arange(-3.0, 3.0, delta) y = arange(-2.0, 2.0, delta) X, Y = meshgrid(x, y) Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) # difference of Gaussians Z = 10.0 * (Z2 - Z1) figure() cs = plt.contour(X, Y, Z) show() How could I, for example, re-draw the lines in the region X [0 1] Y [-1.5 -0.5] as dashed? I could do it, I think, if I had the for all the lines in the plot. --Mike |
From: Eric F. <ef...@ha...> - 2008-12-03 21:00:14
|
Mike Hearne wrote: > > How can I get the actual x,y data that represents the contour lines that > are drawn with the contour() function? > > I'd like to be able to redraw portions of those lines with different > styles (dashed, dotted, etc.) > > For example, given the following sample code (lifted from the > sourceforge example): > > from pylab import * > from numpy import * > > delta = 0.025 > x = arange(-3.0, 3.0, delta) > y = arange(-2.0, 2.0, delta) > X, Y = meshgrid(x, y) > Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) > Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) > # difference of Gaussians > Z = 10.0 * (Z2 - Z1) > figure() > cs = plt.contour(X, Y, Z) > show() > > How could I, for example, re-draw the lines in the region X [0 1] Y > [-1.5 -0.5] as dashed? > > I could do it, I think, if I had the for all the lines in the plot. I don't think this is going to make it easy to do what you want, but cs.collections is a list of LineCollection objects corresponding to the contour levels in cs.levels. Eric |
From: Mike H. <mh...@us...> - 2008-12-03 21:12:39
|
>>I don't think this is going to make it easy to do what you want It might if I could find the x,y data in the LineCollection objects. There is an undocumented function in the LineCollection class called get_paths(), which looks like it returns a list of Path objects. These path objects have a vertices property which looks like the stuff I want. I'll explore this for a while. Anyone who knows more about these objects, feel free to chime in! Thanks, Mike Eric Firing <ef...@ha...> 12/03/08 01:59 PM To Mike Hearne <mh...@us...> cc mat...@li... Subject Re: [Matplotlib-users] Contour line data Mike Hearne wrote: > > How can I get the actual x,y data that represents the contour lines that > are drawn with the contour() function? > > I'd like to be able to redraw portions of those lines with different > styles (dashed, dotted, etc.) > > For example, given the following sample code (lifted from the > sourceforge example): > > from pylab import * > from numpy import * > > delta = 0.025 > x = arange(-3.0, 3.0, delta) > y = arange(-2.0, 2.0, delta) > X, Y = meshgrid(x, y) > Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) > Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) > # difference of Gaussians > Z = 10.0 * (Z2 - Z1) > figure() > cs = plt.contour(X, Y, Z) > show() > > How could I, for example, re-draw the lines in the region X [0 1] Y > [-1.5 -0.5] as dashed? > > I could do it, I think, if I had the for all the lines in the plot. I don't think this is going to make it easy to do what you want, but cs.collections is a list of LineCollection objects corresponding to the contour levels in cs.levels. Eric |
From: Eric F. <ef...@ha...> - 2008-12-03 21:44:00
|
Mike Hearne wrote: > > >>I don't think this is going to make it easy to do what you want > > It might if I could find the x,y data in the LineCollection objects. > There is an undocumented function in the LineCollection class called > get_paths(), which looks like it returns a list of Path objects. These > path objects have a vertices property which looks like the stuff I want. > I'll explore this for a while. Anyone who knows more about these > objects, feel free to chime in! Mike, Have you tried simply making two sets of contours, one where you have masked out the region that you want dashed, and a second with the inverse of that mask? (Or, maybe the original mask and the inverted mask should overlap so that the contours in both regions go to their common boundary.) Granted, there may be edge effects between the regions, but it should be simple and quick. Eric > > Thanks, > > Mike > > > *Eric Firing <ef...@ha...>* > > 12/03/08 01:59 PM > > > To > Mike Hearne <mh...@us...> > cc > mat...@li... > Subject > Re: [Matplotlib-users] Contour line data > > > > > > > > > Mike Hearne wrote: > > > > How can I get the actual x,y data that represents the contour lines that > > are drawn with the contour() function? > > > > I'd like to be able to redraw portions of those lines with different > > styles (dashed, dotted, etc.) > > > > For example, given the following sample code (lifted from the > > sourceforge example): > > > > from pylab import * > > from numpy import * > > > > delta = 0.025 > > x = arange(-3.0, 3.0, delta) > > y = arange(-2.0, 2.0, delta) > > X, Y = meshgrid(x, y) > > Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) > > Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) > > # difference of Gaussians > > Z = 10.0 * (Z2 - Z1) > > figure() > > cs = plt.contour(X, Y, Z) > > show() > > > > How could I, for example, re-draw the lines in the region X [0 1] Y > > [-1.5 -0.5] as dashed? > > > > I could do it, I think, if I had the for all the lines in the plot. > > I don't think this is going to make it easy to do what you want, but > cs.collections is a list of LineCollection objects corresponding to the > contour levels in cs.levels. > > Eric > |
From: John H. <jd...@gm...> - 2008-12-01 21:39:58
|
On Mon, Dec 1, 2008 at 2:43 PM, twentypoundtrout <twe...@ya...> wrote: > So there is no way to say plot a line. Grab that image. Apply a standard > SVG filter (like Gaussian). And overlay the blur? I do not know the PIL > well enough to know if this is feasible. You can do this using an external program -- see for example http://abitofpythonabitofastronomy.blogspot.com/2008/10/svg.html. It would be challenging to implement something like this internally across output formats I think, but we recently added some features to make it easier to use an svg editor for filtering mpl objects. See also this thread http://www.nabble.com/SVG-clickable-images-td20236869.html#a20236869 JDH |