comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » New free DLL for calling Python from IDL!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: New free DLL for calling Python from IDL! [message #87919 is a reply to message #87915] Mon, 03 March 2014 15:56 Go to previous messageGo to previous message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
IDL> p = plt.pie(sizes, explode=explode, labels=labels, colors=colors, $
> autopct='%1.1f%%', shadow=1, startangle=90)
IDL> print, p
([<matplotlib.patches.Wedge object at 0x0000000017D6F320>, <matplotlib.patches.Wedge object at 0x0000000018200B00>, <matplotlib.patches.Wedge object at 0x000000001820B320>, <matplotlib.patches.Wedge object at 0x0000000018210B00>], [<matplotlib.text.Text object at 0x0000000017D6FFD0>, <matplotlib.text.Text object at 0x00000000182077F0>, <matplotlib.text.Text object at 0x000000001820BFD0>, <matplotlib.text.Text object at 0x00000000182177F0>], [<matplotlib.text.Text object at 0x00000000182005C0>, <matplotlib.text.Text object at 0x0000000018207DA0>, <matplotlib.text.Text object at 0x00000000182105C0>, <matplotlib.text.Text object at 0x0000000018217DA0>])
IDL> print, p[0]
[<matplotlib.patches.Wedge object at 0x0000000017D6F320>, <matplotlib.patches.Wedge object at 0x0000000018200B00>, <matplotlib.patches.Wedge object at 0x000000001820B320>, <matplotlib.patches.Wedge object at 0x0000000018210B00>]
IDL> print, p[1]
[<matplotlib.text.Text object at 0x0000000017D6FFD0>, <matplotlib.text.Text object at 0x00000000182077F0>, <matplotlib.text.Text object at 0x000000001820BFD0>, <matplotlib.text.Text object at 0x00000000182177F0>]
IDL> print, (p[1])[0].get_text()
Frogs
IDL> print, (p[1])[2].get_text()
Dogs
IDL>

On Monday, March 3, 2014 6:22:34 PM UTC-5, Chris Torrence wrote:
> Well, here's another example that might put both me and David out of business. I installed the Anaconda (python 2.7 package), which comes with all of the matplotlib libraries.
>
>
>
> This example is taken directly from the matplotlib gallery page:
>
> http://matplotlib.org/examples/pie_and_polar_charts/pie_demo _features.html
>
>
>
> Create a pie chart from within IDL:
>
>
>
> plt = pyimport("matplotlib.pyplot")
>
> sizes = [15,30,45,10]
>
> labels = ['Frogs', 'Hogs', 'Dogs', 'Logs']
>
> colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
>
> explode = [0, 0.1, 0, 0]
>
> p = plt.pie(sizes, explode=explode, labels=labels, colors=colors, $
>
> autopct='%1.1f%%', shadow=1, startangle=90)
>
> void = plt.axis('equal')
>
> void = plt.show(block=0)
>
> void = plt.savefig('plot.pdf')
>
>
>
> But here's a question for Jason or Ronn: once I've created the "p" object, it says it is a "tuple". Is there any way to get properties back out of the object? I tried the following:
>
> IDL> pb = pyimportbuiltins()
>
> IDL> pb.getattr(p,'colors')
>
> % PYTHONOBJECT::GETATTR: AttributeError: 'tuple' object has no attribute 'colors'
>
>
>
> Cheers,
>
> Chris
>
> ExelisVIS
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: superresolution
Next Topic: How to find the confidence interval of a variable data at 95% or 66%?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 15:58:12 PDT 2025

Total time taken to generate the page: 1.83944 seconds