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 #87915 is a reply to message #87914] Mon, 03 March 2014 15:22 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
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: Wed Oct 08 15:56:37 PDT 2025

Total time taken to generate the page: 0.00538 seconds