|
From: Timothée L. <tim...@lp...> - 2009-03-13 11:30:30
|
Dear all, I am using matplotlib with a great pleasure, and I enjoy its capabilities. I have recently attended a conference where the invited speaker showed great visualizations of arrays from both experiments and simulations. His plots were basically looking like those produced by imshow, that is a luminance array rendered as a colormap image, but with the additionnal use of a shading, which gives a really great feeling to the image. You can feel the height of each part of the image. I have tried to find what software could have produced such a plot, and found the ReliefPlot function of Mathematica, which has precisely this purpose : rendering a colormap image from an array with a shading to give the perception of relief. The documentation and its examples are self-explanatory : http://reference.wolfram.com/mathematica/ref/ReliefPlot.html (look in particular at the first "neat example" at the bottom of that page) The two "live" demonstrations illustrate this plot style quite well too : http://demonstrations.wolfram.com/ReliefShadedElevationMap/ http://demonstrations.wolfram.com/VoronoiImage/ So here are my questions : Is there a trick to generate an image with such a shading in matplotlib ? If not, do you know of a python tool that could help ? Where could I start if I want to code it myself in matplotlib ? Thanks for your help. Best regards, Timothée Lecomte -- Laboratoire Pierre Aigrain, École Normale Supérieure 24, rue Lhomond 75005 Paris |
|
From: Jeff W. <js...@fa...> - 2009-03-13 20:03:09
Attachments:
hillshade.py
|
Timothée Lecomte wrote: > Dear all, > > I am using matplotlib with a great pleasure, and I enjoy its capabilities. > I have recently attended a conference where the invited speaker showed > great visualizations of arrays from both experiments and simulations. > His plots were basically looking like those produced by imshow, that is > a luminance array rendered as a colormap image, but with the additionnal > use of a shading, which gives a really great feeling to the image. You > can feel the height of each part of the image. > > I have tried to find what software could have produced such a plot, and > found the ReliefPlot function of Mathematica, which has precisely this > purpose : rendering a colormap image from an array with a shading to > give the perception of relief. > > The documentation and its examples are self-explanatory : > http://reference.wolfram.com/mathematica/ref/ReliefPlot.html > (look in particular at the first "neat example" at the bottom of that page) > > The two "live" demonstrations illustrate this plot style quite well too : > http://demonstrations.wolfram.com/ReliefShadedElevationMap/ > http://demonstrations.wolfram.com/VoronoiImage/ > > So here are my questions : > Is there a trick to generate an image with such a shading in matplotlib ? > If not, do you know of a python tool that could help ? > Where could I start if I want to code it myself in matplotlib ? > > Thanks for your help. > > Best regards, > > Timothée Lecomte > > Timothée: There is nothing built-in, but it would be a nice thing to have. Here's a proof-of-concept hack that follows the approach used in the Generic Mapping Tools (explained here http://www.seismo.ethz.ch/gmt/doc/html/tutorial/node70.html), with some code borrowed from http://www.langarson.com.au/blog/?p=14. It's very rough, but if it looks promising to you I can try to polish it. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Jeff W. <js...@fa...> - 2009-03-13 21:10:08
Attachments:
hillshade.py
|
Jeff Whitaker wrote: > Timothée Lecomte wrote: >> Dear all, >> >> I am using matplotlib with a great pleasure, and I enjoy its >> capabilities. >> I have recently attended a conference where the invited speaker >> showed great visualizations of arrays from both experiments and >> simulations. His plots were basically looking like those produced by >> imshow, that is a luminance array rendered as a colormap image, but >> with the additionnal use of a shading, which gives a really great >> feeling to the image. You can feel the height of each part of the image. >> >> I have tried to find what software could have produced such a plot, >> and found the ReliefPlot function of Mathematica, which has precisely >> this purpose : rendering a colormap image from an array with a >> shading to give the perception of relief. >> >> The documentation and its examples are self-explanatory : >> http://reference.wolfram.com/mathematica/ref/ReliefPlot.html >> (look in particular at the first "neat example" at the bottom of that >> page) >> >> The two "live" demonstrations illustrate this plot style quite well >> too : >> http://demonstrations.wolfram.com/ReliefShadedElevationMap/ >> http://demonstrations.wolfram.com/VoronoiImage/ >> >> So here are my questions : >> Is there a trick to generate an image with such a shading in >> matplotlib ? >> If not, do you know of a python tool that could help ? >> Where could I start if I want to code it myself in matplotlib ? >> >> Thanks for your help. >> >> Best regards, >> >> Timothée Lecomte >> >> > > Timothée: There is nothing built-in, but it would be a nice thing to > have. Here's a proof-of-concept hack that follows the approach used > in the Generic Mapping Tools (explained here > http://www.seismo.ethz.ch/gmt/doc/html/tutorial/node70.html), with > some code borrowed from http://www.langarson.com.au/blog/?p=14. It's > very rough, but if it looks promising to you I can try to polish it. > > -Jeff Found a bug, here's a fixed version. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Timothée L. <tim...@lp...> - 2009-03-13 22:24:20
|
Jeff Whitaker wrote: > Jeff Whitaker wrote: >> Timothée Lecomte wrote: >>> Dear all, >>> >>> I am using matplotlib with a great pleasure, and I enjoy its >>> capabilities. >>> I have recently attended a conference where the invited speaker >>> showed great visualizations of arrays from both experiments and >>> simulations. His plots were basically looking like those produced by >>> imshow, that is a luminance array rendered as a colormap image, but >>> with the additionnal use of a shading, which gives a really great >>> feeling to the image. You can feel the height of each part of the >>> image. >>> >>> I have tried to find what software could have produced such a plot, >>> and found the ReliefPlot function of Mathematica, which has >>> precisely this purpose : rendering a colormap image from an array >>> with a shading to give the perception of relief. >>> >>> The documentation and its examples are self-explanatory : >>> http://reference.wolfram.com/mathematica/ref/ReliefPlot.html >>> (look in particular at the first "neat example" at the bottom of >>> that page) >>> >>> The two "live" demonstrations illustrate this plot style quite well >>> too : >>> http://demonstrations.wolfram.com/ReliefShadedElevationMap/ >>> http://demonstrations.wolfram.com/VoronoiImage/ >>> >>> So here are my questions : >>> Is there a trick to generate an image with such a shading in >>> matplotlib ? >>> If not, do you know of a python tool that could help ? >>> Where could I start if I want to code it myself in matplotlib ? >>> >>> Thanks for your help. >>> >>> Best regards, >>> >>> Timothée Lecomte >>> >>> >> >> Timothée: There is nothing built-in, but it would be a nice thing to >> have. Here's a proof-of-concept hack that follows the approach used >> in the Generic Mapping Tools (explained here >> http://www.seismo.ethz.ch/gmt/doc/html/tutorial/node70.html), with >> some code borrowed from http://www.langarson.com.au/blog/?p=14. It's >> very rough, but if it looks promising to you I can try to polish it. >> >> -Jeff > > Found a bug, here's a fixed version. > > -Jeff > Hi Jeff, Sure it looks promising ! The example you provided is very nice. I will try on my own data on Monday, and I'll let you know if it gives a good result too. Thank you very much for that very fast hack ! Best regards, Timothée |
|
From: Jeff W. <js...@fa...> - 2009-03-14 13:24:00
|
Timothée Lecomte wrote: > Jeff Whitaker wrote: >> Jeff Whitaker wrote: >>> Timothée Lecomte wrote: >>>> Dear all, >>>> >>>> I am using matplotlib with a great pleasure, and I enjoy its >>>> capabilities. >>>> I have recently attended a conference where the invited speaker >>>> showed great visualizations of arrays from both experiments and >>>> simulations. His plots were basically looking like those produced >>>> by imshow, that is a luminance array rendered as a colormap image, >>>> but with the additionnal use of a shading, which gives a really >>>> great feeling to the image. You can feel the height of each part of >>>> the image. >>>> >>>> I have tried to find what software could have produced such a plot, >>>> and found the ReliefPlot function of Mathematica, which has >>>> precisely this purpose : rendering a colormap image from an array >>>> with a shading to give the perception of relief. >>>> >>>> The documentation and its examples are self-explanatory : >>>> http://reference.wolfram.com/mathematica/ref/ReliefPlot.html >>>> (look in particular at the first "neat example" at the bottom of >>>> that page) >>>> >>>> The two "live" demonstrations illustrate this plot style quite well >>>> too : >>>> http://demonstrations.wolfram.com/ReliefShadedElevationMap/ >>>> http://demonstrations.wolfram.com/VoronoiImage/ >>>> >>>> So here are my questions : >>>> Is there a trick to generate an image with such a shading in >>>> matplotlib ? >>>> If not, do you know of a python tool that could help ? >>>> Where could I start if I want to code it myself in matplotlib ? >>>> >>>> Thanks for your help. >>>> >>>> Best regards, >>>> >>>> Timothée Lecomte >>>> >>>> >>> >>> Timothée: There is nothing built-in, but it would be a nice thing >>> to have. Here's a proof-of-concept hack that follows the approach >>> used in the Generic Mapping Tools (explained here >>> http://www.seismo.ethz.ch/gmt/doc/html/tutorial/node70.html), with >>> some code borrowed from http://www.langarson.com.au/blog/?p=14. >>> It's very rough, but if it looks promising to you I can try to >>> polish it. >>> >>> -Jeff >> >> Found a bug, here's a fixed version. >> >> -Jeff >> > Hi Jeff, > > Sure it looks promising ! The example you provided is very nice. I > will try on my own data on Monday, and I'll let you know if it gives a > good result too. Thank you very much for that very fast hack ! > > Best regards, > > Timothée > > Timothée: I've added this capability in svn, along with an example (shading_example.py) to show how to use it. Thanks for suggesting it. -Jeff |
|
From: Ryan M. <rm...@gm...> - 2009-03-16 01:07:45
|
On Sat, Mar 14, 2009 at 8:23 AM, Jeff Whitaker <js...@fa...> wrote: > Timothée Lecomte wrote: > > Jeff Whitaker wrote: > >> Jeff Whitaker wrote: > >>> Timothée Lecomte wrote: > >>>> Dear all, > >>>> > >>>> I am using matplotlib with a great pleasure, and I enjoy its > >>>> capabilities. > >>>> I have recently attended a conference where the invited speaker > >>>> showed great visualizations of arrays from both experiments and > >>>> simulations. His plots were basically looking like those produced > >>>> by imshow, that is a luminance array rendered as a colormap image, > >>>> but with the additionnal use of a shading, which gives a really > >>>> great feeling to the image. You can feel the height of each part of > >>>> the image. > >>>> > >>>> I have tried to find what software could have produced such a plot, > >>>> and found the ReliefPlot function of Mathematica, which has > >>>> precisely this purpose : rendering a colormap image from an array > >>>> with a shading to give the perception of relief. > >>>> > >>>> The documentation and its examples are self-explanatory : > >>>> http://reference.wolfram.com/mathematica/ref/ReliefPlot.html > >>>> (look in particular at the first "neat example" at the bottom of > >>>> that page) > >>>> > >>>> The two "live" demonstrations illustrate this plot style quite well > >>>> too : > >>>> http://demonstrations.wolfram.com/ReliefShadedElevationMap/ > >>>> http://demonstrations.wolfram.com/VoronoiImage/ > >>>> > >>>> So here are my questions : > >>>> Is there a trick to generate an image with such a shading in > >>>> matplotlib ? > >>>> If not, do you know of a python tool that could help ? > >>>> Where could I start if I want to code it myself in matplotlib ? > >>>> > >>>> Thanks for your help. > >>>> > >>>> Best regards, > >>>> > >>>> Timothée Lecomte > >>>> > >>>> > >>> > >>> Timothée: There is nothing built-in, but it would be a nice thing > >>> to have. Here's a proof-of-concept hack that follows the approach > >>> used in the Generic Mapping Tools (explained here > >>> http://www.seismo.ethz.ch/gmt/doc/html/tutorial/node70.html), with > >>> some code borrowed from http://www.langarson.com.au/blog/?p=14. > >>> It's very rough, but if it looks promising to you I can try to > >>> polish it. > >>> > >>> -Jeff > >> > >> Found a bug, here's a fixed version. > >> > >> -Jeff > >> > > Hi Jeff, > > > > Sure it looks promising ! The example you provided is very nice. I > > will try on my own data on Monday, and I'll let you know if it gives a > > good result too. Thank you very much for that very fast hack ! > > > > Best regards, > > > > Timothée > > > > > Timothée: I've added this capability in svn, along with an example > (shading_example.py) to show how to use it. Thanks for suggesting it. > That looks awesome. Very nice work, Jeff. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |