[Matplotlib-users] my pie charts gotta pop!

2011-12-14 Thread Justin
I sadly, have to include pie charts in a presentation/document I am putting 
together. 

I have 6 categories, but 4 of them are a very small fraction of the total... so 
the base pie chart even with exploded sections looks terrible.

Also, I need to display the % values and category labels. Using autopct and 
labels arguments makes for lots of overlapping mess. maybe they can render 
outside of the plot area if the slice is too small?

Its terribly taboo I know, but can it look cool and 3D too... my boss would 
love 
me if it did!

Any suggestions or places to find a gorgeous pie chart, let me know...


Thanks for your help!

Justin


--
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] timer objects in macosx backend

2013-07-17 Thread Justin Lazear

Hi all,

I'm using a timer object to interact with the MPL event loop on my OS X 
laptop. However, it seems to be missing a few key methods that are 
making using it a little difficult. In particular, I can't find a way to 
stop the timer from sending events:


$ ipython --pylab

   In [1]: def fun():
   ...: for i in range(5):
   ...: print "We're having fun!"; yield
   ...: for i in range(5):
   ...: print "Too much fun..."; yield
   ...: while True:
   ...: print "Stop the fun! No more!"; yield

   In [2]: f = fun().next

   In [3]: fig = plt.figure()

   In [4]: t = fig.canvas.new_timer()

   In [5]: t.add_callback(f)

   In [6]: t.start()

   In [7]: t.stop()

   In [8]: del t  # It's all over now...


It looks like the stop method may never have been implemented:

   In [3]: t.stop??
   Type:   instancemethod
   String Form:
   File: /usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py
   Definition: t.stop(self)
   Source:
def stop(self):
'''
Stop the timer.
'''
self._timer_stop()

   In [4]: t._timer_stop??
   Type:   instancemethod
   String Form:
   File: /usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py
   Definition: t._timer_stop(self)
   Source:
def _timer_stop(self):
pass


I'm able to remove the callback function from the timer's callback list, 
but I suspect that won't stop the events from being triggered. But I'd 
really prefer to completely stop the timer events, since in my 
application I may end up going through many timers.


Is this the expected behavior? Is there an easy fix I'm overlooking?

Version info:

   In [3]: sys.version
   Out[3]: '2.7.3 (default, Feb 19 2013, 18:00:31) \n[GCC 4.2.1
   Compatible Apple LLVM 4.2 (clang-425.0.24)]'

   In [4]: mpl.__version__
   Out[4]: '1.2.0'


Thanks,
Justin
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] timer objects in macosx backend

2013-07-18 Thread Justin Lazear

Hi Michiel,

On my system, deleting the timer has no effect and the timer continues 
to send events. The __del__ method seems to call the same unimplemented 
_timer_stop method. Regardless, something else has a reference to the 
timer (MPL event loop maybe?) and __del__ is not being called once the 
timer has been started. It's not clear to me what should be stopping the 
timer in that case.


Does del t stop the timer on your system? If so, could we hunt down what 
is happening after you delete the name t that is causing the timer to stop?


I would personally prefer an explicit .stop() method, since I would 
prefer not to rely on the garbage collector's behavior being consistent 
(hard to make sure nothing else is holding a reference to timer) when 
there is a very well-defined function that does what I want.


Thanks,
Justin

On 7/18/13 12:54 AM, Michiel de Hoon wrote:

Hi Justin,

The .stop() method was indeed never implemented for Timer objects in 
the MacOSX backend.
I am not sure if a .stop() method is really needed, because deleting 
the timer has the same effect as stopping the timer.

Is there some reason you prefer
>>> t.stop()
instead of
>>> del t
?

Best,
-Michiel


----
*From:* Justin Lazear 
*To:* Matplotlib-users@lists.sourceforge.net
*Sent:* Thursday, July 18, 2013 12:13 AM
*Subject:* [Matplotlib-users] timer objects in macosx backend

Hi all,

I'm using a timer object to interact with the MPL event loop on my OS 
X laptop. However, it seems to be missing a few key methods that are 
making using it a little difficult. In particular, I can't find a way 
to stop the timer from sending events:


$ ipython --pylab

In [1]: def fun():
   ...: for i in range(5):
   ...: print "We're having fun!"; yield
   ...: for i in range(5):
   ...: print "Too much fun..."; yield
   ...: while True:
   ...: print "Stop the fun! No more!"; yield

In [2]: f = fun().next

In [3]: fig = plt.figure()

In [4]: t = fig.canvas.new_timer()

In [5]: t.add_callback(f)

In [6]: t.start()

In [7]: t.stop()

In [8]: del t  # It's all over now...


It looks like the stop method may never have been implemented:

In [3]: t.stop??
Type:   instancemethod
String Form:
File:
/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py
Definition: t.stop(self)
Source:
def stop(self):
'''
Stop the timer.
'''
self._timer_stop()

In [4]: t._timer_stop??
Type:   instancemethod
String Form:
File:
/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py
Definition: t._timer_stop(self)
Source:
def _timer_stop(self):
pass


I'm able to remove the callback function from the timer's callback 
list, but I suspect that won't stop the events from being triggered. 
But I'd really prefer to completely stop the timer events, since in my 
application I may end up going through many timers.


Is this the expected behavior? Is there an easy fix I'm overlooking?

Version info:

In [3]: sys.version
Out[3]: '2.7.3 (default, Feb 19 2013, 18:00:31) \n[GCC 4.2.1
Compatible Apple LLVM 4.2 (clang-425.0.24)]'

In [4]: mpl.__version__
Out[4]: '1.2.0'


Thanks,
Justin

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net 
<mailto:Matplotlib-users@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] I would like to post to this list.

2015-06-24 Thread Justin Northrop

--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] TikZ/PGF backend

2009-08-20 Thread Justin Findlay
I'm trying to find a way to embed matplotlib graphs in LaTeX
documents.  Ideally a solution would involve converting MPL's output
to TikZ in order to get native rendering of the graphics and text.
This seems like the "Right Way" to go, unfortunately, my classes start
on Monday, and I'm neither python nor TeX guru enough to begin a
project so ambitious and important.  This is what I have done so far,
benevolent user that I am,

https://sourceforge.net/tracker/?func=detail&aid=2841217&group_id=80706&atid=560723

If anyone has more information on this or code to this effect I would
be very interested in learning/contributing.


Justin

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TikZ/PGF backend

2009-08-20 Thread Justin Findlay
On Thu, Aug 20, 2009 at 3:56 PM, John Hunter wrote:
> What's wrong with including the ps/eps output in your latex docs, or
> the pdf output for your pdflatex docs?  That's what most people do.
> You can enable the "usetex" option if you want tex to render the text

The difference is subtle.  By having the graphics and text rendered by
the different system they will end up having a different 'look'.  I
know that usetex solves most of the text-in-graphics issues, and that
TeX wasn't even designed to really layout anything but text and the
most minimal vector graphics, but TikZ is more than adequate for plots
and stands on its own merit as a fully-featured graphics language.
TeX+TikZ finally eliminates the need for external vector hackery.  Of
course, I'll probably just use pdf and usetex as you suggest, but I
was hoping for something better.


Justin

(stupid gmail reply to defaults)

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] |--------| Annotation

2011-10-28 Thread Justin McCann
On Fri, Oct 28, 2011 at 6:31 AM, Paul Hilscher  wrote:
> Dear all,
> first of all thank you for the this awesome plotting library :D.
> I have a logarithmic plot where I want to stress out a specific range using
> a line like
> y    Something
> |   |---|
> |   ___
> |  /                   \
> | /                     \
> |/
> |--->
>           x
> I looked up the documentation but could find a proper arrow style or
> similar.
> Does anybody know how to do this the proper way ?
> I did that "manualy" using 3 plot commands and text() , but I guess there
> should be some nicer way ??

You can create the arrow with
   a = mpl.patches.FancyArrowPatch(posA=(4,4), posB=(7,4), arrowstyle="|-|")
   ax.add_patch(a)

or

   ax.annotate("", xy=(4,4), xytext=(7,4), arrowprops=dict(arrowstyle='|-|'))

and then adding your label manually with text(), like you said. There
may be some way to do it all in the annotate command (by shifting the
arrow away from the label somehow), but by default the annotate()
command draws an arrow from point xytext to xy (the point you're
labeling).

Justin

--
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to surpress figure pop out within interactive ipython shell?

2011-12-15 Thread Justin McCann
On Thu, Dec 15, 2011 at 12:33 PM, Chao YUE  wrote:

> Dear matplotlib users,
>
> How can I surpress the figure pop out when I make plot within the ipython
> interactive shell?
> suppose I make a figure first and I want to save it:
>
> fig=plt.figure()
> ax=fig.add_subplot(111)
> ax.plot(np.arange(10))
> fig.savefig('fig1.png')
> ###actually above is only an example and usually I use loop to make many
> figures.
>

Try adding 'plt.close(fig)' after you save the figure, or just plt.close()
if you want to close everything.
--
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Figure points vs. figure pixels

2012-02-15 Thread Justin McCann
I have some figures with multiple axes stacked on top of each other,
generated with Figure.add_subplot(). In each figure, some sets of these
axes are logically grouped together, and I need some visual clue of which
axes are more closely related.

The right way is probably to use GridSpec [
http://matplotlib.sourceforge.net/users/gridspec.html] and add some
additional wspace.

Instead, I attempted to just add some lines between the logical groups of
axes (code below), generated from the bounding boxes of the axes, and
drawing the lines halfway between.

There are probably many things wrong with this code. :) If I use 'figure
pixels' (red lines), the displayed figure looks great, but the lines move
to different places in the saved PNG file. I'm guessing this is the result
of rcParams.update({'savefig.dpi': 300.0}). If I use 'figure points' (green
lines), the lines show up in the same place both in the display and saved
file. Is there a different function I should be using to get the bounding
box edges, or to convert between the figure pixels and points?

Thanks,
Justin

---
f = figure()
map(lambda i : f.add_subplot(10, 1, i), range(1,10)) # make subplots
do_lines_after = [1,3,5,7] # draw lines after these axes (indexes)

def group_axes(f, do_lines_after, color='red', coords='figure pixels'):
boxes = [ax.bbox.get_points() for ax in f.axes] # get bounding boxes
for ax_index in do_lines_after:
if ax_index < (len(boxes) - 1):
(x0, y1), (x1, _) = boxes[ax_index] # y1 -> bottom of upper axes
y0 = boxes[ax_index+1][1][1] # y0 -> top of lower axes
y = y0 + (y1 - y0)/2.0 # halfway in between the two axes
dict(arrowstyle='-', facecolor=color, edgecolor=color)
ax.annotate('', xy=(x0*0.3, y), xytext=(x1*1.01, y),
  arrowprops=arrowprops, xycoords=coords,
textcoords=coords)
return

group_axes(f, do_lines_after, 'red', 'figure pixels')
group_axes(f, do_lines_after, 'green', 'figure points')
f.canvas.draw() # pixels/red look good, green notsomuch
f.savefig('test.png') # green in the same place; red is somewhere else now
(based on dpi?)
--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] trouble with Wt argument of matplotlib.mlab.PCA

2012-06-11 Thread Justin R
operating system Windows 7
matplotlib version : 1.1.0
obtained from sourceforge

the class seems to generate the same Wt matrix for every input. The
every element of the weight matrix is either +sqrt(1/2) or -sqrt(1/2).

dat1 = 4*np.random.randn(200,1) + 2
dat2 = dat1*.25 + 1*np.random.randn(200,1)
pcaObj1 = PCA(np.hstack((dat1,dat2)))
print pcaObj1.Wt

dat3 = 2*np.random.randn(200,1) + 2
dat4 = dat3*2 + 3*np.random.randn(200,1)
pcaObj2 = PCA(np.hstack((dat1,dat2)))
print pcaObj2.Wt

The output Y seems to be correct, and the projection function works.
only the Wt matrix seems to be messed up. Am I using this class
incorrectly, or could this be a bug?
thanks,
Justin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Labeling/distinguishing lots of curves on a single plot

2010-08-23 Thread Justin McCann
Here are a couple of functions you might try, with a few colors and line
styles I use:


import itertools
from pylab import *

COLORS = ['#990033', '#FF', '#00FF00', '#F79E00',
  '#ff00ff', '#0080FF', '#FF', '#2D0668',
  '#2EB42E', '#ff6633', '#8000ff', '#33',
  '#cc0077', '#099499', '#996633', '#00']

def new_stylecolor_iter():
## Use these to alternate markers, or use all the styles.
## Combine them into the call to 'itertools.product' and
## then add the appropriate kwargs to the call to 'plot'
#markers = itertools.cycle(lines.Line2D.markers.keys())
#styles = itertools.cycle(lines.Line2D.lineStyles.keys())
## alternate colors first, line styles second
sc = itertools.product(['-', ':', '--', '-.'], COLORS)
return sc

def line_plot_alternate():
sc = new_stylecolor_iter()
for i in xrange(0,40):
style, color = sc.next()
plot(xrange(0,20), randn(20), label=str(i), linewidth=3,
linestyle=style, color=color)
legend()

if __name__ == "__main__":
line_plot_alternate()
show()




On Mon, Aug 23, 2010 at 3:06 PM, John Salvatier
wrote:

> Hello,
>
> I have a plot with lots of curves on it (say 30), and I would like to have
> some way of distinguishing the curves from each other. Just plotting them
> works well for a few curves because they come out as different colors unless
> you specify otherwise, but if you do too many you start getting repeats is
> there a way to have matplotlib also vary the line style that it
> automatically assigns? Or perhaps someone has another way of distinguishing
> lots of curves?
>
> Best Regards,
> John
>
>
>
> --
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ImportError: No module named _path

2010-09-23 Thread Justin Park
Hello,

I am using Mac 10.5.8.

I have been trying to install Matplotlib, and succeeded to do so.
But when I try to import matplotlib.pyplot, I got the following error:

>>> import matplotlib.pyplot
Traceback (most recent call last):
  File "", line 1, in 
  File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/pyplot.py",
line 23, in 
from matplotlib.figure import Figure, figaspect
  File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/figure.py",
line 16, in 
import artist
  File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/artist.py",
line 6, in 
from transforms import Bbox, IdentityTransform, TransformedBbox,
TransformedPath
  File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/transforms.py",
line 34, in 
from matplotlib._path import affine_transform
ImportError: No module named _path

Could you please let me know how I can fix this problem?
I tried several ways of reinstalling it(after cleaning as described in
many web-sites), but all the ways returned the same error.

Thanks,
Justin.

--
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Making room for tick labels

2010-09-29 Thread Justin McCann
Not to pile on the "auto-adjust to make labels fit" bandwagon, but
I've been following the FAQ on adjusting the subplot locations to make
room for too-long tick labels:

   
http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels

and have found that the FAQ code isn't very robust.

For example, if I interactively change the size of the plotting window
so the ylabels touch the left hand side of the window, stretching it
right again pushes the labels and the subplots too far to the right
(see attached 'auto_subplot_adjust.toofar.png').

