enthought

Dynamically add legends to matplotlib plots in python

女生的网名这么多〃 提交于 2019-12-07 00:01:01
问题 I have a set of plots in python and want to add legends to each of them separately. I am generating the plots in a for loop and want to add the legends dynamically. Im getting only the last legend shown. I want all 9 off them to be displayed for q in range(1,10): matplotlib.pylab.plot(s_A_approx, label = q) matplotlib.pylab.legend(loc = 'upper left') matplotlib.pylab.show() 回答1: I can't reproduce your problem. With a few adjustments to your script, what you're expecting is working for me.

Matplotlib import error ft2font

笑着哭i 提交于 2019-12-06 16:31:45
I have Python 2.7.6 installed under Canopy on a 64 bit Mac with Ipython version 2.1.0. This is a really odd problem and I'm not sure if it is a path file problem. Whenever I import matplotlib.pyplot (not just matplotlib), I receive the following error: In [2]: import matplotlib.pyplot as plt --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-2-eff513f636fd> in <module>() ----> 1 import matplotlib.pyplot as plt /Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.py

Importing mayavi from python creates pop-up with black background on UI (Mavericks/Canopy)

故事扮演 提交于 2019-12-06 15:55:49
问题 Image gallery: http://imgur.com/a/qZkTW#qGj7I0H I just installed the new version of Canopy 1.3 from enthought. I opened up ipython, and I imported mayavi's mlab without issue. I then plotted a 3d sphere without issue using the following: import mayavi from mayavi import mlab mlab.points3d(1,1,1) mlab.show() And I get what I would expect (See figure #2 in gallery). I can then open up the scene editor without issue (see figure #1 in gallery), but when I try to open any other traits editors for

How to test if Canopy editor is open

[亡魂溺海] 提交于 2019-12-06 15:19:09
Is there a way to test if the Canopy editor is open/running that would work across platforms? On Mac/Unix, it seems to work to check for canopy.app.main in the output of "ps aux", but that is not possible on most Windows. I found a tasklist command that is similar, but it appears Canopy runs as a generic pythonw program. At present, on all OSes, if Canopy is running, then there will be a text file process.lck in the configuration/preferences directory . The second line of the file is the process ID. If Canopy was forced-stopped, the file will still be present even though Canopy is not running,

Multi Object View Behaviour - Creating an Editor for a HasTraits subclass

跟風遠走 提交于 2019-12-06 15:03:40
I am currently trying to make a traitsUI GUI for a class that contains many instances of a single object. My problem is very similar to the one solved in MultiObjectView Example TraitsUI . However, I don't like the idea of using a context as it requires me to write out the same view many times for each object I have (and I might have a lot). So I tried to edit the code to make it so that each Instance of the House object would default to looking like its normal view when it is viewed from the Houses object. It almost worked, except now I get a button that takes me to the view I want rather

Simple arrow mayavi/tvtk in mlab weird behaviour (looks like a bug)

谁都会走 提交于 2019-12-06 14:46:18
问题 I am trying to do a simple arrow in mlab to point to different areas on the graph. Consider this example: fig = mlab.figure( bgcolor=(0, 0, 0)) b=visual.Box(x=0, y=10, z=10) visual.set_viewer(fig) b=visual.Box(x=0, y=10, z=10) b2=visual.Box(x=10,y=10,z=10, color=(0,0,1)) a=visual.Arrow(x=10,y=10,z=10, color=(1,0,0)) So in my mind the arrow should appear from the blue box, however it lives it's own misterious life and is located absolutely off. That is very strange that boxes are located and

Chaco MultiLinePlot - unable to get simple plot to display, wondering if package broken?

风格不统一 提交于 2019-12-06 11:19:01
问题 I am trying to create a multi line plot to display multiple time series data (voltages) from a 2D NumPy array. I have started very simply trying to plot two lines with ten data points from a 2x10 array, but I am not even able to get this to work without getting a large amount of error output that I am unable to debug. Imports: import numpy from traits.api import HasTraits, Instance from traitsui.api import View, Item from chaco.api import MultiLinePlot, ArrayDataSource, MultiArrayDataSource

Customize syntax highlightin in canopy

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 09:32:06
问题 I just installed Enthought Canopy in a freshly (clean) installed Mac OS X Mountain Lion. So far, it seems to run stable and fast. My only problem is that I want to customize the syntax highlighting of both the editor and the console. There are no preferences to allow for that what I find quite strange because the embedded editor is just Editra, a highly customizable editor. I want to: Editor. As I was using Editra before, where can I place my old style file (.ess) for the syntax highlighting

IPython buffer and pagination in Enthought Canopy

二次信任 提交于 2019-12-06 07:45:22
I'm using Enthought's beta distribution of Python Canopy 0.9.1 on Windows 7. How do I increase the size of my IPython buffer. Also how do I pipe the output of a command through a paginator; output is currently unpaginated. If existing answers like How to increase the ipython qtconsole scrollback buffer limit or How to use Pipe in ipython will work, I don't know how to apply them to Windows. Thank you! There's currently no preference or config option to increase the buffer limit currently, but you could create a macro with the following code, and run it. def run(): code_task = get_active_task()

Setting the working directory of IPython Shell to that of the python file being executed in Canopy

本秂侑毒 提交于 2019-12-06 06:18:34
I am new to IPython and I am using the Canopy distribution. The default value of the shell's working directory is /home/username. This is a bit painful, when I work on files which need other files present in the corresponding folder that I am working in. So, I always manually change it to folder in which the file (which I am trying to execute) is present. I found this relevant question , but my question is slightly different. Also, I couldn't understand the answer provided there really well. Is there a shorter way of setting up the working directory of the IPython shell to that of the file on