If I make the window too narrow so the figure itself shrinks too much,
it starts to raise 'ValueError: left cannot be >= right' exceptions,
and then really shrinks the plot even more (see attached
'auto_subplot_adjust.leftright.png').

Any suggestions for making this more robust?

 Justin
<><>--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Making room for tick labels

2010-09-30 Thread Justin McCann
On Wed, Sep 29, 2010 at 9:58 PM, Jason Grout
 wrote:
>...
> I made the FAQ entry code a little more general (and hopefully more
> robust) a while ago.  I don't know if it takes care of the problem
> you're talking about, though.
>
> I posted it to the matplotlib-devel mailing list here:
>
> http://www.mail-archive.com/matplotlib-de...@lists.sourceforge.net/msg05628.html

Thanks, Jason. I tried it out, and it has the same issues.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Compilation Error

2010-10-04 Thread Justin McCann
On Mon, Oct 4, 2010 at 4:50 PM, Sanjay Kairam  wrote:
> Hi there,
>
> I'm having a problem installing matplotlib, I'm guessing that I am missing
> some dependency, but I am having trouble figuring out what the issue is (I
>...
> REQUIRED DEPENDENCIES
>  numpy: 1.5.0
>  freetype2: found, but unknown version (no pkg-config)
>     * WARNING: Could not find 'freetype2' headers in any
>     * of '.', './freetype2'.
>...
> /usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for
> Intel with Mac OS X Deployment Target < 10.4 is invalid.
> In file included from src/ft2font.cpp:1:
> src/ft2font.h:14:22: error: ft2build.h: No such file or directory
> src/ft2font.h:15:10: error: #include expects "FILENAME" or 
>...

You're missing the freetype2 library, or the build scripts can't find
it. You can install freetype2 using macports (www.macports.org), or if
you've done that already you can tell the build scripts where to find
it by specifying the PKG_CONFIG_PATH.

PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
python setup.py build

Macports installs into /opt/local by default, so that will tell the
build script to look there first.

Back when I installed everything, the default Python build on OS X was
32-bit, so I compiled a 64-bit Python "framework" version myself. That
may have been fixed already, so you may not want/need to do that. If
you do build your own, don't overwrite the /System/ version; put your
custom version into /Library/Frameworks/Python.framework/ and point to
that for your scripts.

hth,
   Justin

--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Vlines across multiple subplots

2010-10-07 Thread Justin McCann
I have several heatmap images, which I place in subplots stacked vertically.
I've been using
   ax = figure.add_subplot(nplots, 1, plotnum)
   ax.imshow(...)

to add each subsequent heatmap, and then place
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Vlines across multiple subplots

2010-10-07 Thread Justin McCann
Sorry about that; don't know what key combo I pushed. Completed email is
below.

On Thu, Oct 7, 2010 at 3:09 PM, Justin McCann  wrote:

> I have several heatmap images, which I place in subplots stacked
> vertically. I've been using
>ax = figure.add_subplot(nplots, 1, plotnum)
>ax.imshow(...)
>
to add each subsequent heatmap, and then place a colorbar as another
subplot. I'd like to annotate across all of the subplots by placing a
vertical line (or vspan) across the entire figure-- to extend from the
bottom figure all the way to the top, including the spaces in between. I
thought I had seen an example of this somewhere, but couldn't find it in the
gallery. Any suggestions?

Thanks,
   Justin
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Vlines across multiple subplots

2010-10-07 Thread Justin McCann
On Thu, Oct 7, 2010 at 4:08 PM, Benjamin Root  wrote:

> ...
>> On Thu, Oct 7, 2010 at 3:09 PM, Justin McCann  wrote:
>>
>>> ...
>>
>> I'd like to annotate across all of the subplots by placing a vertical line
>>> (or vspan) across the entire figure-- to extend from the bottom figure all
>>> the way to the top, including the spaces in between. I thought I had seen an
>>> example of this somewhere, but couldn't find it in the gallery. Any
>>> suggestions?
>>
>>
>> You are right, I could have sworn I seen an example of that somewhere, but
> this is the best I could find:
>
>
> http://matplotlib.sourceforge.net/users/annotations_guide.html?highlight=annotation#using-connectorpatch
>
>
That works; thanks for the pointer.
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Xtick label size in ImageGrid

2010-10-08 Thread Justin McCann
I just refactored some custom code to make use of
axes_grid1.ImageGrid, and I think I've come across a bug (see below).
It looks like the tick labelsize doesn't get passed properly to the
parasite axes.

I'm using Python2.6, matplotlib-1.0.0 release, and the Qt4Agg backend.

Also, I noticed that the Grid.__init__ super-class constructor isn't
called in the ImageGrid.__init__ constructor; should it be?

By way of feature request, I'd prefer to be able to specify share_x
and share_y in the constructor, but that's not available in ImageGrid,
only in Grid.

If there's agreement that this is bug, I'll file it on the sourceforge
tracker. Is this fixed in SVN, or does anyone have workaround, e.g.,
some way to convert 'x-small' to the correct integer size, or a
different method to call?

Thanks,
Justin


from mpl_toolkits.axes_grid1 import ImageGrid
import pylab
import numpy
row_height = 10
fi = pylab.figure()
grid = ImageGrid(fi, 111, nrows_ncols=(5,1), share_all=False, label_mode='l')
for i in range(5):
a = abs(numpy.random.randn(5,100))
im = grid[i].imshow(a)

cb = grid.cbar_axes[0].colorbar(im)
for ax in grid.axes_all:
ax.set_yticks([])

# oops - this only changes the lowest Axes formatting
grid.axes_llc.tick_params(direction='out', labelsize='x-small')
pylab.show()
# Now pan to the left a bit-- you'll see the large 0 from the 100 xtick_label

# Let's try explicitly setting all of the xtick sizes. Kablooie.
for ax in grid.axes_all:
    ax.tick_params(direction='out', labelsize='x-small')


---
TypeError                                 Traceback (most recent call last)
/tmp/ in ()
.../matplotlib/axes.pyc in tick_params(self, axis, **kwargs)
   2215             xkw.pop('labelleft', None)
   2216             xkw.pop('labelright', None)
-> 2217             self.xaxis.set_tick_params(**xkw)
   2218         if axis in ['y', 'both']:
   2219             ykw = dict(kwargs)
.../matplotlib/axis.pyc in set_tick_params(self, which, reset, **kw)
    795             if which == 'major' or which == 'both':
    796                  for tick in self.majorTicks:
--> 797                     tick._apply_params(**self._major_tick_kw)
    798             if which == 'minor' or which == 'both':
    799                  for tick in self.minorTicks:
.../matplotlib/axis.pyc in _apply_params(self, **kw)
    274         if dirpad:
    275             self._base_pad = kw.pop('pad', self._base_pad)
--> 276             self.apply_tickdir(kw.pop('tickdir', self._tickdir))
    277             trans = self._get_text1_transform()[0]
    278             self.label1.set_transform(trans)
.../matplotlib/axis.pyc in apply_tickdir(self, tickdir)
    331         else:
    332             self._tickmarkers = (mlines.TICKDOWN, mlines.TICKUP)
--> 333             self._pad = self._base_pad + self._size
    334
    335
TypeError: unsupported operand type(s) for +: 'int' and 'str'

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to adjust position of axis labels in 3D plots

2010-10-12 Thread Justin Bois
I am preparing 3D plots and have found that the default axis labels are too
close to the tick labels, especially when large font sizes are chosen.  As
such, I would like to specify the position of the axis label.
Unfortunately, I haven't met much success.  See the code below (based on one
of the mplot3d examples).  Does anyone have any tips on how to move the axis
labels further away from the axis in 3D plots?

Thanks,
Justin

from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5)
ax.set_xlabel('x')

# This doesn't work:
ax.w_xaxis.set_label_coords(-0.2, -0.2)

# This doesn't work either:
# ax.w_xaxis.label.set_position((-0.2, -0.2))

# The axis label positions appear to have changed, but not in figure
print ax.w_xaxis.label.get_position()

plt.show()
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Xtick label size in ImageGrid

2010-10-19 Thread Justin McCann
On Fri, Oct 8, 2010 at 11:10 PM, Jae-Joon Lee  wrote:
> The label_mode need to be capital "L", instead of "l". I guess this
> will fix your first problem.
> While we make "l" same as "L", but I think it actually degrade the
> readability of the code, and I;m inclined to leave it as is. Let me
> know if you have any suggestions though.

Sorry for the delayed response, but I've been trying to think of a
decent suggestion.

The capital "L" fixed the problem with the extra xticks. I had
completely misread it; I was trying to label the lower-left axes only
with a lower-case "L" ("l") and really needed a one ("1").

How about "bottom" instead of "L", and "lower left" instead of "1"?
You might consider using the "bottom", "lower left", "top", ...
pattern if you want to support other locations.

 Justin

--
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How should I plot clustered data?

2010-11-04 Thread Justin McCann
On Wed, Nov 3, 2010 at 1:18 AM, David Frey  wrote:
> ...
> My data in the y-axis (address space usage) is fairly uniform (0-2000 MB
> values), but my data in the x-axis (the time at which the the trace statements
> were executed) is highly clustered.  For example, I have approximately 150
> data points over a 5 minute run, but some of the data points are only 10ms
> apart.
>
> I would like to annotate each point on the graph with the line number in the
> log file so that the user can look up what was happening at that point.  I 
> have
> succeeded, but the graph isn't readable because there is so much overlap in
> the points.

You might want to create multiple subplots, with some of the
subplots/axes zoomed in on the main axes. See this example:
   
http://matplotlib.sourceforge.net/examples/pylab_examples/axes_zoom_effect.html

It looks like the image isn't on the website. You can run the example
on your local machine by saving it from the [source code] link at the
top of the page.

That seems to work well if you know in advance how many zoom areas you
want, or are working with it interactively.

If you want to auto-generate the whole figure, you might want to try
something like this:
  - figure out how many zoom regions you need (e.g., by figuring out
how many clusters you have)
  - use figure.add_subplot() or axes_grid1
(http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html)
to place all of your separate axes
  - plot the main figure and all of the zoom regions

BTW, if the "axes_zoom_effect" image could be added to the gallery,
it's the example I was thinking about in the "Vlines across multiple
subplots" thread:
 http://permalink.gmane.org/gmane.comp.python.matplotlib.general/24999

Hope that helps,
 Justin

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Limit legend to visible data

2010-12-01 Thread Justin McCann
Is there a straightforward way to limit the legend only to lines that
appear within the current display limits? I have a plot that has too
many separate data series to show on the legend at once, but once I
zoom in it would be good to re-set the legend to show only the visible
data points/lines.

I guess the way to do that is:

- catch the DrawEvent
- call get_xlim() and get_ylim() to get the new bounds
- figure out which lines are within the bounds and add them to a new
legend. I could run through each line and compare xlim/ylim with
line.get_xydata(); is there already a function to do this?

Thanks for your help,
Justin

--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Limit legend to visible data

2010-12-03 Thread Justin McCann
On Wed, Dec 1, 2010 at 11:58 AM, Justin McCann  wrote:
> Is there a straightforward way to limit the legend only to lines that
> appear within the current display limits? I have a plot that has too
> many separate data series to show on the legend at once, but once I
> zoom in it would be good to re-set the legend to show only the visible
> data points/lines.
>
> I guess the way to do that is:
>
> - catch the DrawEvent
> - call get_xlim() and get_ylim() to get the new bounds
> - figure out which lines are within the bounds and add them to a new
> legend. I could run through each line and compare xlim/ylim with
> line.get_xydata(); is there already a function to do this?

This seems to do the trick, but might be a bit too clever. I'm not
sure if get_children() (or findobjs) is the right call to retrieve all
the plot elements.


def add_legend_viewlim(ax, fontsize='xx-small', **kwargs):
"""Reset the legend in ax to only display lines that are currenlty
visible"""
label_objs = []
label_texts = []
font = matplotlib.font_manager.FontProperties(size=fontsize);
for obj in ax.get_children():
if not hasattr(obj, 'get_xydata'): continue
if ax.viewLim.overlaps(matplotlib.transforms.Bbox(obj.get_xydata())):
label = obj.get_label()
if (label is not None) and (label != ''):
label_objs.append(obj)
label_texts.append(label)
leg = ax.legend(label_objs, label_texts, prop=font, **kwargs)
return leg

--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Drawing on plots

2011-05-02 Thread Justin McCann
You'll want to use event handling to figure out where the user clicked, and
then you have a couple of options: Axes.vlines(), or pylab.axvline(). It
seems like pylab.axvline() will always span the entire y-axis by default,
but with Axes.vlines() you need to specify the ymin/ymax. Maybe someone else
knows of an argument to pass to Axes.vlines() that will always span the
entire y-axis.

Here's the code (assuming 'ipython -pylab'):


fig = figure()
plot([1,2,3,4], [5,6,7,8])

def onclick(event):
"""Draw a vertical line spanning the axes every time the user clicks
inside them"""
if event.inaxes: # make sure the click was within a set of axes
pylab.axvline(event.xdata, axes=event.inaxes, color='r',
linestyle=':') # red dotted line
event.inaxes.figure.canvas.draw() # force a re-draw

cid = fig.canvas.mpl_connect('button_press_event', onclick) # add the click
handler

... interact with it

fig.canvas.mpl_disconnect(cid) # get rid of the click-handler


Docs:
Axes.vlines():
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.vlines
pyplot.axvline():
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axvline

Event handling: http://matplotlib.sourceforge.net/users/event_handling.html
Example:
http://matplotlib.sourceforge.net/examples/event_handling/data_browser.html

   Justin

On Mon, May 2, 2011 at 10:08 AM, Soumyaroop Roy wrote:

> Any pointers on this?
>
> On Sat, Apr 30, 2011 at 12:34 AM, Soumyaroop Roy  > wrote:
>
>> Hi there:
>>
>> I have an x-y plot and I want to draw a vertical marker (an x=c line) on
>> the plot on a mouse click.
>>
>> How should I approach it?
>>
>> regards,
>> Soumyaroop
>>
>
>
>
> --
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc

2011-05-11 Thread Justin McCann
On Wed, May 11, 2011 at 1:59 PM, Benjamin Root  wrote:

> ...
> Most things, we do know the sizes of.  It is my understanding that it is
> the text objects that is the unknown.  If this could be solved, then a
> layout engine would be much more feasible.  The problem is that even LaTeX
> has to re-render things multiple times to get this right for an arbitrary
> font.  If we were to restrict ourselves to particular fonts and package
> those fonts with matplotlib, then we could have an internal table of size
> information for each glyph and compute it on the fly and lay everything out
> right.  But, that would cause us to give up significant benefits for another
> benefit.
> ...
>

I suppose a compromise would be to have that internal table for a fixed set
of fonts, and if the user asks for a font that's not shipped with
matplotlib, then they fall back to the current (presumably slower) method.
Would probably complicate things in the layout code, though.

  Justin
--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] show density in scatter

2011-05-18 Thread Justin McCann
On Wed, May 18, 2011 at 3:01 PM, Neal Becker  wrote:

> Using scatter, it seems less probably (numerous) points show just as much
> as
> more probable points.  Can anyone suggest a good way to emphasize the more
> probable points?
>
> I was thinking maybe the easy way is just scale down the markers.  Drawback
> may
> be too many points plotted.
>
> Colors would be nice, but I guess that would be more work?
>
>
You could try something like the scatter+histograms shown here:

http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html

Takes a bit more space, but the colors aren't as important.
--
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] remove white area around

2011-06-14 Thread Justin McCann
On Mon, Jun 13, 2011 at 8:37 AM, Andrea Crotti wrote:

>
> I found this question asked other times, but trying myself there is no
> way that I get something working..
>
> So I just want to generate a pdf from a plot with the smallest possible
> margin, and I was trying for example this:
>
>fig = plt.figure(1)
>fig.frameon = False
>plt.plot(range(10), range(10))
>plt.savefig('prova1.pdf')
>
> But the margin is still all there..
> Am I missing something?
>
> Try this:

ax = gca()  # get the current axes
# fill the whole figure area from (0,0) to (1,1)
# units are in proportion to the figure
ax.set_position((0,0,1,1))
--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] is a changing background color possible?

2011-06-21 Thread Justin McCann
On Tue, Jun 21, 2011 at 1:50 PM, Frank  wrote:
> matplotlib python: How do you change the background color of a line plot
> according to a given column? Say I have the following data file
>...
> 2. 1
> 3. 1
> 3. 2
>
> The first column represents the y-values, and the 2nd column should control
> the background color. Say, it plots the (black) line on a white-gray
> alternating background (zebra-like) as proceeding further in x-direction,
> where the transition in color occurs anytime the integer in the 2nd column
> increments. Or other possible solution: Use 2nd column as function argument
> to determine background color.
>
> How would one do this with matlibplot?

You can use axvspan (see below). You'll need to track where the 2nd
column changes, and then use axvspan to make a colored fill between
(x-1, x). Make sure you pass in a low (< 0) zorder number to the
axvspan function so it stays in the background.

pyplot function:
   
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axvspan

Axes method:
  
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.axvspan

Hope that helps,
Justin

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question on LineCollection

2011-07-13 Thread Justin McCann
2011/7/13 SULSEUNG-JIN :
> Hi,
>
> I'm plotting thousands of short lines on a plot. Because "plot" and "Line2D"
> are quite slow for this case, I'm trying to use lineCollection. Here comes
> the part of my testing code:
>
>     ...
>     segs = []
>
>     # Manual set for testing
>     x2 = np.zeros(2,dtype=int)
>     ys2 = [np.zeros(2,dtype=float)]
>     x2[0] = 100
>     x2[1] = 200
>     ys2[0][0] = ys2[0][1] = 50
>     segs.extend( [zip(x2,y) for y in ys2] )
>
>     for i in range(0, len(records)):
>     ...
>     # get xStart, xEnd, and y
>     ...
>
>     x2[0] = xStart
>     x2[1] = xEnd
>     ys2[0][0] = ys2[0][1] = y
>     segs.extend( [zip(x2,y) for y in ys2] )
>
>     line_segments = LineCollection(segs, linewidth=4, alpha=0.3, colors =
> 'r', linestyle = 'solid')
>     ax.add_collection(line_segments)
>     ...
>
> The problem I have is only the first segment of the lines in the "segs"
> which I manually set the values is shown in the plot. If I move the first
> part in the for loop to test, it works. What am I missing?
>
> Thank you in advance.

Are you sure it's the first segment that shows up, and not the last one?

You're reusing the numpy array x2 and the list ys2. You're overwriting
the values inside them each time through the for loop, but segs just
contains len(records) references to the exact same arrays in memory
(x2 and ys2).

The reason it works if you move the first part inside is that it
creates a new numpy.array x2 and a new python list ys2 each time then,
which is what you want.

 Justin

--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question on LineCollection

2011-07-13 Thread Justin McCann
2011/7/13 SULSEUNG-JIN :
> Thanks, Justin
>
> I think I made a confusing example code. Here comes new one:

Maybe you just need to force a call to draw() and set your x/y limits.
This works for me on matplotlib 1.0.1

$ ipython -pylab
# 
from matplotlib.collections import LineCollection
f = figure()
plot()
ax = gca()
vec = numpy.random.random((10,3))
segs = []
for i in range(0, len(vec)):
x1 = vec[i][0]
#x1 = 300
x2 = vec[i][1]
#x2 = 400
y1 = y2 = vec[i][2]
segs.extend( [[(x1,y1),(x2,y2)]] )

line_segments = LineCollection(segs, linewidth=3, alpha=0.3, colors =
'r', linestyle = 'solid')
ax.add_collection(line_segments)
ax.set_xlim(0,1)
ax.set_ylim(0,1)
show() # h... nothing yet
draw() # force a draw; now it works

--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question on LineCollection

2011-07-14 Thread Justin McCann
On Wed, Jul 13, 2011 at 6:49 PM, Benjamin Root  wrote:
> On Wednesday, July 13, 2011, Justin McCann  wrote:
>> $ ipython -pylab
>> # 
>> from matplotlib.collections import LineCollection
>> f = figure()
>> plot()
>> ax = gca()
>> vec = numpy.random.random((10,3))
>> segs = []
>> for i in range(0, len(vec)):
>>     x1 = vec[i][0]
>>     #x1 = 300
>>     x2 = vec[i][1]
>>     #x2 = 400
>>     y1 = y2 = vec[i][2]
>>     segs.extend( [[(x1,y1),(x2,y2)]] )
>>
>> line_segments = LineCollection(segs, linewidth=3, alpha=0.3, colors =
>> 'r', linestyle = 'solid')
>> ax.add_collection(line_segments)
>> ax.set_xlim(0,1)
>> ax.set_ylim(0,1)
>> show() # h... nothing yet
>> draw() # force a draw; now it works
>>
...
> Just an observation (I haven't tested anything)... But what is up with
> the call to plot()?  It might be causing issues with the autoscaler.
> Any line collections created without other plotting functions is going
> to need the axes limits set.
>
> Ben Root
>

Yeah, that was weird. :)

I added that when I was first messing around, and the axes didn't show
up even when I called show(). If you do the draw() at the end, then
you don't need to call plot(), and then you also don't need to mess
with the view limits (set_{x,y}lim).

I guess the moral of the story is, "if you don't explicitly plot() [or
a variant], you must explicitly draw()."

===
from matplotlib.collections import LineCollection
f = figure()
ax = gca()
vec = numpy.random.random((10,3))
segs = []
for i in range(0, len(vec)):
   x1 = vec[i][0]
   x2 = vec[i][1]
   y1 = y2 = vec[i][2]
   segs.extend( [[(x1,y1),(x2,y2)]] )

line_segments = LineCollection(segs, linewidth=3, alpha=0.3,
colors='r', linestyle='solid')
ax.add_collection(line_segments)
draw() # force a draw; now it works


--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] change background

2011-07-14 Thread Justin McCann
On Thu, Jul 14, 2011 at 3:57 PM, T. Tofus von Blisstein
 wrote:
> Hi,
>
> how can I invert the colors of axes/background from black/white to 
> white/black?
>
> thanks... I have been googling for a while...

If you want to do it for all your plots, you can mess with all of the
'color*' settings in the .matplotlibrc file:
   
http://matplotlib.sourceforge.net/users/customizing.html#the-matplotlibrc-file

There are plenty of colors to change (font, line, axes, figure, patch,
etc), so just grep through there. You'll probably want to change the
color_cycle list.

To do the same thing at runtime, play around with matplotlib.rc(),
passing in the ones you'd change from above:
   
http://matplotlib.sourceforge.net/api/matplotlib_configuration_api.html#matplotlib.rc

Then you can reset it using rcdefaults():
   
http://matplotlib.sourceforge.net/api/matplotlib_configuration_api.html#matplotlib.rcdefaults

If you don't like those approaches, you can specify the color for
about everything using keyword arguments as you create the figure,
axes, etc (using the object-oriented API), or call plot(), subplot(),
etc (using the interactive pylab API). Try help(figure) and
help(colors) for some examples.

Hope that helps,
Justin

--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Trouble installing matplotlib

2008-09-29 Thread Clement Justin Poh
Hi people,

I'm new to unix, python and matplotlib. I've had trouble installing matplotlib. 
The machine I'm on is running solaris. I tried installing it on my friend's 
ubuntu box and it worked basically immediately. After some effort I managed to 
get it to compile and install on solaris.

In python as root when I type "from pylab import *" I get this error:
=
ImportError: ld.so.1: python: fatal: relocation error: file 
/opt/csw/lib/python/site-packages/matplotlib/_path.so: symbol __1c2N6FI_pv_: 
referenced symbol not found
=
As my normal account I get this:
=
Traceback (most recent call last):
  File "test.py", line 1, in 
from pylab import *
  File "/opt/csw/lib/python/site-packages/pylab.py", line 1, in 
from matplotlib.pylab import *
  File "/opt/csw/lib/python/site-packages/matplotlib/__init__.py", line 677, in 

rcParams = rc_params()
  File "/opt/csw/lib/python/site-packages/matplotlib/__init__.py", line 598, in 
rc_params
fname = matplotlib_fname()
  File "/opt/csw/lib/python/site-packages/matplotlib/__init__.py", line 548, in 
matplotlib_fname
fname = os.path.join(get_configdir(), 'matplotlibrc')
  File "/opt/csw/lib/python/site-packages/matplotlib/__init__.py", line 242, in 
wrapper
ret = func(*args, **kwargs)
  File "/opt/csw/lib/python/site-packages/matplotlib/__init__.py", line 435, in 
_get_configdir
raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib 
to be a writable dir.  You can also set environment variable MPLCONFIGDIR to 
any writable directory where you want matplotlib data stored "% (h, h))
RuntimeError: '/local/host/home/mctran' is not a writable dir; you must set 
/local/host/home/mctran/.matplotlib to be a writable dir.  You can also set 
environment variable MPLCONFIGDIR to any writable directory where you want 
matplotlib data stored
=
when I tried to set MPLCONFIGDIR to a directory, I got the earlier error. I 
tried recompiling and reinstalling to no avail.

I searched on the mailing list for anything like this, but there were no hits. 
Any ideas how I can fix this?
-
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users