Re: [Matplotlib-users] Two circles with “exponential decay” coloring, and alpha < 1, having trouble with color mixing?

2015-11-23 Thread Sterling Smith
Maybe the issue is with the colormap not having an alpha?  Does this
http://stackoverflow.com/questions/10127284/overlay-imshow-plots-in-matplotlib
help?

Otherwise, you might file a bug at 
https://github.com/matplotlib/matplotlib/issues/new

-Sterling

On Nov 20, 2015, at 4:46PM, Brian Merchant  wrote:

> Hi all, 
> 
> In order to get circles such that their coloring is radially symmetric, with 
> center being the darkest, and exponential decay in color as one moves farther 
> away from the center along the radius, I used imshow with clip_path using 
> Circle patches. 
> 
> Here's a toy script that overlaps two such circles: 
> https://gist.github.com/bmer/7063cc2dd09f1b80a252
> 
> As you can see if you run the script (or, if you follow this link: 
> http://i.imgur.com/H9jEAZ3.png), even though the alpha is set at 0.5, there 
> doesn't seem to be proper "color mixing" occurring (we should see a result 
> that is symmetric along the x-axis). 
> 
> Why is that, and what could I do to fix this issue? 
> 
> Kind regards, 
> Brian
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551=/4140
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug report

2015-09-16 Thread Sterling Smith
Works fine for

{{{
 : python 
Python 2.7.10 (default, Sep 15 2015, 11:26:42) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
/Users/smithsp/.pyhistory
>>> import matplotlib
>>> matplotlib.__version__
'1.4.3'
>>> import numpy
>>> numpy.__version__
'1.9.2'
>>> matplotlib.get_backend()
u’MacOSX'
}}}

All are obtained through MacPorts on OSX 10.9.5.

-Sterling



On Sep 16, 2015, at 6:50AM, Benjamin Root  wrote:

> Btw, I can't reproduce the problem using matplotlib master, numpy master and 
> linux. I know it isn't at all similar to your setup, but it is a data point.
> 
> On Wed, Sep 16, 2015 at 9:43 AM, Benjamin Root  wrote:
> What version of numpy do you have installed?
> 
> On Wed, Sep 16, 2015 at 5:35 AM, Bobby Wilkins  
> wrote:
> OS: Windows 8.1 Pro
> 
> matplotlib version: 1.4.3
> 
> where obtained: http://www.lfd.uci.edu/~gohlke/pythonlibs/
> 
> customizations: none
> 
> Sample Program: attached py file; this is a Physics homework problem; I have 
> the answers I need, but would like to fix the errors to be able to label all 
> lines.
> 
> Debug output in attached output.txt file
> 
> If you uncomment line 180, the error is reported as if it came from that line 
> even though there is no float64 on that line (savefig).  If commented, it 
> does not report a line from my .py file...
> 
> If you make line 170 read as follows, the error goes away:
> 
> if (maxTerm<32):
> 
> This suggests to me that the additional labels for the 32, 64, 128, and 154 
> term runs is what is triggering the bug, but I cannot figure out what it is. 
> 
> Also, separate note, just about any time I make figures, when closing the 
> last figure I get a python.exe app crash and this message:
> 
> alloc: invalid block: 044E7680: 0 d
> 
> 
> Thank you for any help,
> Bobby
> 
> 
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> 
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Shadows are really large in exported PNG file

2015-09-03 Thread Sterling Smith
For those who wonder what he means: 

on the left is TkAgg; on the right is png.

-Sterling

On Sep 3, 2015, at 1:13PM, Richard Stanton  wrote:

> A quick follow-up: if I export to a jpg file, I get the same huge shadow. If 
> I export to a PDF file, the shadow looks much more like it does on the screen.
> 
> 
>> On Sep 3, 2015, at 1:07 PM, Richard Stanton  
>> wrote:
>> 
>> I’m trying to create a pie chart for a presentation. If I turn on shadows, 
>> they look fine on the screen (in an IPython notebook), but when I export the 
>> file to a PNG file, the shadow is way larger, and looks pretty ugly. Is this 
>> a bug? And is there a way to shrink the size of the shadow? 
>> 
>> Here’s some sample code that shows the problem:
>> 
>> import matplotlib.pyplot as plt
>> numbers = [4380.0, 2474.0, 158]
>> explode=(0, 0, 0.5)
>> plt.pie(numbers, explode=explode,shadow=True)
>> plt.axis('equal')
>> plt.savefig(‘grap.png’, dpi=400)
>> 
>> Thanks for any suggestions.
>> 
>> By the way, I’m using Matplotlib version 1.4.3 with the Anaconda 
>> distribution under OS X.
>> 
>> Richard Stanton
> 
> 
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] background color of text plots as foreground

2015-07-09 Thread Sterling Smith
Works for me with TkAgg backend on 1.4.3.

-Sterling

On Jul 9, 2015, at 3:52AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,
 
 I am trying to set the backgroundcolor of a textbox:
 
 from pylab import *
 plot([1, 2, 3])
 text(1, 2, 'Hello', backgroundcolor = 'red')
 
 This plots a nice red box but no text. It looks like the backgroundcolor is 
 set as the foreground. Am I doing something wrong or is this a bug? mpl 
 version 1.4.3
 
 Thanks, Mark
 
 --
 Don't Limit Your Business. Reach for the Cloud.
 GigeNET's Cloud Solutions provide you with the tools and support that
 you need to offload your IT needs and focus on growing your business.
 Configured For All Businesses. Start Your Cloud Today.
 https://www.gigenetcloud.com/___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to visualize a, b results of x, y variables

2015-07-08 Thread Sterling Smith
In the x,y plane, could you overlay contours of a with contours of b?
-Sterling

On Jul 8, 2015, at 8:19PM, Jonno jonnojohn...@gmail.com wrote:

 I have a bunch of experimental data points each of which has 2 variables 
 (x,y) and 2 results (a,b). Each pair or x,y values produces a pair of a,b 
 resultant values.
 There is a single optimal pair of a,b values and I'd like to figure out a way 
 to illustrate the data to show the relationship between each x,y pair and how 
 close each a,b pair is to the ideal.
 I'm thinking about a dual surface/contour plot with 2 different z-axes. 
 Ideally I would center both z-axes at the ideal values. I don't know if this 
 is possible. Might be kinda messy.
 
 Any other thoughts? I'm sure there must be other examples where this is a 
 problem.
 --
 Don't Limit Your Business. Reach for the Cloud.
 GigeNET's Cloud Solutions provide you with the tools and support that
 you need to offload your IT needs and focus on growing your business.
 Configured For All Businesses. Start Your Cloud Today.
 https://www.gigenetcloud.com/___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Use _cntr.so in fortran?

2015-06-25 Thread Sterling Smith
The contour finder in matplotlib is more robust than I currently have in a 
legacy fortran project.  I would like to link to matplotlib’s instead.  Has 
anyone done this before?  Are there any suggestions or pitfalls for proceeding?

Thanks,
Sterling
--
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


Re: [Matplotlib-users] common text label on legend?

2015-06-10 Thread Sterling Smith
Neal,

legend[1] has the title keyword
legend(loc=‘best’,title=‘foo’)

-Sterling

[1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.legend
On Jun 10, 2015, at 11:36AM, Neal Becker ndbeck...@gmail.com wrote:

 Is there some way I can add a short text to the legend box?  Rather than 
 having
 label='foo=0'
 label='foo=1'
 ...
 
 I'd like to just put 'foo' say at the top of the legend box.  Any thoughts?
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] common text label on legend?

2015-06-10 Thread Sterling Smith
Neal,

If you also want to get rid of the lines, you could just color the texts of the 
legend labels using a VPacker in something like
http://stackoverflow.com/questions/17086847/box-around-text-in-matplotlib/17092777#17092777

-Sterling

On Jun 10, 2015, at 10:25PM, Sterling Smith smit...@fusion.gat.com wrote:

 Neal,
 
 legend[1] has the title keyword
 legend(loc=‘best’,title=‘foo’)
 
 -Sterling
 
 [1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.legend
 On Jun 10, 2015, at 11:36AM, Neal Becker ndbeck...@gmail.com wrote:
 
 Is there some way I can add a short text to the legend box?  Rather than 
 having
 label='foo=0'
 label='foo=1'
 ...
 
 I'd like to just put 'foo' say at the top of the legend box.  Any thoughts?
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Turning grid on

2015-06-01 Thread Sterling Smith
Stephen,

In your script, you give 
ax.minorticks_on
but you need to call that function for anything to occur
ax.minorticks_on()


Also, did you see
http://matplotlib.org/examples/pylab_examples/axes_props.html
in case your original question was not answered.

-Sterling

On Jun 1, 2015, at 1:24PM, step...@theboulets.net wrote:

 I only see that you added plt.show(), but neither the grid or the axis
 labels are showing up.
 
 Here is what I see with a couple of things modified ?
 did you expect something else ?
 
 from matplotlib.backends.backend_pdf import PdfPages
 import matplotlib.pyplot as plt
 import numpy as np
 
 fig = plt.figure()
 ax = fig.add_subplot(1,1,1)
 
 x = np.linspace(0,10,50)
 y = np.sin(x)
 
 with PdfPages('grid_test.pdf') as pdf:
plt.clf()
 
 plt.clf()
 plt.plot(x,y)
 leg = plt.legend(['legend 1'])
 plt.title('Sample title')
 ax.set_ylabel('Sample ylabel')
 ax.set_xlabel('Sample xlabel')
 
 ax.set_xticks(np.arange(0, 10, 20))
 ax.set_xticks(np.arange(0, 10, 5), minor=True)
 ax.set_yticks(np.arange(-1,1,20))
 ax.set_yticks(np.arange(-1,1,20), minor=True)
 
 ax.minorticks_on
 plt.show()
 
 pdf.savefig()
 
 
 [cid:8C80F2A2-AD50-4E09-B0EF-0596312F5093@ornl.gov]
 
 
 
 On Jun 1, 2015, at 2:49 PM,
 step...@theboulets.netmailto:step...@theboulets.net
 wrote:
 
 I am having an issue with the grid not appearing that I cannot figure out.
 Can anyone help? Thanks. --StephenB
 
 from matplotlib.backends.backend_pdf import PdfPages
 import matplotlib.pyplot as plt
 import numpy as np
 
 fig = plt.figure()
 ax = fig.add_subplot(1,1,1)
 
 x = np.linspace(0,10,50)
 y = np.sin(x)
 
 with PdfPages('grid_test.pdf') as pdf:
   plt.clf()
 
   plt.clf()
   plt.plot(x,y)
   leg = plt.legend(['legend 1'])
   plt.title('Sample title')
   ax.set_ylabel('Sample ylabel')
   ax.set_xlabel('Sample xlabel')
 
   ax.set_xticks(np.arange(0, 10, 20))
   ax.set_xticks(np.arange(0, 10, 5), minor=True)
   ax.set_yticks(np.arange(-1,1,20))
   ax.set_yticks(np.arange(-1,1,20), minor=True)
 
   ax.minorticks_on
 
   pdf.savefig()
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.netmailto:Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] stem plot with horizontal offset (BaseValue)

2015-03-31 Thread Sterling Smith
I’m not going to claim this is the final answer, but in the documentation for 
the stem function[1], it specifically says that the horizontal line is drawn at 
0.  

A workaround is to subtract the offset from your data, and relabel the axes….

[1]http://matplotlib.org/api/pyplot_api.html?highlight=stem#matplotlib.pyplot.stem
On Mar 31, 2015, at 11:31AM, ssinfod ssin...@gmail.com wrote:

 Hello, 
 
 I found this stem plot example:
 http://matplotlib.org/examples/pylab_examples/stem_plot.html
 
 I would like to add an horizontal offset to the step plot. (Ex: +2 on Y
 axis)
 What is the equivalent of the Matlab BaseValue offset in matplotlib.
 
 See Reference:
 http://www.mathworks.com/help/matlab/ref/stemseries-properties.html
 http://stackoverflow.com/questions/21913995/vertically-offset-stem-plot
 
 Thanks,
 ssinfod
 
 
 
 
 --
 View this message in context: 
 http://matplotlib.1069221.n5.nabble.com/stem-plot-with-horizontal-offset-BaseValue-tp45297.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Lorenz -- another Q

2015-03-12 Thread Sterling Smith
Prahas,

If I read it correctly, it looks like all of your x,y,z values are stored in 
x_t (and computed before plotting).  See 
http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html
to output these to a file, if so desired.

-Sterling

On Mar 11, 2015, at 8:07AM, Prahas David Nafissian prahas.mu...@gmail.com 
wrote:

 Hi,
 
 Given the Lorenz code shared yesterday, is there a way
 to generate a log file of the x,y,z points generated?
 
 Thanks in advance.
 
 --Prahas
 
 In case you deleted the code:
 
 
 import numpy as np
 from scipy import integrate
 
 from matplotlib import pyplot as plt
 from mpl_toolkits.mplot3d import Axes3D
 from matplotlib.colors import cnames
 from matplotlib import animation
 
 # orig value of N_traj was 20 -- very cool this way.
 
 N_trajectories = 1
 
 def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0):
Compute the time-derivative of a Lorentz system.
return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z]
 
 # Choose random starting points, uniformly distributed from -15 to 15
 
 np.random.seed(1)
 
 # changing from -15,30 to 10,5 below starts the drawing in the middle,
 # rather than getting the long line from below
 # if using N_Traj  1, return to orig values.
 
 # x0 = -15 + 30 * np.random.random((N_trajectories, 3))
 
 x0 = 10 + 5 * np.random.random((N_trajectories, 3))
 
 
 # Solve for the trajectories
 
 # orig values:  0,4,1000
 # 3rd value -- lower it, it gets choppier.
 # 2nd value -- increase it -- more points, but speedier.
 
 # change middle num from 4 to 15 -- this adds points
 
 t = np.linspace(0, 40, 3000)
 x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t)
  for x0i in x0])
 
 # Set up figure  3D axis for animation
 fig = plt.figure()
 ax = fig.add_axes([0, 0, 1, 1], projection='3d')
 
 # changing off to on below adds axises.  slows it down but you
 # can fix that with interval value in the animation call
 
 ax.axis('on')
 
 # choose a different color for each trajectory
 colors = plt.cm.jet(np.linspace(0, 1, N_trajectories))
 
 # set up lines and points -- this is a correction from
 # the orig jake code.  the next four lines...
 
 lines = [ax.plot([], [], [], '-', c=c)[0]
 for c in colors]
 pts = [ax.plot([], [], [], 'o', c=c)[0]
 for c in colors]
 
 # prepare the axes limits
 ax.set_xlim((-25, 25))
 ax.set_ylim((-35, 35))
 ax.set_zlim((5, 55))
 
 # set point-of-view: specified by (altitude degrees, azimuth degrees)
 ax.view_init(30, 0)
 
 # initialization function: plot the background of each frame
 def init():
for line, pt in zip(lines, pts):
line.set_data([], [])
line.set_3d_properties([])
 
pt.set_data([], [])
pt.set_3d_properties([])
return lines + pts
 
 # animation function.  This will be called sequentially with the frame number
 def animate(i):
# we'll step two time-steps per frame.  This leads to nice results.
 
i = (2 * i) % x_t.shape[1]
 
for line, pt, xi in zip(lines, pts, x_t):
x, y, z = xi[:i].T
line.set_data(x, y)
line.set_3d_properties(z)
 
pt.set_data(x[-1:], y[-1:])
pt.set_3d_properties(z[-1:])
 
# changed 0.3 to 0.05 below -- this slows the rotation of the view.
# changed 30 to 20 below
# changing 20 to (20 + (.1 * i)) rotates on the Z axis.  trippy.
 
ax.view_init(10, 0.1 * i)
# ax.view_init(10, 100)
fig.canvas.draw()
return lines + pts
 
 # instantiate the animator.  I've deleted the blit switch (for Mac)
 # enlarging frames=500 works now -- it failed before because I didn't give it
 # enough data -- by changing the t=np.linspace line above I generate
 more points.
 # interval larger slows it down
 # changed inteval from 30 to 200, frames from 500 to 3000
 
 anim = animation.FuncAnimation(fig, animate, init_func=init,
   frames=3000, interval=200)
 
 # Save as mp4. This requires mplayer or ffmpeg to be installed. COMPLEX!
 # Instead, use a screen record program:  Quicktime on the Mac; MS
 Expression Encoder on PC.
 # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec',
 'libx264'])
 
 plt.show()
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel 

Re: [Matplotlib-users] plt scale x-axis by constant factor f

2015-03-09 Thread Sterling Smith
That was untested.  It should start with (still untested)

x = array(range(len(array))

On Mar 9, 2015, at 11:11AM, Sterling Smith smit...@fusion.gat.com wrote:

 Christian,
 
 To define your x coordinate, try 
 x = range(len(array))
 x = x/10.
 plot(x,array)
 
 -Sterling
 
 On Mar 9, 2015, at 10:57AM, Christian Jorgensen chrisj...@gmail.com wrote:
 
 
 My array does not have an explicit x-coordinate
 representation. The x-coordinate is simply the index.
 
 print(array)
 [ 0  0 20 ...,  8  8  8]
 
 
 Thus what I would like is to adjoin the element
 index as another row, how is this possible?
 
 
 I cannot format x because it is not explicitly defined.
 
 
 
 On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Rootben.r...@ou.edu wrote:
 Ok, this really should be simple (and I am sure it is), but I cannot, for 
 the life of me, find the appropriate documentation for it. We need better 
 documentation about how to utilize the offset-text feature of tickers. It 
 can be either a multiple offset or an additive offset.
 
 In any case, I know there is a better way to do this, but here is a 
 quick-n-dirty example that can get you where you want. Just modify the 
 formatter used by the tickers to report the value as divided by 10.
 http://matplotlib.org/examples/pylab_examples/custom_ticker1.html
 
 Cheers!
 Ben Root
 
 
 On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensenchrisj...@gmail.com 
 wrote:
 How can I scale my x-axis [0,3000] for the data to now correspond/show up 
 as [0, 300]? 
 
 
 In xmgrace, this is done with a linear transformation, but I cannot seem 
 to find the command to do this with matplotlib. 
 
 Best 
 
 
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, 
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for 
 all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 
 -- 
 ___
 
 Christian Jørgensen
 
 
 
 -- 
 ___
 
 Christian Jørgensen
 --
 Dive into the World of Parallel Programming The Go Parallel Website, 
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for 
 all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. 
 http://goparallel.sourceforge.net/___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plt scale x-axis by constant factor f

2015-03-09 Thread Sterling Smith
Christian,

To define your x coordinate, try 
x = range(len(array))
x = x/10.
plot(x,array)

-Sterling

On Mar 9, 2015, at 10:57AM, Christian Jorgensen chrisj...@gmail.com wrote:

 
 My array does not have an explicit x-coordinate
 representation. The x-coordinate is simply the index.
 
 print(array)
 [ 0  0 20 ...,  8  8  8]
 
 
 Thus what I would like is to adjoin the element
 index as another row, how is this possible?
 
 
 I cannot format x because it is not explicitly defined.
 
 
 
 On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Rootben.r...@ou.edu wrote:
 Ok, this really should be simple (and I am sure it is), but I cannot, for the 
 life of me, find the appropriate documentation for it. We need better 
 documentation about how to utilize the offset-text feature of tickers. It can 
 be either a multiple offset or an additive offset.
 
 In any case, I know there is a better way to do this, but here is a 
 quick-n-dirty example that can get you where you want. Just modify the 
 formatter used by the tickers to report the value as divided by 10.
 http://matplotlib.org/examples/pylab_examples/custom_ticker1.html
 
 Cheers!
 Ben Root
 
 
 On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensenchrisj...@gmail.com 
 wrote:
 How can I scale my x-axis [0,3000] for the data to now correspond/show up 
 as [0, 300]? 
 
 
 In xmgrace, this is done with a linear transformation, but I cannot seem 
 to find the command to do this with matplotlib. 
 
 Best 
 
 
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 
 -- 
 ___
 
 Christian Jørgensen
 
 
 
 -- 
 ___
 
 Christian Jørgensen
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. 
 http://goparallel.sourceforge.net/___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bar Graph and X-axis data marks

2015-03-04 Thread Sterling Smith
Nertskull,

If no one responds, you might repost with some examples of what you’ve tried.  
I would suggest xticks and company, but I’m not sure if it works in your 
situation.

-Sterling

On Mar 4, 2015, at 6:20PM, Nertskull nertsk...@gmail.com wrote:

 I've searched and can't figure this out.
 
 And I'm not sure exactly the best way to do it.
 
 Basically, I'm trying to make a bar graph, and I have about 400 bars (so
 400 x-axis 'groups').
 
 When I plot it, I get every bar labelled, but that is too much to be
 seen. How do I make it so I only label every 10th bar, or every 50th bar?
 
 The data is ordered data, so it doesn't matter if many don't have a label.
 
 Thanks.
 
 
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to place an image colorbar next to the image when there are several subplots ?

2015-02-20 Thread Sterling Smith
Peter,

I think that you want
cax = ax1.imshow(…)
cbar = fig.colorbar(cax,ax=ax1) # Where the ax keyword tells the colorbar which 
axes to steal space from. [1]

If you want the colorbar to be to the right of the first axes, and have the 
second and third axes line up with the first, then you need to create your own 
axes instance [2] {cbarax = fig.add_axes([…]) } for the colorbar and give that 
instance to the cax keyword of fig.colorbar (without an ax keyword). [1]

Also, I wouldn’t refer to the object returned by imshow as cax, as that is 
confusing when looking at the possible arguments of fig.colorbar.  I would call 
the image object im or something similar.  

-Sterling

[1] http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure.colorbar
[2] http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure.add_axes

On Feb 19, 2015, at 11:10PM, Peter Rowat pe...@pelican.ucsd.edu wrote:

 I apologize for asking such a trivial question, but I’ve spent a long time 
 trying to fix this:
 
 I have a large 2D array that displays as an image, with a colorbar on the 
 side.
 I also display 2 curves on top of the image. i.e. in same axes.
 The following code does it:
 
 fig,ax = plt.subplots()
 cax = ax.imshow(bighistT, extent=myextent, cmap = cm.coolwarm, aspect = 
 myaspect,\
 interpolation='nearest')
 ax.set_title(Dummy title)
 # Add colorbar
 cbar = fig.colorbar(cax)
 ax.set_ylabel('mV')
 
 ax.plot(emtrate, emrate, '.r')  #curve 1
 ax.plot(tt, rate*50 - 25.0, '-k', linewidth=3)  #curve 2
 
 plt.show()
 
 IN FACT,
 I want the curves in separate axes, below the image while the colorbar 
 remains immediately to the right
 of the image.
 
 I've tried many minor variations, for way over an hour..
 I've looked at demos, read about colorbar in several different parts of 
 matplotlib docs...
 
 Can someone help??  Either the colorbar is next to the last plot, or else 
 I
 get an error.
 
 Here is code that I've tried: It puts the colorbar in the wrong place, and in 
 addition the image size
 is very small while the ax2 and ax3 curve plots are much wider. 
 I want the image and the second 2 plots the same width.
 
 
 fig, (ax1, ax2,ax3) = plt.subplots(3,1)
 cax = ax1.imshow(bighistT, extent=myextent, cmap = cm.coolwarm, aspect = 
 myaspect,\
 interpolation='nearest')
 ax1.set_title(Dummy title)
 # Add colorbar
 #   cbar = fig.colorbar(cax)  # this places the colorbar next to the third 
 subplot
 plt.colorbar(cax) # so does this
 ax1.set_ylabel('mV')
 ax2.plot(emtrate, emrate, '.r')
 ax3.plot(tt, rate*50 - 25.0, '-k', linewidth=3)
 
 plt.show()
 Thanks for any help,
 
 Peter
 Save our in-boxes! http://emailcharter.org 
 
 
 
 --
 Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
 from Actuate! Instantly Supercharge Your Business Reports and Dashboards
 with Interactivity, Sharing, Native Excel Exports, App Integration  more
 Get technology previously reserved for billion-dollar corporations, FREE
 http://pubads.g.doubleclick.net/gampad/clk?id=190641631iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration  more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to place an image colorbar next to the image when there are several subplots ?

2015-02-20 Thread Sterling Smith
Peter,

You’re welcome.

While I appreciate that you are trying to cut down on unnecessary emails (as 
per emailcharter.org - interesting read), it is appropriate to include the list 
in your responses, especially one indicating that a solution has been found, so 
that others on the list stop thinking about how they could help, and so that a 
person reading the archived list messages can feel confident that the 
suggestions were worthwhile. :-)  NNTR

-Sterling

On Feb 20, 2015, at 3:20PM, Peter Rowat pe...@pelican.ucsd.edu wrote:

 Thank you both for your help, my problem is solved. You both had similar 
 suggestions, and now I have a slightly better understanding of matplotlib.
 
 Peter
 Save our in-boxes! http://emailcharter.org 
 
 
 
 On Feb 20, 2015, at 12:48 AM, Fabrice Silva si...@lma.cnrs-mrs.fr wrote:
 
 Le jeudi 19 février 2015 à 23:10 -0800, Peter Rowat a écrit :
 I apologize for asking such a trivial question, but I’ve spent a long time 
 trying to fix this:
 
 I have a large 2D array that displays as an image, with a colorbar on the 
 side.
 I also display 2 curves on top of the image. i.e. in same axes.
 The following code does it:
 
fig,ax = plt.subplots()
cax = ax.imshow(bighistT, extent=myextent, cmap = cm.coolwarm, aspect = 
 myaspect,\
interpolation='nearest')
ax.set_title(Dummy title)
# Add colorbar
cbar = fig.colorbar(cax)
ax.set_ylabel('mV')
 
ax.plot(emtrate, emrate, '.r')  #curve 1
ax.plot(tt, rate*50 - 25.0, '-k', linewidth=3)  #curve 2
 
plt.show()
 
 IN FACT,
 I want the curves in separate axes, below the image while the colorbar 
 remains immediately to the right
 of the image.
 
 I've tried many minor variations, for way over an hour..
 I've looked at demos, read about colorbar in several different parts of 
 matplotlib docs...
 
 Can someone help??  Either the colorbar is next to the last plot, or 
 else I
 get an error.
 
 Here is code that I've tried: It puts the colorbar in the wrong place, and 
 in addition the image size
 is very small while the ax2 and ax3 curve plots are much wider. 
 I want the image and the second 2 plots the same width.
 
 
fig, (ax1, ax2,ax3) = plt.subplots(3,1)
cax = ax1.imshow(bighistT, extent=myextent, cmap = cm.coolwarm, aspect = 
 myaspect,\
interpolation='nearest')
ax1.set_title(Dummy title)
# Add colorbar
 #   cbar = fig.colorbar(cax)  # this places the colorbar next to the third 
 subplot
plt.colorbar(cax) # so does this
 
 cax is not the Axes containing the image, but the image itself. It seems
 that you want to steal some space to the first subplot so:
 
fig, (ax1, ax2,ax3) = plt.subplots(3,1)
im = ax1.imshow(bighistT, extent=myextent, cmap=cm.coolwarm,
  aspect=myaspect, interpolation='nearest')
ax1.set_title(Dummy title)
cbar = fig.colorbar(im, ax=ax1)
 
 or you can also create a new Axes between ax1 and ax2, and tell
 colorbar() to put the Colorbar into (with the cax keyword argument)
 
 See
 http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure.colorbar
 
 -- 
 Fabrice
 
 
 --
 Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
 from Actuate! Instantly Supercharge Your Business Reports and Dashboards
 with Interactivity, Sharing, Native Excel Exports, App Integration  more
 Get technology previously reserved for billion-dollar corporations, FREE
 http://pubads.g.doubleclick.net/gampad/clk?id=190641631iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration  more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] using it in a Qt5-Widget

2015-01-28 Thread Sterling Smith
Did you come across
http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html
?
-Sterling

On Jan 28, 2015, at 11:38AM, moon...@posteo.org wrote:

 On 2015-01-28 16:25 Thomas Caswell tcasw...@gmail.com wrote:
 It should be exactly the same as for Qt4, just importing from the Qt5
 version
 
 Sorry, but my question was to unspecific.
 
 I don't know how it worked with Qt4.
 
 I need to know I can draw a plot into a QWidget or something else. I
 couldn't find an example or documentation about it.
 
 --
 Dive into the World of Parallel Programming. The Go Parallel Website,
 sponsored by Intel and developed in partnership with Slashdot Media, is your
 hub for all things parallel software development, from weekly thought
 leadership blogs to news, videos, case studies, tutorials and more. Take a
 look and join the conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Control of the display of the navigation toolbar --- how?

2014-11-12 Thread Sterling Smith
Virgil,

Presumably you set up some callback function that is called when you click on 
the first figure, and which creates the second figure.  Can't you change 
rcParams['toolbar'] in that callback function?  Does it not have any effect?

-Sterling

On Nov 12, 2014, at 12:50PM, Virgil Stokes wrote:

 I would like to be able to control when there is and there is not a 
 navigation toolbar for figures. For example, suppose I have created a figure 
 in which I do not wish to have a toolbar. I have used the following statement 
 for this:
 
 mpl.rcParams['toolbar'] = 'None'
 
 which works fine. This figure (without a navigation toolbar) contains some 
 points in it that are used to display more figures (each with an image in 
 it). That is, when one of the points is clicked on with a mouse, a new figure 
 is created with a PNG image in it. I wish to have a navigation toolbar in all 
 these figures containing images.
 
 How can I place navigation toolbars in these figures with PNG images?
 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push notifications.
 Take corrective actions from your mobile device.
 http://pubads.g.doubleclick.net/gampad/clk?id=154624111iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Control of the display of the navigation toolbar --- how?

2014-11-12 Thread Sterling Smith
Virgil,

Glad to hear you got it to work.  You are right that you have to set rcParams 
before the corresponding element is created (in this case the figure) for the 
rcParams to affect that creation.  

-Sterling

On Nov 12, 2014, at 4:00PM, Virgil Stokes wrote:

 On 12-Nov-14 22:20, Sterling Smith wrote:
 Virgil,
 
 Presumably you set up some callback function that is called when you click 
 on the first figure, and which creates the second figure.  Can't you change 
 rcParams['toolbar'] in that callback function?  Does it not have any effect?
 
 -Sterling
 
 On Nov 12, 2014, at 12:50PM, Virgil Stokes wrote:
 
 I would like to be able to control when there is and there is not a 
 navigation toolbar for figures. For example, suppose I have created a 
 figure in which I do not wish to have a toolbar. I have used the following 
 statement for this:
 
 mpl.rcParams['toolbar'] = 'None'
 
 which works fine. This figure (without a navigation toolbar) contains some 
 points in it that are used to display more figures (each with an image in 
 it). That is, when one of the points is clicked on with a mouse, a new 
 figure is created with a PNG image in it. I wish to have a navigation 
 toolbar in all these figures containing images.
 
 How can I place navigation toolbars in these figures with PNG images?
 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push notifications.
 Take corrective actions from your mobile device.
 http://pubads.g.doubleclick.net/gampad/clk?id=154624111iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 OK Sterling!
 I now have it --- I needed to do the following when displaying the figures 
 containing the images:
 
 mpl.rcParams['toolbar'] = 'toolbar2' # to restore toolbar
  f, ax = plt.subplots(figsize=(5,4)) # for images
 
 It was important to have this order in the statements; i.e., the mpl before 
 the figure was defined.
 Thanks for the help


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Equivalent of d3's step-after interpolation?

2014-10-30 Thread Sterling Smith
http://stackoverflow.com/questions/8921296/how-do-i-plot-a-step-function-with-matplotlib-in-python

On Oct 30, 2014, at 11:29AM, Benjamin Root wrote:

 Kinda sounds a bit like a barchart with the 'step' option, I think?
 
 On Thu, Oct 30, 2014 at 12:16 PM, Skip Montanaro s...@pobox.com wrote:
 I've been doing some work with d3 recently. It's certainly been an 
 education... Out of the box, it supports several different types of 
 interpolation between two points, which I've found quite useful. It allows me 
 to focus on assembling my data, and not worry about transforming it to 
 achieve the desired visual effect. For example, in trading markets, once a 
 trade is seen at a certain price, X, it's useful to think of that price 
 holding until the next trade price seen at Y. With d3's step-after 
 interpolation, given two points, (t0, X) and (t1, Y), instead of drawing a 
 single line between the two points, it draws a horizontal line between (t0, 
 X) and (t1, X), then a vertical line between (t1, X) and (t1, Y).
 
 I've don't a bit of searching, but didn't find anything obviously like this 
 in matplotlib. Does it support such a feature?
 
 Thx,
 
 Skip
 
 
 
 --
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] markers with same size in legend box

2014-10-24 Thread Sterling Smith
Your solution is about as good as proxy artists in legends, which would be 
the official method.  (Google proxy artist matplotlib.)

It may be relevant that you can access the marker of the legend entries with 
the _marker attribute of the handles.  Search the mailing list archives for 
this one.

-Sterling

On Oct 23, 2014, at 8:05PM, Tommy Carstensen wrote:

 Is there a way to have all markers in the legend box have the same size?
 www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg
 
 I came up with a solution by plotting a marker outside the latitude
 and longitude range, but that's not a very good solution.
 
 Thanks for your time.
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] twinx cla problem

2014-10-10 Thread Sterling Smith
This is not tested, but did you try ax2.clear() instead?

-Sterling

On Oct 10, 2014, at 7:45AM, Duke, Charles wrote:

 With matplotlib 1.4.0 the cla() method for the twinx axes also clears the 
 primary axes.  With matplotlib 1.3.1 the method only clears the twinx axes as 
 expected.  I have a much longer program where the twinx axes must be cleared 
 while retaining the primary axis plot.  I would prefer not to replot the 
 entire graph each time the twinx axes change.  You can see this by adding the 
 cla method to the matplotlib web site example, two_scales.py, shown below.
  
 I have matplotlib installed via the anaconda package. Matplotlib 1.4.0 is 
 from anaconda 2.1.0.  Matplotlib 1.3.1 is from 1.9 versions of the anaconda 
 package.
  
 Linux version:
 Linux gamow 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
 Same cla() result on osX 10.9.4.
  
 Same result for backends Qt4Agg and TkAgg;  the cla() method cleared both 
 axes.
 I also tried various other options such as setting ax2.hold(False) prior to 
 replotting  ax2.  However, once again ax1 was cleared.  The ax2 clear 
 commands seem to apply to the ax1 axis as well???  These options worked as 
 expected  for the earlier matplotlib version, clearing only the ax2 axis.
  
 Here’s the code:  if you execute the code, you should see a blank figure with 
 the cla() included and the usual two graphs without the cla() method.
  
 
 import numpy as np
 import matplotlib.pyplot as plt
  
 fig, ax1 = plt.subplots()
 t = np.arange(0.01, 10.0, 0.01)
 s1 = np.exp(t)
 ax1.plot(t, s1, 'b-')
 ax1.set_xlabel('time (s)')
 # Make the y-axis label and tick labels match the line color.
 ax1.set_ylabel('exp', color='b')
 for tl in ax1.get_yticklabels():
 tl.set_color('b')
  
 ax2 = ax1.twinx()
 s2 = np.sin(2*np.pi*t)
 ax2.plot(t, s2, 'r.')
 ax2.set_ylabel('sin', color='r')
 for tl in ax2.get_yticklabels():
 tl.set_color('r')
  
 # single line addition to the two_scales.py example
 # clears both ax2 and ax1 under matplotlib 1.4.0, clears only ax2 under 
 matplotlib 1.3.1
 # obviously, same result with ax2.clear() method
 ax2.cla()
  
 plt.show()
  
  
 I would appreciate any help;  this looks like a bug in the latest version of 
 matplotlib.
 I could not find any reference to this problem in earlier posts.
  
 Thanks,
 Charlie
  
 --
 Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
 Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
 Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
 Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
 http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] A separate legend box for the markers only?

2014-09-12 Thread Sterling Smith
Try googling proxy artist, which leads to this page:
http://matplotlib.org/users/legend_guide.html

-Sterling

On Sep 12, 2014, at 11:01AM, ConcreteVitamin wrote:

 Accidentally hit send, sorry.. Completed email:
 
 I have a graph that looks like this [1], in which each line has
 different markers for the same number of points. I'd like to add a
 separate legend box (like the one already in the graph) for the
 markers only:
 
   circle: description for circle
   right triangle: description for right triangle
   ... and so on...
 
 How can I do this? After googling a bit I couldn't find an answer. Thanks a 
 lot!
 
 
 
 On Fri, Sep 12, 2014 at 11:00 AM, ConcreteVitamin
 concretevita...@gmail.com wrote:
 Hi matplotlib-users@,
 
 I have a graph that looks like this [1], in which each line has
 different markers for the same number of points. I'd like to add a
 separate legend box (like the one already in the graph) for the
 markers only:
 
   circle: description for circle
   right triangle: description for right triangle
 
 
 [1] http://imgur.com/tmFpix1
 
 --
 Want excitement?
 Manually upgrade your production database.
 When you want reliability, choose Perforce
 Perforce version control. Predictably reliable.
 http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] A separate legend box for the markers only?

2014-09-12 Thread Sterling Smith
I have version 1.3.1.

I had to modify the example to be:
{{{
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
import matplotlib
print matplotlib.__version__

blue_line = mlines.Line2D([], [], color='blue', marker='*',
  markersize=15, label='Blue stars')
plt.plot([],[])
plt.legend([blue_line],['Blue stars'])
plt.draw()
plt.show()
}}}

Then the legend showed up correctly with stars.

-Sterling

On Sep 12, 2014, at 11:58AM, ConcreteVitamin wrote:

 I tried the blue stars [1] example here, but the star markers are not
 showing up in my second legend box. Only the blue line is there. Is
 there a way to make only the markers show up?
 
 http://matplotlib.org/users/legend_guide.html#creating-artists-specifically-for-adding-to-the-legend-aka-proxy-artists
 
 On Fri, Sep 12, 2014 at 11:29 AM, Sterling Smith smit...@fusion.gat.com 
 wrote:
 Try googling proxy artist, which leads to this page:
 http://matplotlib.org/users/legend_guide.html
 
 -Sterling
 
 On Sep 12, 2014, at 11:01AM, ConcreteVitamin wrote:
 
 Accidentally hit send, sorry.. Completed email:
 
 I have a graph that looks like this [1], in which each line has
 different markers for the same number of points. I'd like to add a
 separate legend box (like the one already in the graph) for the
 markers only:
 
  circle: description for circle
  right triangle: description for right triangle
  ... and so on...
 
 How can I do this? After googling a bit I couldn't find an answer. Thanks a 
 lot!
 
 
 
 On Fri, Sep 12, 2014 at 11:00 AM, ConcreteVitamin
 concretevita...@gmail.com wrote:
 Hi matplotlib-users@,
 
 I have a graph that looks like this [1], in which each line has
 different markers for the same number of points. I'd like to add a
 separate legend box (like the one already in the graph) for the
 markers only:
 
  circle: description for circle
  right triangle: description for right triangle
 
 
 [1] http://imgur.com/tmFpix1
 
 --
 Want excitement?
 Manually upgrade your production database.
 When you want reliability, choose Perforce
 Perforce version control. Predictably reliable.
 http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


--
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] (no subject)

2014-09-05 Thread Sterling Smith
When I wanted to make my math text in a LaTeX beamer presentation upright, I 
added the following to my beamer style file:
%%Attempt to get upright math symbols
\AtBeginDocument{
\DeclareSymbolFont{pureletters}{\encodingdefault}{\mathfamilydefault}{m}{n}
\SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{\rmdefault}{m}{n}
\DeclareMathAlphabet{\mathbf}{\encodingdefault}{\mathfamilydefault}{bx}{n}
\DeclareMathAlphabet{\mathsf}{\encodingdefault}{\sfdefault}{m}{n}
\DeclareMathAlphabet{\mathit}{\encodingdefault}{\mathfamilydefault}{m}{it}
\DeclareMathAlphabet{\mathtt}{\encodingdefault}{\ttdefault}{m}{n}
\ifx\mv at bold\@undefined\else
\SetSymbolFont{numbers}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n}


\SetSymbolFont{pureletters}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n}
\SetMathAlphabet{\mathrm}{bold}{\encodingdefault}{\rmdefault}{bx}{n}

\SetMathAlphabet{\mathbf}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n}
\SetMathAlphabet{\mathsf}{bold}{\encodingdefault}{\sfdefault}{bx}{n}


\SetMathAlphabet{\mathit}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{it}
\SetMathAlphabet{\mathtt}{bold}{\encodingdefault}{\ttdefault}{bx}{n}
\fi

\def\operator at font{\mathgroup\symnumbers}

\DeclareMathSymbol{0}\mathalpha{numbers}{30}
\DeclareMathSymbol{1}\mathalpha{numbers}{31}
\DeclareMathSymbol{2}\mathalpha{numbers}{32}
\DeclareMathSymbol{3}\mathalpha{numbers}{33}
\DeclareMathSymbol{4}\mathalpha{numbers}{34}
\DeclareMathSymbol{5}\mathalpha{numbers}{35}
\DeclareMathSymbol{6}\mathalpha{numbers}{36}
\DeclareMathSymbol{7}\mathalpha{numbers}{37}
\DeclareMathSymbol{8}\mathalpha{numbers}{38}
\DeclareMathSymbol{9}\mathalpha{numbers}{39}

\DeclareMathSymbol{A}\mathalpha{pureletters}{41}
\DeclareMathSymbol{B}\mathalpha{pureletters}{42}
\DeclareMathSymbol{C}\mathalpha{pureletters}{43}
\DeclareMathSymbol{D}\mathalpha{pureletters}{44}
\DeclareMathSymbol{E}\mathalpha{pureletters}{45}
\DeclareMathSymbol{F}\mathalpha{pureletters}{46}
\DeclareMathSymbol{G}\mathalpha{pureletters}{47}
\DeclareMathSymbol{H}\mathalpha{pureletters}{48}
\DeclareMathSymbol{I}\mathalpha{pureletters}{49}
\DeclareMathSymbol{J}\mathalpha{pureletters}{4A}
\DeclareMathSymbol{K}\mathalpha{pureletters}{4B}
\DeclareMathSymbol{L}\mathalpha{pureletters}{4C}
\DeclareMathSymbol{M}\mathalpha{pureletters}{4D}
\DeclareMathSymbol{N}\mathalpha{pureletters}{4E}
\DeclareMathSymbol{O}\mathalpha{pureletters}{4F}
\DeclareMathSymbol{P}\mathalpha{pureletters}{50}
\DeclareMathSymbol{Q}\mathalpha{pureletters}{51}
\DeclareMathSymbol{R}\mathalpha{pureletters}{52}
\DeclareMathSymbol{S}\mathalpha{pureletters}{53}
\DeclareMathSymbol{T}\mathalpha{pureletters}{54}
\DeclareMathSymbol{U}\mathalpha{pureletters}{55}
\DeclareMathSymbol{V}\mathalpha{pureletters}{56}
\DeclareMathSymbol{W}\mathalpha{pureletters}{57}
\DeclareMathSymbol{X}\mathalpha{pureletters}{58}
\DeclareMathSymbol{Y}\mathalpha{pureletters}{59}
\DeclareMathSymbol{Z}\mathalpha{pureletters}{5A}

\DeclareMathSymbol{a}\mathalpha{pureletters}{61}
\DeclareMathSymbol{b}\mathalpha{pureletters}{62}
\DeclareMathSymbol{c}\mathalpha{pureletters}{63}
\DeclareMathSymbol{d}\mathalpha{pureletters}{64}
\DeclareMathSymbol{e}\mathalpha{pureletters}{65}
\DeclareMathSymbol{f}\mathalpha{pureletters}{66}
\DeclareMathSymbol{g}\mathalpha{pureletters}{67}
\DeclareMathSymbol{h}\mathalpha{pureletters}{68}
\DeclareMathSymbol{i}\mathalpha{pureletters}{69}
\DeclareMathSymbol{j}\mathalpha{pureletters}{6A}
\DeclareMathSymbol{k}\mathalpha{pureletters}{6B}
\DeclareMathSymbol{l}\mathalpha{pureletters}{6C}
\DeclareMathSymbol{m}\mathalpha{pureletters}{6D}
\DeclareMathSymbol{n}\mathalpha{pureletters}{6E}
\DeclareMathSymbol{o}\mathalpha{pureletters}{6F}
\DeclareMathSymbol{p}\mathalpha{pureletters}{70}
\DeclareMathSymbol{q}\mathalpha{pureletters}{71}
\DeclareMathSymbol{r}\mathalpha{pureletters}{72}
\DeclareMathSymbol{s}\mathalpha{pureletters}{73}
\DeclareMathSymbol{t}\mathalpha{pureletters}{74}
\DeclareMathSymbol{u}\mathalpha{pureletters}{75}
\DeclareMathSymbol{v}\mathalpha{pureletters}{76}
\DeclareMathSymbol{w}\mathalpha{pureletters}{77}
\DeclareMathSymbol{x}\mathalpha{pureletters}{78}
\DeclareMathSymbol{y}\mathalpha{pureletters}{79}
\DeclareMathSymbol{z}\mathalpha{pureletters}{7A}

}

I don't know if that helps here.  Perhaps you would add this to 
rcParams['latex.preamble'], which was always advertised as being experimental.  
(You may need to preface it with \makeatletter, and end with \makeatother.)

-Sterling


On Sep 5, 2014, at 1:21PM, Paul Hobson wrote:

 How do you do this in a normal LaTeX document?
 
 
 On Fri, Sep 5, 2014 at 12:53 PM, Arnaldo Russo arnaldoru...@gmail.com wrote:
 Hi,
 
 I'm trying to figure out how I could use greek 

Re: [Matplotlib-users] Region within contour -- 2D array

2014-08-28 Thread Sterling Smith
Joe and list,

This is off topic, but can you point me to good documentation on the use of '' 
as opposed to numpy.logical_and ?

Thanks,
Sterling

On Aug 28, 2014, at 7:18PM, Joe Kington wrote:

 Why not just use boolean indexing?  
 
 E.g. to find the region that falls between 5 and 10, do (z =5)  (z = 10):
 
 In [1]: import numpy as np
 
 In [2]: x, y = np.mgrid[-10:10, -10:10]
 
 In [3]: z = np.hypot(x, y)
 
 In [4]: result = (z = 5)  (z = 10)
 
 In [5]: result.astype(int)
 Out[5]: 
 array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]])
 
 Cheers,
 -Joe
 
 
 
 On Thu, Aug 28, 2014 at 8:23 PM, Eric Firing efir...@hawaii.edu wrote:
 On 2014/08/28, 3:02 AM, Matthew Czesarski wrote:
  Hi Matplotlib Users!
 
 
 
  I have some 2-d arrays, which i am displaying  with implot, and deriving
  contours for with contour.  Easy -  I'm just pulling them out of
  collections[0].get_paths() .
 
  However what's not easy is that I would like to recover a 1-0 or
  True-False array of the array values (pixels) that fall within the
  contours. Some line crossing algorithm/floodfill could do it, but I
  guess that matplotlib's fill() or contourf() must do this under the hood
  anyway. I've looked into the output both functions, but I don't see
  anything obvious..
 
  Does anybody know if there's an a way to pull out a such an array from
  matplotlib?   Any pointers are appreciated!
 
 Make an array of (x, y) pairs from the X and Y you use in your call to
 contour, and then feed that array to the contains_points() method of
 your contour Path.  This will give you the desired Boolean array for any
 given Path; depending on what you want, you might need to combine arrays
 for more than one Path.
 
 To get closed paths, I think you will want to use contourf, not contour.
 
 Eric
 
 
 
 
  Cheers,
  Matt
 
 
  --
  Slashdot TV.
  Video for Nerds.  Stuff that matters.
  http://tv.slashdot.org/
 
 
 
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 --
 Slashdot TV.
 Video for Nerds.  Stuff that matters.
 http://tv.slashdot.org/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 --
 Slashdot TV.  
 Video for Nerds.  Stuff that matters.
 http://tv.slashdot.org/___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Multiple lines of xtick_labels

2014-08-15 Thread Sterling Smith
How about prepending '\n' to your minor labels?

On Aug 15, 2014, at 1:38PM, Ted To wrote:

 Hi,
 
 I'm trying to set two lines of xtick_labels But I can't figure out how
 to get them on separate lines.  These are for errorbars where I have two
 variables for each of four categories.  Using the following code, I'm
 able to create the attached figure.  How does one move the minor
 xtick_labels to a 2nd line?  A minor problem that maybe someone knows
 the answer to is, how do I increase the width of the x axis so that
 there is some space before and after the first and last ticks?
 (ax1.set_xlim(-.5,7.5) does not seem to work.)
 
 Many thanks,
 Ted
 
 fig,ax1=plt.subplots()
 ax1.errorbar(wageAllTypes.index,wageAllTypes['mean'],yerr=wageAllTypes['sd'],fmt='bo')
 xticks=[0,1,2,3,4,5,6,7]
 xticks_minor=[.5,2.5,4.5,6.5]
 ax1.set_xticks(xticks)
 ax1.set_xticks(xticks_minor, minor=True)
 ax1.set_xticklabels(['All Jobs','Job 1','Job 2','Job 3'],minor=True)
 ax1.set_xticklabels([r'$w$',r'$\xi$',r'$w$',r'$\xi$',r'$w$',r'$\xi$',r'$w$',r'$\xi$]')
 
 ax1.tick_params(axis='x',which='major')
 ax1.tick_params(axis='x',which='minor',bottom='off',top='off')
 ax1.set_ylabel(r'$\ln w$',ha='right',rotation='horizontal')
 
 ax2 = ax1.twinx()
 ax2.errorbar(xiAllTypes.index,xiAllTypes['mean'],yerr=xiAllTypes['sd'],fmt='ro')
 ax2.set_ylabel(r'$\xi$',ha='left',rotation='horizontal')
 figure_1.png--
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?

2014-04-23 Thread Sterling Smith

On Apr 23, 2014, at 11:41AM, Jody Klymak wrote:

 
 On Apr 23, 2014, at  8:35 AM, Chao YUE chaoyue...@gmail.com wrote:
 
 yes, Ben, I understand the difference now.
 
 To Mike: I have to select the region of the figure I need in the pdf file 
 and paste it in the powerpoint ... Isn't this you're doing as well? 
 
 Why do you need to select a region?  This takes a screen grab that will be 
 terrible quality, doesn't it?  Just drag the file into powerpoint (or use 
 insert/picture).  If you need to crop the PDF do that in Acrobat, or whatever 
 PDF software you use.  
 
 Cheers,   Jody

On a windows computer, I found these instructions for inserting a pdf file into 
powerpoint: [1]   These instructions indicate that you can not simply insert a 
pdf picture, as is done on a Mac, which might explain why he was selecting a 
region of the figure in a pdf viewer.  

Chao,

I'm not sure if the dpi setting or png format for savefig helped you.  In the 
future if you have to cut out a part of a pdf file, and if you are using Adobe 
reader, then there is a setting in the preferences for customizing the 
resolution of the clip you are selecting.

-Sterling

[1] 
http://office.microsoft.com/en-us/powerpoint-help/insert-pdf-file-content-into-a-powerpoint-presentation-HA102809687.aspx
--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Variable size markers legend formatting

2014-04-11 Thread Sterling Smith
Adam,

I agree that the Circle ended up with a rectangle in the legend, which I 
wouldn't think of as the expected response.  Would the following work for your 
purposes?

figure()
p,=plot(0,0,marker='o',ls='',color='red')
legend([p], [Red Rectangle],numpoints=1)
p.remove()
draw()

-Sterling

On Apr 11, 2014, at 8:14AM, Adam Hughes wrote:

 Hi Paul, 
 
 I tried out the legend proxy artist, and it works for rectangles in the 
 legend, but I can't seem to get a Circle to appear in the legend, which I 
 presume should be:
 
 p = Circle((0, 0), fc=r)
 legend([p], [Red Rectangle])
 
 
 On Wed, Apr 9, 2014 at 2:20 PM, Adam Hughes hughesada...@gmail.com wrote:
 Thanks Paul, I will try it out.
 
 
 On Wed, Apr 9, 2014 at 12:21 PM, Paul Hobson pmhob...@gmail.com wrote:
 
 
 
 On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes hughesada...@gmail.com wrote:
 Thanks.  That's probably the way I'll go.  At first, I thought creating 
 separate legend markers and removing them from the plot seemed hacky, but I 
 guess there's no way that matplotlib could know which legend size I want.  I 
 wonder if there'd be any interest in a PR to add a keyword to legend to 
 handle this situation?
 
 Why not just work the other way around with proxy artists. IOW, make the 
 artists but never add them to the plot.
 
 http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist
 (works with Line2D artists)
 
 -p
 
  
 
 On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith smit...@fusion.gat.com wrote:
 Adam,
 
 I haven't investigated, but does the discussion of the legend marker at [1] 
 help?
 
 -Sterling
 
 [1] 
 https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html
 
 On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:
 
  Hello,
 
  I've been searching but can't seem to find this topic addressed (perhaps 
  wrong search terms)
 
  Simply put, I have a scatter plot with variable size markers, and I'd like 
  to have the markers all be a single size in the legend.  Is there a 
  standard way to do this?
 
  Thanks.
  --
  Put Bad Developers to Shame
  Dominate Development with Jenkins Continuous Integration
  Continuously Automate Build, Test  Deployment
  Start a new project now. Try Jenkins in the cloud.
  http://p.sf.net/sfu/13600_Cloudbees___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 --
 Put Bad Developers to Shame
 Dominate Development with Jenkins Continuous Integration
 Continuously Automate Build, Test  Deployment
 Start a new project now. Try Jenkins in the cloud.
 http://p.sf.net/sfu/13600_Cloudbees
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 


--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test  Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Variable size markers legend formatting

2014-04-08 Thread Sterling Smith
Adam,

I haven't investigated, but does the discussion of the legend marker at [1] 
help?

-Sterling

[1] 
https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html
 

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

 Hello,
 
 I've been searching but can't seem to find this topic addressed (perhaps 
 wrong search terms)
 
 Simply put, I have a scatter plot with variable size markers, and I'd like to 
 have the markers all be a single size in the legend.  Is there a standard way 
 to do this?
 
 Thanks.
 --
 Put Bad Developers to Shame
 Dominate Development with Jenkins Continuous Integration
 Continuously Automate Build, Test  Deployment 
 Start a new project now. Try Jenkins in the cloud.
 http://p.sf.net/sfu/13600_Cloudbees___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test  Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Conflict matplotlib ctypes

2014-03-28 Thread Sterling Smith
You forgot to add the line that causes the problems.

You might want to give a minimum self contained working example.

-Sterling

On Mar 28, 2014, at 12:20PM, Jorge Ferrando wrote:

 Hello
 
 I'm workign on a project where we are using ctypes and I wanted to plot some 
 data with matplotlib.
 
 Everything is running fine, but as soon as I add this line:
 
 The project crashes with this error:
 
 File ./myfile.py, line 117, in loadLibrary
 return cdll.LoadLibrary(library)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py,
  line 443, in LoadLibrary
 return self._dlltype(name)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py,
  line 365, in __init__
 self._handle = _dlopen(self._name, mode)
 OSError: dlopen(libAPI.dylib, 6): initializer function 0x7fff9568c26e not in 
 mapped image for /Users/jorfermo/Desarrollo//libAPI.dylib
 
 It seems to be that there's a conflict between ctypes library and matplotlib 
 but i failed to find a workaround to this error.
 
 Any Idea how to solve it?
 
 Thank you
 
 Jorge
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Left-aligned and centered title

2014-03-17 Thread Sterling Smith
Florian,

I think that you need to add the ax.titleOffsetTrans to the ax.transAxes 
transformation.

ax.text(0,pos[1],letter,transform=ax.transAxes+ax.titleOffsetTrans,va=va)

-Sterling

On Mar 17, 2014, at 6:31AM, Florian M. Wagner wrote:

 Dear users,
 
 I would like label my subplots with a horizontally left-aligned letter 
 (wanted by the journal) and the normal, centered axes title, which should 
 both be vertically in line. The following example does not work: 
 
 from matplotlib import pyplot as plt
 import numpy as np
 
 fig, ax1 = plt.subplots()
 x = np.linspace(1,10)
 y = (sin(x))
 ax1.plot(x,y)
 
 def subplot_label(ax, letter, title):
 title = ax.set_title(title)
 pos = title.get_position()
 va = title.get_va()
 ax.text(0, pos[1], letter, transform=ax.transAxes, verticalalignment=va)
  
 subplot_label(ax1, 'a)', 'This text is not aligned with the label')
 
 Which property of the axes title am I missing?
 
 Thank you for your help
 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Sterling Smith
+1 for macports
(I haven't used the others.)

On Mar 13, 2014, at 10:12AM, Felix Patzelt wrote:

 Are you sure that you want to use Python 3.3 on OSX 10.6??? Do you really 
 still use 10.6? Do you want Python 3? I'm not sure on the current status, but 
 many projects took quite a while to get ported over from Python 2. 
 Furthermore, as often with free software, installation can be a bit tricky. 
 It is certainly a very different experience than installing normal Mac 
 applications. 
 
 For a bit of context, most Linux distribution have some version of Python / 
 Matplotlib in their respective package managers. These are easily installed 
 if the particular package manager on your Linux offers the versions you want. 
 Otherwise, you will have to do some work. 
 
 OSX does not have an official package manager, but there are several 
 inofficial options. I'm using http://www.macports.org which is slow because 
 it installs its own private versions for everything, but it works very well. 
 This is probably the easiest way to get all the open source stuff you want on 
 your Mac and I use it a lot. Another popular and more lightweight package 
 manager is homebrew, which relies more on the system libraries from Apple.
 
 The minimal installation instructions without a package manager seem to be 
 these: 
 https://github.com/rueckstiess/mtools/wiki/matplotlib-Installation-Guide If 
 you're a real unix hacker, you can install everything from source. I did that 
 before, and it takes a lot of time and in-depth knowledge. 
 
 Finally, there are several pre-packaged distributions like 
 https://www.enthought.com or  https://store.continuum.io/cshop/anaconda/ (see 
 http://penandpants.com/install-python/). They might come with a normal OSX 
 installer. Maybe https://code.google.com/p/spyderlib/ does the trick for you? 
 
 Anyway, these are just some suggestions. Maybe you want to start a separate 
 thread on the mailing list about the best way to install matplotlib on a mac. 
 Please note that I cannot comment in detail on any of the installation 
 methods that I didn't use myself.
 
 
 
 
 Am 13.03.2014 um 17:36 schrieb Christophe Bal projet...@gmail.com:
 
 I've tested a more simpler Python code.
 
 from pylab import *
 plot([1,2,3])
 show()
 
 This gives me a scary backend MacOSX version unknown. I've used the official 
 DMG installer matplotlib-1.3.1-py3.3-python.org-macosx10.6.dmg. 
 
 This seems to be a big problem. No ?
 
 
 $HOME=/Users/
 matplotlib data path 
 /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data
 loaded rc file 
 /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data/matplotlibrc
 matplotlib version 1.3.1
 verbose.level helpful
 interactive is False
 platform is darwin
 CACHEDIR=/Users//.matplotlib
 Using fontManager instance from /Users//.matplotlib/fontList.py3k.cache
 backend MacOSX version unknown
 
 
 2014-03-13 17:31 GMT+01:00 Felix Patzelt fe...@neuro.uni-bremen.de:
 Well, there is a list in ~/.matplotlib/matplotlibrc (see 
 http://matplotlib.org/users/customizing.html)
 
  CONFIGURATION BEGINS HERE
 
 # the default backend; one of GTK GTKAgg GTKCairo CocoaAgg FltkAgg
 # MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template
 # You can also deploy your own backend outside of matplotlib by
 # referring to the module name (which must be in the PYTHONPATH) as
 # 'module://my_backend'
 backend  : Qt4Agg
 
 see also: 
 http://stackoverflow.com/questions/5091993/list-of-all-available-matplotlib-backends
 
 I'm not sure about the dependencies, I guess you have to check out each one 
 of them. If you don't use a package manager, resolving all dependency issues 
 might be quite painful.
 
 Best,
 Felix Patzelt
 
 Am 13.03.2014 um 17:18 schrieb Christophe Bal projet...@gmail.com:
 
 Thanks a lot for this big hint but neither TkAgg works nor Qt4Agg can work 
 (because I do not have PyQt). 
 
 Is there a complete list of all the backends ?
 
 Christophe BAL
 
 
 
 
 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

Re: [Matplotlib-users] Loding CSV file and plotting histogram of a particular column

2014-02-28 Thread Sterling Smith
You have an uppercase 'Confidence'.  Are you using pandas or numpy?  For numpy, 
from Piet's email, you need a lowercase key.  What does 
`print df['Confidence'].shape`
yield?  Because the error looks like you have an array with no size (zero 
dimensions), so perhaps you are still not reading in your file correctly.

-Sterling

On Feb 28, 2014, at 1:02PM, AR12 wrote:

 Thanks, this worked for two of the columns. For the third column, I get this 
 error: Sorry to bug you about this. Do you know where I can find the solution 
 to this problem?
 
 ---
 TypeError Traceback (most recent call last)
 ipython-input-10-ae5186552dfe in module()
  1 plt.hist(df['Confidence'],bins=10)
 
 /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pyplot.pyc
  in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, 
 align, orientation, rwidth, log, color, label, stacked, hold, **kwargs)
2875   histtype=histtype, align=align, 
 orientation=orientation,
2876   rwidth=rwidth, log=log, color=color, 
 label=label,
 - 2877   stacked=stacked, **kwargs)
2878 draw_if_interactive()
2879 finally:
 
 /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/axes/_axes.pyc
  in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, 
 align, orientation, rwidth, log, color, label, stacked, **kwargs)
5477 xmax = -np.inf
5478 for xi in x:
 - 5479 if len(xi)  0:
5480 xmin = min(xmin, xi.min())
5481 xmax = max(xmax, xi.max())
 
 TypeError: len() of unsized object
 
 
 On Fri, Feb 28, 2014 at 2:42 PM, Paul Hobson-2 [via matplotlib] [hidden 
 email] wrote:
 Sounds like you want to use pandas, not numpy.
 
 import pandas
 import matplotlib.pyplot as plt
 df = pandas.read_csv('myfile.txt', sep='\t')
 plt.hist(data['A'], bins=30)
 
 ...should do it for you. 
 
 
 On Fri, Feb 28, 2014 at 11:06 AM, AR12 [hidden email] wrote:
 Hi,
 
 I have a csv file where head -5 looks like this:
 
 A  B   C
 100  0.45  0.3
 67  0.25  0.4
 50.6  0.2  0.6
 56.4  0.4  0.3
 
 The columns are tab separated. I want to load this CSV file and plot the
 histogram of the third or second column. I was able to load the csv file
 using this:
 data=csv2rec('Downloads/Sample.txt',delimiter='\t',skiprows=0)
 The file has 2792 rows including the top header row.
 
 When I do
  data['A'] I get this error:
 ---
 ValueErrorTraceback (most recent call last)
 ipython-input-19-856828b8eaa3 in module()
  1 data['A']
 
 /Library/Python/2.7/site-packages/numpy-1.9.0.dev_297f54b-py2.7-macosx-10.9-intel.egg/numpy/core/records.pyc
 in __getitem__(self, indx)
 457
 458 def __getitem__(self, indx):
 -- 459 obj = ndarray.__getitem__(self, indx)
 460 if (isinstance(obj, ndarray) and obj.dtype.isbuiltin):
 461 return obj.view(ndarray)
 
 ValueError: field named A not found
 
 First is data['A'] supposed to read the whole A column? Once I read the
 column I want to be able to plot it. Can I simply do
  hist(data['A'],bins=30) or something like that.
 
 Many thanks,
 AR
 
 
 
 
 --
 View this message in context: 
 http://matplotlib.1069221.n5.nabble.com/Loding-CSV-file-and-plotting-histogram-of-a-particular-column-tp42938.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.
 
 --
 Flow-based real-time traffic analytics software. Cisco certified tool.
 Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
 Customize your own dashboards, set traffic alerts and generate reports.
 Network behavioral analysis  security monitoring. All-in-one tool.
 http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 [hidden email]
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 --
  
 Flow-based real-time traffic analytics software. Cisco certified tool. 
 Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer 
 Customize your own dashboards, set traffic alerts and generate reports. 
 Network behavioral analysis  security monitoring. All-in-one tool. 
 http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
 ___ 
 Matplotlib-users mailing list 
 [hidden email] 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 If you reply to this email, your message will be added to the 

Re: [Matplotlib-users] Loding CSV file and plotting histogram of a particular column

2014-02-28 Thread Sterling Smith
Aarthi,

For me to help further, you will need to provide a sample input file, and the 
script you are trying to use to read that input file.  Then I can go from there.

-Sterling

On Feb 28, 2014, at 1:38PM, Aarthi Reddy wrote:

 It is not an uppercase problem. The other two titles had combination of upper 
 and lower case. All columns have the exact same number of lines and there are 
 no empty entries.
 
 On Feb 28, 2014, at 3:31 PM, Sterling Smith smit...@fusion.gat.com wrote:
 
 You have an uppercase 'Confidence'.  Are you using pandas or numpy?  For 
 numpy, from Piet's email, you need a lowercase key.  What does 
 `print df['Confidence'].shape`
 yield?  Because the error looks like you have an array with no size (zero 
 dimensions), so perhaps you are still not reading in your file correctly.
 
 -Sterling
 
 On Feb 28, 2014, at 1:02PM, AR12 wrote:
 
 Thanks, this worked for two of the columns. For the third column, I get 
 this error: Sorry to bug you about this. Do you know where I can find the 
 solution to this problem?
 
 ---
 TypeError Traceback (most recent call last)
 ipython-input-10-ae5186552dfe in module()
  1 plt.hist(df['Confidence'],bins=10)
 
 /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pyplot.pyc
  in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, 
 align, orientation, rwidth, log, color, label, stacked, hold, **kwargs)
   2875   histtype=histtype, align=align, 
 orientation=orientation,
   2876   rwidth=rwidth, log=log, color=color, 
 label=label,
 - 2877   stacked=stacked, **kwargs)
   2878 draw_if_interactive()
   2879 finally:
 
 /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/axes/_axes.pyc
  in hist(self, x, bins, range, normed, weights, cumulative, bottom, 
 histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
   5477 xmax = -np.inf
   5478 for xi in x:
 - 5479 if len(xi)  0:
   5480 xmin = min(xmin, xi.min())
   5481 xmax = max(xmax, xi.max())
 
 TypeError: len() of unsized object
 
 
 On Fri, Feb 28, 2014 at 2:42 PM, Paul Hobson-2 [via matplotlib] [hidden 
 email] wrote:
 Sounds like you want to use pandas, not numpy.
 
 import pandas
 import matplotlib.pyplot as plt
 df = pandas.read_csv('myfile.txt', sep='\t')
 plt.hist(data['A'], bins=30)
 
 ...should do it for you. 
 
 
 On Fri, Feb 28, 2014 at 11:06 AM, AR12 [hidden email] wrote:
 Hi,
 
 I have a csv file where head -5 looks like this:
 
 A  B   C
 100  0.45  0.3
 67  0.25  0.4
 50.6  0.2  0.6
 56.4  0.4  0.3
 
 The columns are tab separated. I want to load this CSV file and plot the
 histogram of the third or second column. I was able to load the csv file
 using this:
 data=csv2rec('Downloads/Sample.txt',delimiter='\t',skiprows=0)
 The file has 2792 rows including the top header row.
 
 When I do
 data['A'] I get this error:
 ---
 ValueErrorTraceback (most recent call last)
 ipython-input-19-856828b8eaa3 in module()
  1 data['A']
 
 /Library/Python/2.7/site-packages/numpy-1.9.0.dev_297f54b-py2.7-macosx-10.9-intel.egg/numpy/core/records.pyc
 in __getitem__(self, indx)
457
458 def __getitem__(self, indx):
 -- 459 obj = ndarray.__getitem__(self, indx)
460 if (isinstance(obj, ndarray) and obj.dtype.isbuiltin):
461 return obj.view(ndarray)
 
 ValueError: field named A not found
 
 First is data['A'] supposed to read the whole A column? Once I read the
 column I want to be able to plot it. Can I simply do
 hist(data['A'],bins=30) or something like that.
 
 Many thanks,
 AR
 
 
 
 
 --
 View this message in context: 
 http://matplotlib.1069221.n5.nabble.com/Loding-CSV-file-and-plotting-histogram-of-a-particular-column-tp42938.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.
 
 --
 Flow-based real-time traffic analytics software. Cisco certified tool.
 Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
 Customize your own dashboards, set traffic alerts and generate reports.
 Network behavioral analysis  security monitoring. All-in-one tool.
 http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 [hidden email]
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 --
  
 Flow-based real-time traffic analytics software. Cisco certified tool. 
 Monitor traffic, SLAs, QoS, Medianet

Re: [Matplotlib-users] problem with multiple axes

2014-02-07 Thread Sterling Smith
Claude,

Did you try
ax3 = ax1.twinx()
?

-Sterling

On Feb 7, 2014, at 1:30AM, mariusz sapinski wrote:

 Hi,  I'm trying to get a plot with multiple axes on the righ, and it does not 
 work. Attached is the plot: the second axis (ax2) is not correctly plotted. 
 The code is below. What is wrong? Why the labels and ticks are displayed on 
 the left axis?
 
 Many thanks for your suggestions,
 
 Claude
 
 
...
 # Q signal axis:
 ax2 = ax1.twinx()
...
 # Q heaters:
 ax3 = ax2.twinx()


--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] savefig - legend only

2014-01-31 Thread Sterling Smith
Is it legend(loc='auto') or legend(loc='best')?  I always used the latter.  I 
think that http://matplotlib.org/api/legend_api.html supports me here.

-Sterling


On Jan 31, 2014, at 8:31AM, Benjamin Root wrote:

 I would also like to point out that you can specify auto for a location, 
 and matplotlib will attempt to find a good location for you (within the plot 
 area). It isn't perfect, but it can be useful.
 
 Cheers!
 Ben Root
 
 
 On Fri, Jan 31, 2014 at 7:02 AM, Skip Montanaro s...@pobox.com wrote:
  1. PNG file of figure without legend.
  2. PNG file of legend only.
 
  The end user would import both images into another tool (e.g. microsoft
  power point) and arrange figure and legend interactively for the final
  product.
 
 As someone pointed out to me not long ago, you can call
 
 my_legend.draggable(True)
 
 then drag the legend where you want (in normal pointer mode). Then you
 just need to save the figure and not worry about fiddling with it
 later.
 
 Skip Montanaro
 
 --
 WatchGuard Dimension instantly turns raw network data into actionable
 security intelligence. It gives you real-time visual feedback on key
 security issues and trends.  Skip the complicated setup - simply import
 a virtual appliance and go from zero to informed in seconds.
 http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 --
 WatchGuard Dimension instantly turns raw network data into actionable 
 security intelligence. It gives you real-time visual feedback on key
 security issues and trends.  Skip the complicated setup - simply import
 a virtual appliance and go from zero to informed in seconds.
 http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] could I get rid of the contour of Antarctica by using Basemap?

2013-12-30 Thread Sterling Smith
Chao,

I know nothing of the Basemap toolkit so I can't comment on the removal of 
continents, but presumably the text command you are using takes some keywords 
to set the properties of the bounding box.  Try setting the background of the 
bounding box to white so that your words show up cleanly.  Feel free to let me 
know that I'm barking up the wrong tree.

-Sterling

On Dec 30, 2013, at 3:46PM, Chao YUE wrote:

 Dear all,
 
 Happy new year!
 
 I am using Basemap toolkit to make some maps, I would like to 
 write something at the bottom of the map, whose position is now
 taken by the contourf of Antarctica. Is there a way I can keep contours
 of other continents but suppressing the one for antarctica? I attached 
 showing why I would like to have this. 
 
 thanks for any help,
 
 Chao
 -- 
 ***
 Chao YUE
 Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
 UMR 1572 CEA-CNRS-UVSQ
 Batiment 712 - Pe 119
 91191 GIF Sur YVETTE Cedex
 Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
 
 figure_4_new.jpg--
 Rapidly troubleshoot problems before they affect your business. Most IT 
 organizations don't have a clear picture of how application performance 
 affects their revenue. With AppDynamics, you get 100% visibility into your 
 Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
 http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting x tick labels with matshow

2013-12-05 Thread Sterling Smith
Kelson,

Reading the documentation of matshow 
help(matshow)
reveals that it passes most keywords to imshow.  Documentation of imshow 
help(imshow)
says it has an extent keyword to indicate the x and y ranges (instead of the 
array index).  So something like (untested)
matshow(your matrix,extent=(left,right,bottom,top)) #where left is probably 
min(x), right is max(x), etc.
should work.

-Sterling

On Dec 4, 2013, at 5:07PM, Kelson Zawack wrote:

 I am trying to create a figure that plots a data matrix with matshow and has 
 x tick labels corresponding to the x dimension of the matrix.  The x 
 dimension is a series of floats, but they don't correspond to the data matrix 
 cell index values (0,1,2…) that make up what matplotlib obviously thinks are 
 the x values for the plot.  Is there a way that I can set the x tick labels 
 so that they will be laid out and formatted in the normal way for numbers on 
 the x-axis?  It would be great if they also scaled in the normal way when the 
 plot is manipulated in the little gui window.
 
 Thanks for the help.
 --
 Sponsored by Intel(R) XDK 
 Develop, test and display web and hybrid apps with a single code base.
 Download it for free now!
 http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Normalizing Marker Size in Legend

2013-12-05 Thread Sterling Smith
Matthew,

See the discussion at
http://matplotlib.1069221.n5.nabble.com/Legend-Marker-Color-Bug-td38695.html

-Sterling

On Dec 4, 2013, at 3:48PM, Matthew Niznik wrote:

 Hi all,
 
 I have a plot in which I have 15 markers, each with a separate size (created 
 by calls to plot()). Because of this, the legend also shows variable size by 
 default but I'd like all markers in the legend to have the same size.
 
 I'm looking for an alternative to manually calling plot again with a 
 standardized marker size (say 10.0) but plotting offscreen or with NANs. 
 Thoughts I had were to either change the marker sizes after the legend is 
 drawn (but it seems very difficult to update a legend post-creation) or to 
 copy the handles and change the size that way (but I've yet to figure out how 
 to make a hard copy of the plot handles). Any solutions?
 
 -- 
 Matthew Niznik
 --
 Sponsored by Intel(R) XDK 
 Develop, test and display web and hybrid apps with a single code base.
 Download it for free now!
 http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] multi colored text

2013-10-30 Thread Sterling Smith

On Oct 30, 2013, at 7:47AM, Scott Lasley wrote:

 
 On Oct 30, 2013, at 10:14, Neal Becker ndbeck...@gmail.com wrote:
 
 I have a blue line plot and a green line plot.  I'd like to add some figtext 
 at 
 the bottom, and I'd like the text colors to match the plot colors.  So I'd 
 have 
 some text in blue and some in green.
 
 figtext only allows one color
 
 I could use 2 figtext, but then I have to manually find coordinate positions 
 for 
 the text.  That's ugly.
 
 It would be nice if we had a TeX-like approach, where I could create a green 
 text object and a blue text object, then assemble them by stacking boxes.
 
 Any ideas?
 
 I'm not sure it's the best approach, but I've used HPacker (or VPacker if you 
 want more than one line) to do this


I have taken this approach as well. See part of my answer at 
http://stackoverflow.com/questions/17086847/box-around-text-in-matplotlib/17092777#17092777
--
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AttributeError: 'BarContainer' object has no attribute 'autoscale_None'

2013-10-15 Thread Sterling Smith
Nils,

Here is a version that runs through.  It produces two different versions of 
your graph: one with the colors corresponding to the index of the arrays, the 
other with the colors corresponding to the value of the histogram.  I hope this 
helps.

-Sterling

{{{
import re
import os
import sys
import gzip
import numpy as np
import matplotlib.pyplot as plt
import glob
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.colors as colors
import matplotlib.cm as cmx

efratio = np.loadtxt('efratio-10.dat.gz')
hist,bin_edges = np.histogram(efratio,bins=100,range=(0.,1.),density=False)
width = 0.7*(bin_edges[1]-bin_edges[0])
center = (bin_edges[:-1]+bin_edges[1:])/2

coolwarm = cm =  plt.get_cmap('coolwarm')
values = range(100)
for normed in [values,hist]:
cNorm  = colors.Normalize(vmin=0, vmax=max(normed))
scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=coolwarm)
colours = []
for value in normed:
colorVal = scalarMap.to_rgba(value)
colours.append(colorVal)

fig = plt.figure()
ax  = fig.add_subplot(111,projection='3d')
heatmap = ax.bar(center, hist, zs=1, zdir='y', align = 'center', width = 
width,color=colours,linewidth=0)
scalarMap.set_array(normed)
plt.colorbar(scalarMap,ax=ax)
plt.show()
}}}
On Oct 14, 2013, at 6:12AM, Nils Wagner wrote:

 Here is a self contained version.
 
 Nils
 
 
 
 
 On Fri, Oct 11, 2013 at 4:33 PM, Sterling Smith smit...@fusion.gat.com 
 wrote:
 Nils,
 
 I tried to run your example, but there are some variables which are 
 undefined.  Can you post a self contained revision of your example?
 
 -Sterling
 
 On Oct 11, 2013, at 1:34AM, Nils Wagner wrote:
 
  plt.colorbar(scalarMap,ax=ax) results in
 
  cm.py, line 309, in autoscale_None
  raise TypeError('You must first set_array for mappable')
  TypeError: You must first set_array for mappable
 
  Nils
 
 
 
  On Fri, Oct 11, 2013 at 9:51 AM, Eric Firing efir...@hawaii.edu wrote:
  On 2013/10/10 8:52 PM, Nils Wagner wrote:
   Hi all,
  
   I tried to add a colorbar to a bar plot
  
   coolwarm = cm =  plt.get_cmap('coolwarm')
   values = range(100)
   cNorm  = colors.Normalize(vmin=0, vmax=values[-1])
   scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=coolwarm)
   colours = []
   for value in values:
colorVal = scalarMap.to_rgba(value)
colours.append(colorVal)
  
   fig = plt.figure()
   ax  = fig.add_subplot(111,projection='3d')
   hist,bin_edges = 
   np.histogram(efratio,bins=100,range=(0.,1.),density=False)
   width = 0.7*(bin_edges[1]-bin_edges[0])
   center = (bin_edges[:-1]+bin_edges[1:])/2
   heatmap = ax.bar(center, hist, zs=z, zdir='y', align = 'center', width =
   width,color=colours)
   plt.colorbar(heatmap)
  
  
  
  
  
mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
   AttributeError: 'BarContainer' object has no attribute 'autoscale_None'
 
  This is because it is not an instance of ScalarMappable, which is what
  colorbar() requires as its argument.
  
   How can I fix the problem ?
 
  Use scalarMap as the argument instead of heatmap.  I think you will need
  to provide either the cax or the ax kwarg in addition.
 
  examples/api/colorbar_only.py might also be helpful.
 
  Eric
  
   Nils
  
  
  
   --
   October Webinars: Code for Performance
   Free Intel webinars can help you accelerate application performance.
   Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most 
   from
   the latest Intel processors and coprocessors. See abstracts and register 
   http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
  
  
  
   ___
   Matplotlib-users mailing list
   Matplotlib-users@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
 
 
  --
  October Webinars: Code for Performance
  Free Intel webinars can help you accelerate application performance.
  Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most 
  from
  the latest Intel processors and coprocessors. See abstracts and register 
  http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
  --
  October Webinars: Code for Performance
  Free Intel webinars can help you accelerate application performance.
  Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most 
  from
  the latest Intel processors and coprocessors. See abstracts and register 
  http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk___
  Matplotlib

Re: [Matplotlib-users] AttributeError: 'BarContainer' object has no attribute 'autoscale_None'

2013-10-11 Thread Sterling Smith
Nils,

I tried to run your example, but there are some variables which are undefined.  
Can you post a self contained revision of your example?

-Sterling

On Oct 11, 2013, at 1:34AM, Nils Wagner wrote:

 plt.colorbar(scalarMap,ax=ax) results in
 
 cm.py, line 309, in autoscale_None
 raise TypeError('You must first set_array for mappable')
 TypeError: You must first set_array for mappable
 
 Nils
 
 
 
 On Fri, Oct 11, 2013 at 9:51 AM, Eric Firing efir...@hawaii.edu wrote:
 On 2013/10/10 8:52 PM, Nils Wagner wrote:
  Hi all,
 
  I tried to add a colorbar to a bar plot
 
  coolwarm = cm =  plt.get_cmap('coolwarm')
  values = range(100)
  cNorm  = colors.Normalize(vmin=0, vmax=values[-1])
  scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=coolwarm)
  colours = []
  for value in values:
   colorVal = scalarMap.to_rgba(value)
   colours.append(colorVal)
 
  fig = plt.figure()
  ax  = fig.add_subplot(111,projection='3d')
  hist,bin_edges = np.histogram(efratio,bins=100,range=(0.,1.),density=False)
  width = 0.7*(bin_edges[1]-bin_edges[0])
  center = (bin_edges[:-1]+bin_edges[1:])/2
  heatmap = ax.bar(center, hist, zs=z, zdir='y', align = 'center', width =
  width,color=colours)
  plt.colorbar(heatmap)
 
 
 
 
 
   mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
  AttributeError: 'BarContainer' object has no attribute 'autoscale_None'
 
 This is because it is not an instance of ScalarMappable, which is what
 colorbar() requires as its argument.
 
  How can I fix the problem ?
 
 Use scalarMap as the argument instead of heatmap.  I think you will need
 to provide either the cax or the ax kwarg in addition.
 
 examples/api/colorbar_only.py might also be helpful.
 
 Eric
 
  Nils
 
 
 
  --
  October Webinars: Code for Performance
  Free Intel webinars can help you accelerate application performance.
  Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most 
  from
  the latest Intel processors and coprocessors. See abstracts and register 
  http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
 
 
 
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 --
 October Webinars: Code for Performance
 Free Intel webinars can help you accelerate application performance.
 Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
 the latest Intel processors and coprocessors. See abstracts and register 
 http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 --
 October Webinars: Code for Performance
 Free Intel webinars can help you accelerate application performance.
 Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
 the latest Intel processors and coprocessors. See abstracts and register 
 http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems using Matplotlib from a GTK app

2013-10-11 Thread Sterling Smith
Skip,

Here are some lines from an application I have written.

from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg

In the setup:
self.canvas = FigureCanvasGTKAgg(self.figure)
self.canvas.set_size_request(600,600)
self.canvas.show()
#Pack the canvas in a parent container
self.vbox0.pack_start(self.canvas, True, True)

At the event where I want the plot to update:
self.canvas.draw()

For a faster responding application, be sure to check out the matplotlib 
animation examples with blitting, as I built my application without that 
knowledge, and haven't found the time to go back and fix it...

-Sterling

On Oct 11, 2013, at 9:25AM, Skip Montanaro wrote:

 I want to use matplotlib as a component of a larger, event-driven GTK
 app. That means pylab.show is (I think) not the way to go, as it
 starts up its own event loop which doesn't return. I've tried to clear
 and plot in my event handler, but my plot is never displayed.
 
 My initialization code looks like this:
 
matplotlib.use(GtkAgg)

self.figure = matplotlib.figure.Figure()
self.plot = self.figure.add_subplot(111)
self.plot.set_axisbelow(True)
self.figure.tight_layout()
 
 My event handler computes a new set of points (about a dozen x/y
 pairs) and plots them:
 
points = ... generate a list of (x, y) tuples ...
print points
self.plot.clear()
self.plot.plot([x for x, y in points], [y for x, y in points])
 
 Every time my event handler is called, it prints the points (I see
 them in my xterm), but the plot is never drawn.
 
 I looked at this example:
 
 http://matplotlib.org/examples/user_interfaces/embedding_in_gtk2.html
 
 but it does something with a key press handler that seems very
 artificial, and not at all like how my application will interact with
 its environment.  Can someone point me to the correct spot in the
 documentation or some examples that don't require the user to type at
 the application?
 
 Thanks,
 
 Skip
 
 --
 October Webinars: Code for Performance
 Free Intel webinars can help you accelerate application performance.
 Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
 the latest Intel processors and coprocessors. See abstracts and register 
 http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] import matplotlib.pyplot does not work

2013-10-02 Thread Sterling Smith
I highly recommend macports[1] as the method to install matplotlib, as I have 
never had issues.

-Sterling

[1] http://www.macports.org/install.php

On Oct 2, 2013, at 7:39AM, pymilo wrote:

 Hello everyone,
 
 I want to work whit matplotlib and I installed it using pip command.
 Apparently the installation was successful and when I open ipython and
 import matplotlib everything works well. Nevertheless when I try to import
 pyplot using: import matplotlib.pyplot I obtain this:
 
 ---
 ImportError   Traceback (most recent call last)
 ipython-input-11-6f467123fe04 in module()
  1 import matplotlib.pyplot
 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py
 in module()
 22 
 23 import matplotlib
 --- 24 import matplotlib.colorbar
 25 from matplotlib import _pylab_helpers, interactive
 26 from matplotlib.cbook import dedent, silent_list, is_string_like,
 is_numlike
 .
 .
 .
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mathtext.py
 in module()
 60 
 61 import matplotlib.colors as mcolors
 --- 62 import matplotlib._png as _png
 63 
 64 
 
 ImportError:
 dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so,
 2): Symbol not found: _png_set_longjmp_fn
  Referenced from:
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so
  Expected in: flat namespace
 in
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so
 ---
 
 I have installed the libpng library as was suggested in other post but
 nothing worked. I am working with a Mac OS X 10.7.5 and I have installed the
 XQuartz 2.7.4. I really do not have a clue about what is happening with
 that, I would appreciate so much if you can help me figure this problem out.
 
 
 All the best!
 Milo.
 
 
 
 
 
 
 --
 View this message in context: 
 http://matplotlib.1069221.n5.nabble.com/import-matplotlib-pyplot-does-not-work-tp42155.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.
 
 --
 October Webinars: Code for Performance
 Free Intel webinars can help you accelerate application performance.
 Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
 the latest Intel processors and coprocessors. See abstracts and register 
 http://pubads.g.doubleclick.net/gampad/clk?id=60134791iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134791iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] x axis non-uniform labeling (KURT PETERS)

2013-10-01 Thread Sterling Smith

On Oct 1, 2013, at 11:01AM, Jody Klymak wrote:

 
 On Oct 1, 2013, at  10:55 AM, KURT PETERS petersk...@msn.com wrote:
 
 Goyo,
   Thanks, the code below seems to work.  The problem is that with 
 REAL/actual data, I have SO many data points that each point is now 
 labeled and it takes forever to render.  And when it does render, I cannot 
 read the axis because there are too many there.  Is there a way to 
 judiciously have it only display a certain number of values?  Such as every 
 100th value?
 Kurt
 
 ax2.set_xticks(xdat)
 ax2.set_xticklabels(simtimedata)
 
 ax2.set_xticks(xdat[::100])
 ax2.set_xticklabels(simtimedata[::100])
 
 Cheers,  Jody
 
I thought that, too, but then he used the word 'judiciously'.  I think that you 
want to change the xaxis major formatter so that it returns the indexed element 
of simtimedata as the label.  Example to come in a moment.
-Sterling


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134791iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] x axis non-uniform labeling (KURT PETERS)

2013-10-01 Thread Sterling Smith

On Oct 1, 2013, at 8:59AM, KURT PETERS wrote:

 
 REPLY:
 
  
 here's what SHOULD be happening
  
 | 0   1   5  9 13 18 21 24 25 28
  3 | x
 |x  x
 |   xx
 |   x x
 -1|_x__x_
12  3   4  56   7   8   9  10
  
 How can I make that happen?  Instead, MPL is autoranging the top axis.  I 
 don't want that   I just want the actual labels to occur up there.
  
 Kurt

Kurt,

Here is a self-contained example of what I think you are asking for:

{{{
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FuncFormatter, MaxNLocator

simtimedata = np.array([0, 1, 5, 9, 13, 18, 21, 24, 25, 28, 31, 32, 41, 55, 56, 
57])
idatanp = np.array([-1,0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0, -1, -2])
xdat = range(len(simtimedata))
fig = plt.figure()

ax1 = fig.add_subplot(211)
ax1.plot(xdat,idatanp)
ax1.grid(True)
ax2 = fig.add_subplot(212)
ax2.plot(xdat, idatanp.real,'k-o')
def index_to_label(i,dummy):
if i = 0 and i  len(simtimedata):
return str(simtimedata[i])
else:
return ''

form = FuncFormatter(index_to_label)
ax2.xaxis.set_major_formatter(form)

#ax2.set_title(time domain)
ax2.grid(True)
plt.show()
}}}

You may also be interested in this question and answer on stackoverflow:
http://stackoverflow.com/questions/3918028/how-do-i-plot-multiple-x-or-y-axes-in-matplotlib

-Sterling


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134791iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to control the y feedback value?

2013-09-19 Thread Sterling Smith

On Sep 19, 2013, at 10:14AM, Skip Montanaro wrote:
 
 Separately, if your blue data are so quantized, you might use the blue data 
 to choose a color for an axvspan (or axhspan, I  forget which is which) to 
 indicate how certain regions of time have different values of blue data.  
 Then you would only need one set of axes, and your x,y labels would indicate 
 what you want.
 
 This also works, though I (and anyone looking at the graph) would have
 to remember the mapping between color and numeric value. If I was a
 synethete this might work, but I doubt most people would automatically
 recall the mapping. :-)

No assumption of super-human recollection or inference abilities . I would add 
a figure or axes legend with proxy artists for the appropriate color mappings, 
or even just a bunch of text boxes with the text label colored appropriately.  
You may be interested in my answer to a stackoverflow question [1].

-Sterling

[1] 
http://stackoverflow.com/questions/17086847/box-around-text-in-matplotlib/17092777#17092777
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to control the y feedback value?

2013-09-19 Thread Sterling Smith
Skip,

I assume that you are using a twinx call to get the second y axis.  I think 
that this question has come up before, and I think the solution was to switch 
which data are put on the second set of axes.  (Of course to keep the same 
visual layout you would have to play with the y axis spine locations.)  

Separately, if your blue data are so quantized, you might use the blue data to 
choose a color for an axvspan (or axhspan, I  forget which is which) to 
indicate how certain regions of time have different values of blue data.  Then 
you would only need one set of axes, and your x,y labels would indicate what 
you want.

-Sterling

On Sep 19, 2013, at 7:46AM, Skip Montanaro wrote:

 I have a plot which uses both the left and right y axes.  See
 attached. Note that the feedback in the lower right-hand corner
 displays the value on the right y axis (the blue plot). That's not a
 very interesting value though. How can I control which value is
 displayed as I move the cursor around the graph? Is it something
 control interactively with a modifier key?  I tried a few, but saw no
 change. I'm currently using matplotlib v 1.1.0 (alas, something which
 is also out of my control).
 
 Thanks,
 
 Skip
 axes.png--
 LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
 Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
 http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib V1.3 suptitle

2013-08-23 Thread Sterling Smith

On Aug 23, 2013, at 7:43AM, Benjamin Root wrote:

 
 
 On Fri, Aug 23, 2013 at 9:57 AM, Peter Bloomfield 
 peter.bloomfi...@camhpet.ca wrote:
 Good morning,
 
 I am running openSuSE 12.2, and this morning I upgraded matplotlib to v1.3, 
 and now I am having a problem with suptitle.
 I use the following lines to put a title and legend onto a plot figure
 
 import matplotlib.pyplot as plt
 plt.figure(1)
 plt.suptitle( Study# :  + os.path.basename( inImage_IO.IO_FileName ) + \
 \n + { Acquired :  + \
 AcqDateTime.strftime( %b %d, %Y - $T_o$ @ %H:%M:%S ) +  }, \
 y=0.98, weight=roman, size=large )
 plt.suptitle( {Creation Date :  + AnalysisTOD + },
 x=0.86, y=0.03, weight=roman, size=x-small )
 
 Under v1.3, I only get the 'Creation Date : ...' text at the bottom of the 
 figure the 'Study# ...' string is not present at the top. If I change
 it to
 
 import matplotlib.pyplot as plt
 plt.figure(1)
 plt.suptitle( Study# : , y=0.98, weight=roman, size=large )
 plt.suptitle( {Creation Date :  + AnalysisTOD + },
 x=0.86, y=0.03, weight=roman, size=x-small )
 
 the 'Creation Date : ...' text at the bottom of the figure the 'Study# : ' 
 string is at the top.
 
 So the problem is in the string construct in the first example. Does anybody 
 know of a way to get around this?
 
 Thanks in advance
 
 Peter
 
 
 Oh, wow... we didn't think anybody was using that misfeature.  This was a 
 bug we fixed for 1.3, in that users complained that calling plt.title() would 
 update an existing title, but plt.suptitle() would not (multiple calls would 
 just result in text overlaid on top of each other).  We fixed this for 1.3 so 
 that there is a single text object that is kept and is revised in subsequent 
 calls to suptitle().  To get what you want, you will have to consolidate 
 those strings into one.
 
 Cheers!
 Ben
Ben,

I am glad for the fix.

Peter,

You could use 
gcf().text(x,y,'String 1',**keyw)
gcf().text(x2,y2,'String 2',**keyw)

-Sterling
--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Intersecting polygons

2013-08-23 Thread Sterling Smith
 
 
 PS. Try to convince the Dark Powers of the journal you send your work, 
 that they modernize their processing and accept PDF.
+1

--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to make mat.figure.Figure.add_axes generated axes adjustable with the interactive tool?

2013-07-29 Thread Sterling Smith
Chao,

From your description, it is clear that you are using a very customized 
application of axes placement and design.  The only method that I see for 
replacing your current setup with Subplots (I use the upper case to denote the 
instances of the class, which do respond to the left/right/wspace parameters) 
is the following (untested):
{{{
fig,axs = plt.subplots(2,3)
for i,ax in enumerate(axs.flat):

ax.plot(time,data)
ymin,ymax = ax.get_ylim()
ax.set_ylim(ymin=ymin,ymax=ymin+2*(ymax-ymin))
labels = ax.get_yticklabels()
for l in labels:
if float(l.get_text())  ymax:
l.set_visible(False)
ax2 = ax.twinx()
ymin,ymax = ax2.get_ylim()
ax2.set_ylim(ymin=ymax-2*(ymax-ymin),ymax=ymax)
labels = ax2.get_yticklabels()
for l in labels:
if float(l.get_text())  ymin:
l.set_visible(False)

}}}

Some of this is inspired by http://matplotlib.org/examples/api/two_scales.html 
and similar examples/applications.

Hope that helps,
Sterling

On Jul 27, 2013, at 6:10AM, ChaoYue wrote:

 Hi, thanks.
 
 the attached is what I achieved so far. Looks quite nice.
 
 each subplot visible now actually contains two mat.axes.Axes object (with 
 bottom and top spines invisible)
 which is created by using the fig.add_axes, before the place occupied by the 
 two axes now is actually
 only one single subplot ojbect, which is created by using fig,axs = 
 plt.subplots(2,3). something like this:
 
 for ax in axs.flatten():
  #some way to find the position of the two new axes
  sub1 = fig.add_axes()
  sub2 = fig.add_axes()
  fig.delaxes(ax)
 
 Now the problem is that all the original subplots have been removed, replaced 
 by 2X6 mat.axes.Axes,
 But they don't respond to any operation in the interacitve window (like, you 
 can use your mouse to select
 the left/righ/wspace etc)
 
 I hope I am clear. thanks!
 
 cheers,
 
 Chao
 
 On Fri, Jul 26, 2013 at 5:55 PM, Sterling Smith [via matplotlib] [hidden 
 email] wrote:
 Chao, 
 
 You are right, fig.add_subplot does not support precise positioning.  Why 
 don't you send a picture of a sample layout you have obtained with add_axes? 
 
 -Sterling 
 
 On Jul 26, 2013, at 1:26AM, ChaoYue wrote: 
 
  Dear Sterling, 
  
  thanks for your answer. The idea is that I would like to add a subplot with 
  precise position, as in the method of fig.add_axes? 
  Does fig.add_subplot support this, I tried 
  fig.add_subplot(position=(0.2,0.2,0.1,0.1)) but it does not work... 
  
  thanks! 
  
  Chao 
  
  On Thu, Jul 25, 2013 at 8:09 PM, Sterling Smith [via matplotlib] [hidden 
  email] wrote:
 
  Chao, 
  
  plt.subplots returns a figure instance.  Can you use the add_subplot method 
  of that figure instance to make your new axes?  If so, then I think that 
  they should respond to the new requests for left/right/bottom/wspace space. 
  
  -Sterling 
  
  On Jul 25, 2013, at 10:06AM, Chao YUE wrote: 
  
   Dear all, 
   
   First I make some subplots using the plt.subplots command, 
   then I use mat.figure.Figure.delaxes to delete the axes, and add some 
   small new ones 
   in the same space by using mat.figure.Figure.add_axes, but I find after 
   rendering the 
   figure in the interative window, I cannot adjust the 
   left/right/bottom/wspace etc in a 
   interactive way, the old subplots that are generated using plt.subplots 
   command will 
   move, and the new ones generated using mat.figure.Figure.add_axes just 
   don't 
   move at all, so what should I do if I want the new ones also move? 
   Because 
   the interative window is really useful when you want to have figures 
   quickly. 
   
   thanks a lot for any hints. 
   
   cheers, 
   
   Chao 
   
   -- 
   ***

   Chao YUE 
   Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) 
   UMR 1572 CEA-CNRS-UVSQ 
   Batiment 712 - Pe 119 
   91191 GIF Sur YVETTE Cedex 
   Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 
   

   --

   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=48808831iu=/4140/ostg.clktrk___
   Matplotlib-users mailing list
 
   [hidden email] 
   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

Re: [Matplotlib-users] how to make mat.figure.Figure.add_axes generated axes adjustable with the interactive tool?

2013-07-26 Thread Sterling Smith
Chao,

You are right, fig.add_subplot does not support precise positioning.  Why don't 
you send a picture of a sample layout you have obtained with add_axes?

-Sterling

On Jul 26, 2013, at 1:26AM, ChaoYue wrote:

 Dear Sterling,
 
 thanks for your answer. The idea is that I would like to add a subplot with 
 precise position, as in the method of fig.add_axes?
 Does fig.add_subplot support this, I tried 
 fig.add_subplot(position=(0.2,0.2,0.1,0.1)) but it does not work...
 
 thanks!
 
 Chao
 
 On Thu, Jul 25, 2013 at 8:09 PM, Sterling Smith [via matplotlib] [hidden 
 email] wrote:
 Chao, 
 
 plt.subplots returns a figure instance.  Can you use the add_subplot method 
 of that figure instance to make your new axes?  If so, then I think that they 
 should respond to the new requests for left/right/bottom/wspace space. 
 
 -Sterling 
 
 On Jul 25, 2013, at 10:06AM, Chao YUE wrote: 
 
  Dear all, 
  
  First I make some subplots using the plt.subplots command, 
  then I use mat.figure.Figure.delaxes to delete the axes, and add some small 
  new ones 
  in the same space by using mat.figure.Figure.add_axes, but I find after 
  rendering the 
  figure in the interative window, I cannot adjust the 
  left/right/bottom/wspace etc in a 
  interactive way, the old subplots that are generated using plt.subplots 
  command will 
  move, and the new ones generated using mat.figure.Figure.add_axes just 
  don't 
  move at all, so what should I do if I want the new ones also move? Because 
  the interative window is really useful when you want to have figures 
  quickly. 
  
  thanks a lot for any hints. 
  
  cheers, 
  
  Chao 
  
  -- 
  ***
   
  Chao YUE 
  Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) 
  UMR 1572 CEA-CNRS-UVSQ 
  Batiment 712 - Pe 119 
  91191 GIF Sur YVETTE Cedex 
  Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 
  
  --
   
  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=48808831iu=/4140/ostg.clktrk___
  Matplotlib-users mailing list 
  [hidden email] 
  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=48808831iu=/4140/ostg.clktrk
 ___ 
 Matplotlib-users mailing list 
 [hidden email] 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 If you reply to this email, your message will be added to the discussion 
 below:
 http://matplotlib.1069221.n5.nabble.com/how-to-make-mat-figure-Figure-add-axes-generated-axes-adjustable-with-the-interactive-tool-tp41610p41611.html
 To start a new topic under matplotlib - users, email [hidden email] 
 To unsubscribe from matplotlib, click here.
 NAML
 
 
 
 -- 
 ***
 Chao YUE
 Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
 UMR 1572 CEA-CNRS-UVSQ
 Batiment 712 - Pe 119
 91191 GIF Sur YVETTE Cedex
 Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
 
 
 View this message in context: Re: how to make mat.figure.Figure.add_axes 
 generated axes adjustable with the interactive tool?
 Sent from the matplotlib - users mailing list archive at Nabble.com.
 --
 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=48808831iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 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

Re: [Matplotlib-users] how to make mat.figure.Figure.add_axes generated axes adjustable with the interactive tool?

2013-07-25 Thread Sterling Smith
Chao,

plt.subplots returns a figure instance.  Can you use the add_subplot method of 
that figure instance to make your new axes?  If so, then I think that they 
should respond to the new requests for left/right/bottom/wspace space.

-Sterling

On Jul 25, 2013, at 10:06AM, Chao YUE wrote:

 Dear all,
 
 First I make some subplots using the plt.subplots command,
 then I use mat.figure.Figure.delaxes to delete the axes, and add some small 
 new ones
 in the same space by using mat.figure.Figure.add_axes, but I find after 
 rendering the
 figure in the interative window, I cannot adjust the left/right/bottom/wspace 
 etc in a
 interactive way, the old subplots that are generated using plt.subplots 
 command will
 move, and the new ones generated using mat.figure.Figure.add_axes just don't
 move at all, so what should I do if I want the new ones also move? Because 
 the interative window is really useful when you want to have figures quickly.
 
 thanks a lot for any hints.
 
 cheers,
 
 Chao
 
 -- 
 ***
 Chao YUE
 Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
 UMR 1572 CEA-CNRS-UVSQ
 Batiment 712 - Pe 119
 91191 GIF Sur YVETTE Cedex
 Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
 
 --
 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=48808831iu=/4140/ostg.clktrk___
 Matplotlib-users mailing list
 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=48808831iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib backend issue

2013-07-22 Thread Sterling Smith

On Jul 20, 2013, at 3:04PM, Tommy Grav wrote:

 On Jul 20, 2013, at 11:19 AM, Michiel de Hoon mjldeh...@yahoo.com wrote:
 
 Ok, so with a long list of print statements I have tracked it down to 
 the statement
 
 import matplotlib._png as _png
 
 in image.py. 

Tommy,

Instead of a lot of print statements, you can use
python -v
if you are starting from a python interpreter.

-Sterling

--
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=48808831iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamically change X time format while zooming plot?

2013-07-12 Thread Sterling Smith
Skip,

I am not at all familiar with dates in matplotlib, but what does plt.xlim() 
yield?  Or are the limits not updated before calling the tick formatter?

-Sterling

On Jul 12, 2013, at 8:49AM, Skip Montanaro wrote:

 Let me return to my FuncFormatter usage.  As I indicated in an earlier
 post, I made a single format decision based on the x range of the
 entire data set.  The decision code was straightforward:
 
x_delta = x_range[1] - x_range[0]
if x_delta  int(1.5 * 365) * ONE_DAY:
xfmt = %Y-%m-%d
elif x_delta  2 * ONE_DAY:
xfmt = %m/%d\n%H:%M
elif x_delta  2 * ONE_HOUR:
xfmt = %H:%M:%S
else:
xfmt = %H:%M
 
 How do I compute x_delta as it relates to the currently visible
 window?  In the above code, x_range represents the x range of my
 entire data set.
 
 Thx,
 
 Skip
 
 --
 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=48808831iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 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=48808831iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hovemuller Diagram

2013-07-12 Thread Sterling Smith
Sudheer,

Although the documentation is not consistent with the following (as of v1.0.1), 
the X and Y arguments to contourf can be 1D arrays.  Consider:
 from pylab import *
 x=range(100)
 y=range(20)
 xx,yy=meshgrid(x,y)
 z=xx**2+yy**2
 contourf(x,y,z)
matplotlib.contour.QuadContourSet instance at 0x114e5fa28

-Sterling

On Jul 12, 2013, at 6:22PM, Sudheer Joseph wrote:

 Hi,
 
 I did not understand 1d mentioned by you? for a diagram like this 2D is must 
 as it need longitude /latitude and also time
 with best regards,
 Sudheer
 
 From: Andrew Dawson daw...@atm.ox.ac.uk
 
 To: Phil Elson pelson@gmail.com 
 Cc: Sudheer Joseph sudheer.jos...@yahoo.com; 
 matplotlib-users@lists.sourceforge.net 
 matplotlib-users@lists.sourceforge.net 
 Sent: Friday, 12 July 2013 1:28 PM
 Subject: Re: [Matplotlib-users] Hovemuller Diagram
 
 
 
 As long as you use contour or contourf and your coordinates are 1d you 
 should be able to do this no problem, just like Phil said. However, there is 
 a bug that will prevent you from using pcolormesh or pcolor unfortunately.
 
 
 Andrew
 
 
 
 On 12 July 2013 08:51, Phil Elson pelson@gmail.com wrote:
 
 The balance of time to install vs time to re-implement a feature is only 
 something you can decide, but i suspect it is worth your while getting iris 
 installed (I would say that as an iris developer though). The installation 
 process is only going to get easier over time, for instance last week we 
 added a PPA so that with the necessary repos added you would be able to 
 apt-get install python-iris on an Ubuntu machine - for other installation 
 guides there is a repository of recipes ( 
 https://github.com/SciTools/installation-recipes ).
 As for achieving this without iris, it is perfectly feasible. You just need 
 to contourf your data with the longitude as your x coordinate and the date 
 times as your y coordinate. From memory you might also need to tell 
 matplotlib that the y coordinate is date/time (I think that is a mpl bug 
 that ajdawson has recently addressed). Obviously, basemap is not needed as 
 you are not drawing a longitude/latitude plot but a longitude/time or 
 latitude/time one.
 HTH,
 Phil
 
 
 
 On 11 July 2013 19:06, Sudheer Joseph sudheer.jos...@yahoo.com wrote:
 
 Thank you Signell,
I was looking for better looking labels as well as 
 a solution with in matplotlib without needing to install additional 
 packages. I had some trouble with some libraries while trying to install 
 iris. I was wondering if it is possible with in matplotlib with out 
 additional installations using the features of basemap package.
 
 with best regards,
 Sudheer
 
 
  
 ***
 Sudheer Joseph
 Indian National Centre for Ocean Information Services
 Ministry of Earth Sciences, Govt. of India
 POST BOX NO: 21, IDA Jeedeemetla P.O.
 Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
 Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
 E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
 Web- http://oppamthadathil.tripod.com
 ***
 
 
 - Original Message -
 From: Signell, Richard rsign...@usgs.gov
 To: Sudheer Joseph sudheer.jos...@yahoo.com
 Cc:
 Sent: Friday, 12 July 2013 12:41 AM
 Subject: Re: [Matplotlib-users] Hovemuller Diagram
 
 I don't think I understand your problem.  Are you just trying to get
 nicer looking tick labels?
 
 
 On Thu, Jul 11, 2013 at 11:03 AM, Sudheer Joseph
 sudheer.jos...@yahoo.com wrote:
  Thanks Signell,
I had seen it but it is not the correct type with
 Longitude axis, it is having just numbers on x axis I expect axis like 
 the ones
 we get from basemap package.
 
  with best regards,
  sudheer
 
 
 
  ***
  Sudheer Joseph
  Indian National Centre for Ocean Information Services
  Ministry of Earth Sciences, Govt. of India
  POST BOX NO: 21, IDA Jeedeemetla P.O.
  Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
  Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
  Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
  E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
  Web- http://oppamthadathil.tripod.com
  ***
 
 
 
  - Original Message -
  From: Signell, Richard rsign...@usgs.gov
  To: Sudheer Joseph sudheer.jos...@yahoo.com
  Cc:
  Sent: Thursday, 11 July 2013 7:20 PM
  Subject: Re: [Matplotlib-users] Hovemuller Diagram
 
  http://scitools.org.uk/iris/docs/v1.0/examples/graphics/hovmoller.html
 
  On Thu, Jul 11, 2013 at 5:40 AM, Sudheer Joseph
  sudheer.jos...@yahoo.com wrote:
 
   Dear All,
Is there a straight forward way to get
   Hovemuller diagram or longitude/latitude vs time plot using
 matplotlib.
   If possible please send me some examples if any one know it
 

Re: [Matplotlib-users] legend marker update problem

2013-05-17 Thread Sterling Smith
Gregorio,

I'm glad that helped.  I have not reported it on the issue tracker, but your 
case certainly has more of a bug with it (where it works sometimes, but not 
always), so I would recommend it.  

-Sterling

On May 17, 2013, at 2:10AM, Gregorio Bastardo wrote:

 Hi Sterling,
 
 Thanks for the hint, using line._legmarker attribute solved the problem.
 
 I see the reason behind, however I still consider this as an incorrect
 behaviour, since marker toggling works in case the line is originally
 added to the legend without marker (so legend line and marker do not
 behave like separated). Is it worth reporting on the mpl issue tracker
 (or have you done it that time)?
 
 Gregorio
 
 2013/5/16 Sterling Smith smit...@fusion.gat.com:
 Gregorio,
 
 I experienced a similar issue with trying to change the marker color.
 
 See below the previous response from JJ for accessing the legend marker or 
 using a proxy artist.
 
 -Sterling
 


--
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] legend marker update problem

2013-05-16 Thread Sterling Smith
Gregorio,

I experienced a similar issue with trying to change the marker color.  

See below the previous response from JJ for accessing the legend marker or 
using a proxy artist.

-Sterling

 On Sep 4, 2012, at 5:33PM, Jae-Joon Lee wrote:
 
 On Wed, Sep 5, 2012 at 6:05 AM, Sterling Smith smit...@fusion.gat.com wrote:
 I still do not get black markers.  Furthermore, if you try to make a new 
 legend with the result of leg.get_lines(), you will get lines without 
 markers, which leads me to the conclusion I stated in my previous email 
 (which you did not copy)
 I suspect that this is because the legend marker is drawn separately from 
 the legend line to accommodate the numpoints argument of the legend 
 functions.  Then the question is how to access these markers if they are 
 separate from the line2d objects in the legend.  I didn't even see them in 
 the children of the legend [legend.get_children()].
 
 This is correct. To support legend handle like --o-- (i.e., no markers
 at the ends), lines and markers are drawn as a separate artist. You
 may use something like,
 
 line[0]._legmarker.set_markerfacecolor('black')
 line[1]._legmarker.set_markerfacecolor('black')
 
 I, personally, recommend you to use a proxy artist.
 
 http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
 
 For example,
 
 You may do something like
 
 import pylab
 pylab.plot(pylab.linspace(0,1,100),marker='o',ls='')
 pylab.plot(pylab.linspace(0,1,100),marker='o',ls='-')
 
 # creates artists for legend purpose only
 l1, = pylab.plot(pylab.linspace(0,1,100), 'ko-')
 l2, = pylab.plot(pylab.linspace(0,1,100), 'ko')
 # remove them from the axes.
 l1.remove()
 l2.remove()
 
 leg=pylab.legend([l1, l2], [Test 1, Test 2], loc='best')
 
 Regards,
 
 -JJ
On May 16, 2013, at 7:25AM, Gregorio Bastardo wrote:

 Hi,
 
 I've recently come accross an issue when working on an interactive
 marker toggling callback. The problem is illustrated below:
 
 import matplotlib.pyplot as plt
 fig = plt.figure()
 ax = fig.add_subplot(111)
 line, = ax.plot(range(10), range(10))
 # uncomment next line to reproduce bug
 # line.set_marker('d')
 legend = ax.legend([line], ['foo'])
 legend_line, = legend.get_lines()
 fig.show()
 raw_input('press enter to clear marker')
 line.set_marker('')
 legend_line.set_marker('')
 fig.canvas.draw()
 raw_input('press enter to set marker')
 line.set_marker('d')
 legend_line.set_marker('d')
 fig.canvas.draw()
 raw_input('press enter to exit')
 
 So when I add a line object to the legend *without marker*, the update
 works fine both on data and legend line, but *with marker* it does not
 refresh the legend line. I consider it as a bug, please tell me if I'm
 doing something wrong.
 
 python 2.7.4 win32
 matplotlib 1.2.1
 
 Thanks,
 Gregorio
 
 --
 AlienVault Unified Security Management (USM) platform delivers complete
 security visibility with the essential security capabilities. Easily and
 efficiently configure, manage, and operate all of your security controls
 from a single console and one unified framework. Download a free trial.
 http://p.sf.net/sfu/alienvault_d2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Individual custom markers and colorbar

2013-04-26 Thread Sterling Smith
Notwithstanding these probably work (I haven't tried), my gut reaction would 
have been to color the edges the same as the face, although I don't know if you 
can give set_edgecolor the same cmap(colors_norm) argument.

-Sterling

On Apr 26, 2013, at 5:30AM, Ryan Nelson wrote:

 Hackstein,
 
 Francesco's suggestion works for me.
 col.set_edgecolor( 'none' )
 
 You can also set the linewidth to be 0.
 col.set_linewidth( 0 )


--
Try New Relic Now  We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app,  servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-19 Thread Sterling Smith
I have used the TkAgg backend in python2, installing the dependencies by hand.  
Is this backend not available for python3?

-Sterling

On Apr 18, 2013, at 8:03PM, John Ladasky wrote:

 Thanks to both Francesco Montesano and Benjamin Root.  I have done some 
 reading.  And I have made some progress, though I am not quite where I 
 want to be yet.
 
 So the problem appears to be that the only backend for which I had 
 suitable Python 3 libraries was agg.  It only requires libpng, which I 
 have.  I can render a Matplotlib canvas, but it appears that the only 
 output that agg offers is in the form of PNG files to disk.  I cannot 
 create a live window on the screen.
 
 Reading more, I realize that the way I was getting GUI output previously 
 (with Python 2.7 and Matplotlib 1.1) was through wxPython.  
 Unfortunately, it appears that wxPython's star is fading, and a Python 
 3-compatible version will not be written.  In fact, wxPython hasn't 
 released a new version in nine months.
 
 The other choices for Matplotlib GUI output on Linux appear to be 
 through GTK, PySide, and PyQt.  I am not familiar with GTK, but I know 
 that it is widely-used.  Also, GTK appears to be Python 3-compatible, 
 and so that is where I need to go.
 
 I'm going through a trial and error process.  Unfortunately, the names 
 of the repositories in Ubuntu are not very helpful.  I installed a few 
 GTK and python-gtk related packages that I thought were relevant.  On my 
 first build attempt I got no errors, but also, I didn't get a GTKAgg 
 backend.  Upon re-reading, I saw that I should modify matplotlib's 
 setup.cfg file to force a GTK build attempt, and to report errors if it 
 fails. That's what it does.  In the optional backend dependencies 
 section I am not seeing any GTK libraries listed, even though I have 
 installed python-gtk2-dev (2.24.0), python-gobject-2-dev (2.28.6), 
 libgtk2.0-dev (2.24.10), libglib2.0-dev (2.32.3), python-gi-dev (3.2.2), 
 python-gobject-dev (3.2.2), python3-gi (3.2.2), and a few DOZEN packages 
 on which these depend.
 
 If anyone knows the way forward from here, I would appreciate your 
 advice.  Thanks again.
 
 --
 Precog is a next-generation analytics platform capable of advanced
 analytics on semi-structured data. The platform includes APIs for building
 apps and a phenomenal toolset for data science. Developers can use
 our toolset for easy data analysis  visualization. Get a free account!
 http://www2.precog.com/precogplatform/slashdotnewsletter
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to add number near point of scatter plot?

2013-04-06 Thread Sterling Smith
See
plt.text
and 
plt.annotate

See http://matplotlib.org/users/annotations_guide.html and references therein.

-Sterling

On Apr 6, 2013, at 3:54PM, Zhu, Shenli wrote:

 How to add number near point of scatter plot?
 e.g. I have two point 1 is (1,3) and point 2 (2,4), how can I add 1
 and 2 to scatter plot near these two points? Thanks!
 
 import matplotlib.pyplot as plt
 x = [1,2]
 y = [3,4]
 plt.scatter(x, y)
 plt.show()
 
 
 
 --
 Minimize network downtime and maximize team effectiveness.
 Reduce network management and security costs.Learn how to hire 
 the most talented Cisco Certified professionals. Visit the 
 Employer Resources Portal
 http://www.cisco.com/web/learning/employer_resources/index.html
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trouble with legend and axis scaling

2013-03-27 Thread Sterling Smith
Frix,

I get the same error for your first example with v1.1.1 [although I had to 
comment out the med_r = np.median(x_r) to get it to run].  You should probably 
file a bug at [1].

I get the same result for your yaxis.  You need to change the formatter to 

ax.yaxis.set_major_formatter(plt.ScalarFormatter(useOffset=False))

-Sterling

[1] https://github.com/matplotlib/matplotlib/issues

On Mar 27, 2013, at 7:09AM, Hackstein wrote:

 Sterling,
 
 I'm using matplotlib version 1.2.0 with agg backend.
 
 Here are two code examples, one for each problem. The first one doesn't save 
 the figure due to the legend problem, seterr causes the script to stop with 
 an error at that position.
 The second example shows the scientific labels on the y-axis, although it 
 should be disabled in the code. I can't get the y-axis to display plain 
 labels. 
 
 First example:
 [code]
 import numpy as np
 np.seterr(all='raise')
 import matplotlib.pyplot as plt
 
 x_i = [11.7574075935, 11.66520713579, 11.6762413105, 11.6580992311, 
 11.65636838851]
 x_r = []
 dates = [2.83611000e-01,   2.69330463e+02,   2.70280648e+02,   
 2.71359248e+02,   2.72320822e+02]
 
 diff = 0.16
 ra = [0., 110.5349726]
 dec = [0., -16.1061281]
 med_i = np.median(x_i)
 med_r = np.median(x_r)
 
 plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
 if x_r == []:
   plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
   plt.title('i_mag', fontsize='16')
 else:
   plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s')
   plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
   plt.title('i_mag', fontsize='16')
 plt.rcParams['xtick.major.pad']=10
 plt.rcParams['ytick.major.pad']=10
 ax = plt.gca()
 ax.title.set_y(1.1)
 formy = plt.ScalarFormatter()
 formy.set_powerlimits((-5, 5))
 formy.set_scientific(False)
 ax.yaxis.set_major_formatter(formy)
 ax.set_ylim(ax.get_ylim()[::-1])
 for tick in ax.xaxis.get_major_ticks():
   tick.label.set_fontsize(16)
 for tick in ax.yaxis.get_major_ticks():
   tick.label.set_fontsize(16)
 plt.xlabel('Days', fontsize='20', labelpad=20)
 plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
 
 if x_r == []:
   plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
  numpoints=1, ncol=2, borderaxespad=0.)
 else:
   plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
  numpoints=1, ncol=2, borderaxespad=0.)
 leg = plt.gca().get_legend()
 ltext = leg.get_texts()
 plt.setp(ltext, fontsize='16')
 plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
 plt.close(i_only)
 [/code]
 
 Second example:
 [code]
 import numpy as np
 import matplotlib.pyplot as plt
 
 y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168, 
 11.12513415219]
 y_r = [11.14866716899, 11.10194503, 11.11235246531, 
 11.11168787179, 11.1214449011]
 dates_i = [2.83611000e-01,   2.69330463e+02, 2.70280648e+02,   
 2.72320822e+02, 2.73250579e+02]
 dates_r = [311.28215,   324.25844,   325.25194,   330.20983,   338.21356]
 
 diff = 0.16
 ra = [112.5379659, 110.5349726]
 dec = [ -15.9841039, -16.1061281]
 med_i = np.median(y_i)
 med_r = np.median(y_r)
 
 plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
 if y_r == []:
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
 else:
plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
 plt.rcParams['xtick.major.pad']=10
 plt.rcParams['ytick.major.pad']=10
 ax = plt.gca()
 ax.title.set_y(1.1)
 formy = plt.ScalarFormatter()
 formy.set_powerlimits((-5, 5))
 formy.set_scientific(False)
 ax.yaxis.set_major_formatter(formy)
 ax.set_ylim(ax.get_ylim()[::-1])
 for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(16)
 for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(16)
 plt.xlabel('Days', fontsize='20', labelpad=20)
 plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
 
 if y_r == []:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
 else:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
 leg = plt.gca().get_legend()
 ltext = leg.get_texts()
 plt.setp(ltext, fontsize='16')
 plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
 plt.close(i_only) 
 [/code]
 
 Best regards,
 
 frix
 
 
 Am 26.03.2013 um 20:36 schrieb Sterling Smith smit...@fusion.gat.com:
 
 Frix,
 
 It may be useful to post the version and backend you are using to the list.
 
 import matplotlib
 print matplotlib.__version__
 print matplotlib.get_backend()
 
 Also, if you can format the code as a simple self-contained example, that 
 would help others confirm what you are seeing.
 
 -Sterling
 
 On Mar 26, 2013, at 12:01PM, Hackstein wrote:
 
 Hello everyone,
 
 I have two issues with my

Re: [Matplotlib-users] Squashed axes with AxesGrid

2013-03-22 Thread Sterling Smith
Steven,

Did you mean to switch back to AxesGrid?  I thought you said that it was fixed 
with Grid.

-Sterling

On Mar 22, 2013, at 9:30AM, Steven Boada wrote:

 Well... I jumped the gun. To better illustrate the problem(s) I am having, I 
 wrote a simple script that doesn't work...
 
 import pylab as pyl
 from mpl_toolkits.axes_grid1 import AxesGrid
 
 # make some data
 xdata = pyl.random(100) * 25.
 ydata = pyl.random(100) * 8.
 colordata = pyl.random(100) * 3.
 
 # make us a figure
 F = pyl.figure(1,figsize=(5.5,3.5))
 grid = AxesGrid(F, 111,
nrows_ncols=(1,2),
axes_pad = 0.1,
add_all=True,
share_all = True,
cbar_mode = 'each',
cbar_location = 'top')
 
 # Plot!
 sc1 = grid[0].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral')
 sc2 = grid[1].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral')
 
 # Add colorbars
 grid.cbar_axes[0].colorbar(sc1)
 grid.cbar_axes[1].colorbar(sc2)
 
 grid[0].set_xlim(0,25)
 grid[0].set_ylim(0,8)
 
 pyl.show()
 
 
 And you get some squashed figures... I'll attach a png.
 
 Thanks again.
 
 Steven
 
 On Fri Mar 22 10:49:44 2013, Steven Boada wrote:
 
 Thanks JJ!
 
 That did fix my problem, but I can't say I understand what the
 difference is. Why does Axesgrid make them squashed while just Grid
 works?
 
 
 On Thu Mar 21 22:28:34 2013, Jae-Joon Lee wrote:
 
 It is not clear what your problem is.
 AxesGrid implicitly assumes aspect=1 for each axes. So, I guess your
 y-limits are smaller (in its span) than x-limits.
 If you don't want this behavior, there is no need of using the
 AxesGrid. Rather use Grid, or simply subplots.
 
 import matplotlib.pyplot as plt
 from mpl_toolkits.axes_grid1 import Grid
 
 F = plt.figure(1,(5.5,3.5))
 grid = Grid(F, 111,
 nrows_ncols=(1,3),
 axes_pad = 0.1,
 add_all=True,
 label_mode = 'L',
 )
 
 If this is not the answer you're looking for, I recommend you to post
 a complete but simple script that reproduces your problem and describe
 the problem more explicitly.
 
 Regards,
 
 -JJ
 
 
 On Fri, Mar 22, 2013 at 6:03 AM, Steven Boada bo...@physics.tamu.edu
 mailto:bo...@physics.tamu.edu wrote:
 
 Heya List,
 
 See attached image for what I mean.
 
 Here is the grid creation bit. I can't seem to figure out what
 might be causing such a problem.
 
 F = pyl.figure(1,(5.5,3.5))
 grid = AxesGrid(F, 111,
 nrows_ncols=(1,3),
 axes_pad = 0.1,
 add_all=True,
 label_mode = 'L',
 aspect=True)
 
 Should be simple enough right?
 
 --
 
 Steven Boada
 
 Doctoral Student
 Dept of Physics and Astronomy
 Texas AM University
 bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu
 
 
 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_mar
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 mailto:Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 --
 
 Steven Boada
 
 Doctoral Student
 Dept of Physics and Astronomy
 Texas AM University
 bo...@physics.tamu.edu
 
 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_mar
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 -- 
 
 Steven Boada
 
 Doctoral Student
 Dept of Physics and Astronomy
 Texas AM University
 bo...@physics.tamu.edu
 Screen Shot 2013-03-22 at 11.27.19 
 AM.png--
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_mar___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] another failed attempt (realtime)

2013-03-11 Thread Sterling Smith
Neal,

You might try 
mpl.use('GTKAgg')
as I have seen problems with lone GTK.  Also you might change this in your 
.matplotlibrc file if possible.

-Sterling

On Mar 11, 2013, at 10:43AM, Neal Becker wrote:

 According to other examples I see on the web, use of 'relim' and 
 'autoscale_view' should result in rescaling and drawing new axes.  Doesn't.
 Unless I explicity call 
 ax.axis ([...])
 I don't get any rescaling.
 
 Here's an example:
 
 import matplotlib as mpl
 mpl.use ('GTK')
 import matplotlib.pyplot as plt
 plt.ion()
 import numpy as np
 fig=plt.figure()
 ax = fig.add_subplot(111)
 x_values = [0]
 ax.axis ([0, 10, -1, 1])
 y_values = [0]
 
 i=0
 x=list()
 y=list()
 
 while i 1000:
x.append (i)
y.append (2*i)
line, = plt.plot (x, y, 'x-')
 
 ##ax.axis ([min(x),max(x),min(y),max(y)])
 
ax.relim()
# update ax.viewLim using the new dataLim
ax.autoscale_view()
plt.draw()
i+=1
 
 
 
 --
 Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
 Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
 endpoint security space. For insight on selecting the right partner to 
 tackle endpoint security challenges, access the full report. 
 http://p.sf.net/sfu/symantec-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Giving Peak number

2013-03-05 Thread Sterling Smith
Matplotlib User (I'm not sure how to address you),

I think that you are looking for either text() or annotate().

-Sterling


On Mar 5, 2013, at 4:12AM, nittopuran natya wrote:

 Hi, 
 
 I have this script which gives output the image attached here. What I want is 
 to give all the peak a number on top of the peak like 1 for first peak, 2 for 
 second, 3 for third and so on. Could someone pls help me how to do that in 
 python. 
 
 The code:
 
 
 from pylab import*
 
 # Read the file. 
 f2 = open('d012_SAXS-recomb.txt', 'r')
 # read the whole file into a single variable, which is a list of every row of 
 the file.
 lines = f2.readlines()[2:-100]
 f2.close()
 
 # initialize some variable to be lists:
 x1 = []
 y1 = []
 
 # scan the rows of the file stored in lines, and put the values into some 
 variables:
 for line in lines:
 p = line.split()
 x1.append(float(p[0]))
 y1.append(float(p[1]))
 
 x = np.array(x1)
 y = np.array(y1)
 
 xlim(0.0,4.0)
 
 # now, plot the data:
 #subplot(211)
 plt.plot(x, y, color='orange',linewidth=2.0, linestyle='-', label='Arabic - 
 LPP''\nRoman - SPP''\nAsterisk - CHOL')
 legend(loc='upper right')
 xlabel('q')
 ylabel('Intensity')
 title('Cer2.Chol.Ffa7 (1.1.1)')
 plt.show()
 
 
 
 /Tatiana
 d012_SAXS-recomb.txtimage.png--
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_feb___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] overlapping ticks in x axis

2013-03-05 Thread Sterling Smith
Vineeth,

I think that you are looking for
from matplotlib.ticker import MaxNLocator

-Sterling

On Mar 3, 2013, at 5:38PM, vineeth wrote:

 Hello,
 
 I have attached the histogram that I generated. When specifying large numbers 
 like 1000 or more, the xticks tend to overlap and it gives a clumsy 
 impression. Is there a way to avoid this?. What can be done to give gaps 
 between the ticks?. Say in my case just show 3 to 4 ticks in x axis rather 
 than specifying all the ticks. The following is my code:
 
 def plotHistogram(veh_no, value, vehicle_no, fig_no):
 
font = {'family' : 'serif',
'weight' : 'normal',
'size'   : 10}
rc('font', **font)
count = 1
legends = []
print veh_no
plt.figure(num=fig_no,dpi=105)
for i in range(len(value)):
ax = plt.subplot(2,2,i+1)
n, bins, patches = plt.hist(value[i],100,label=veh_no[i])
plt.ylabel('frequency',position=(0.5,0.5))
plt.xlabel('x valuels')
plt.grid()
min_val = int(round(min(value[i]),0))
max_val = int(round(max(value[i]),0))
ax.set_xlim(min_val-2,max_val+2)
locs,labels = plt.xticks()
plt.xticks(locs, map(lambda x: %g % x, locs))
plt.savefig('figurename.eps',dpi=70)
count += 1
 
 Thank You
 Vineeth
 test_hist.eps--
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_feb___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] cross correlation

2013-02-08 Thread Sterling Smith
Sudheer,

For the documentation you are looking for

print ax1.xcorr.__doc__

(Paul tried to give you the IPython method of getting that documentation which 
is by typing a ? (or ??) after the desired object.)

In the documentation (at the link you gave 
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.xcorr), it says 
that there are three objects returned by xcorr:
Return value is a tuple (*lags*, *c*, *line*) where:

  - *lags* are a length ``2*maxlags+1`` lag vector

  - *c* is the ``2*maxlags+1`` auto correlation vector

  - *line* is a :class:`~matplotlib.lines.Line2D` instance
 returned by :func:`~matplotlib.pyplot.plot`.

So the error you were getting is due to the fact that you have only specified 
two variables to hold the three returned objects.

Try:
lags,c,line = ax1.xcorr   .

(Note that you have xcorr and lags backwards in your attempt.)

-Sterling

On Feb 8, 2013, at 1:56AM, Sudheer Joseph wrote:

 Thank you verymuch Hobson,
   However I think I did not understand 
 the suggestion by you fully( pardon my ignorance). I use the below test code 
 from matplotlib site. How does one make a call to get lags and correlation 
 corresponding to the x and y values in the plot. a Print command of  
 In [23]: print ax1.xcorr
 bound method AxesSubplot.xcorr of matplotlib.axes.AxesSubplot object at 
 0x44c1410
 results as above. Is it possible to assign the xcorr,lags=ax1.xcorr(x, y, 
 usevlines=True, maxlags=50, normed=True, lw=2) ? with a different syntax? I 
 get below error when I try the above .
 In [27]: xcorr,lags=ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, 
 lw=2)
 ---
 ValueErrorTraceback (most recent call last)
 /home/sjo/work/PY_WORK/stats/ipython-input-27-e1e58c045ad4 in module()
  1 xcorr,lags=ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, 
 lw=2)
 
 ValueError: too many values to unpack
 
 
 
 import matplotlib.pyplot as plt
 import numpy as np
 x,y = np.random.randn(2,100)
 fig = plt.figure()
 ax1 = fig.add_subplot(211)
 ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2)
 ax1.grid(True)
 ax1.axhline(0, color='black', lw=2)
 ax2 = fig.add_subplot(212, sharex=ax1)
 ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2)
 ax2.grid(True)
 ax2.axhline(0, color='black', lw=2)
 plt.show()
 
  
 From: Paul Hobson pmhob...@gmail.com
 To: Sudheer Joseph sudheer.jos...@yahoo.com 
 Cc: matplotlib-users@lists.sourceforge.net 
 matplotlib-users@lists.sourceforge.net 
 Sent: Thursday, 7 February 2013 10:31 PM
 Subject: Re: [Matplotlib-users] cross correlation
 
 
 
 
 On Thu, Feb 7, 2013 at 3:24 AM, Sudheer Joseph sudheer.jos...@yahoo.com 
 wrote:
 Dear Users,
   I am relatively new to Matplotlib. I wanted to find cross 
 correlation between 2 time series for my research and was looking at options 
 available with python and found 
 http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.xcorr . However I 
 wanted to save the results in a netcdf file for further use. ie the 
 correlation, lags and significance if possible. Is there a way to get the 
 corr and lags from the axis.xcorr ?? any help in this matter will be greatly 
 appreciated. 
 Sudheer
 
 Sudheer,
 
 A call to axes.xcorr returns the lags, correlation (from np.correlate) and 
 the line artists on the figure.
 
 In IPython, doing plt.xcorr?? should provide sufficient information. It's a 
 pretty simple method.
 -paul
 
 
 --
 Free Next-Gen Firewall Hardware Offer
 Buy your Sophos next-gen firewall before the end March 2013 
 and get the hardware for free! Learn more.
 http://p.sf.net/sfu/sophos-d2d-feb___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding labels in a legend?

2013-01-22 Thread Sterling Smith

On Jan 22, 2013, at 7:01PM, Benjamin Root wrote:

 
 
 On Tue, Jan 22, 2013 at 9:10 PM, Drain, Theodore R (343P) 
 theodore.r.dr...@jpl.nasa.gov wrote:
 I have to say I disagree with this fix.  None was a nice, very intuitive 
 way to hide the label.  Many Python systems use None in that kind of role and 
 I really doubt anyone is going to use None when they meant None so 
 converting it to a string seems like a bad idea.
 
 Ted
 
 
 IIRC, the problem is that in matplotlib, the python None has a special 
 meaning in most places (do the default thing).  Legends, by default, will 
 create default labels.  For some time, we were capable of distinguishing when 
 someone submitted label=None and didn't state anything at all for labels.  
 This often causes confusion down the draw stack, and we have been working 
 towards getting rid of such distinctions.
 
 Of course, this is all from memory, which is notoriously bad.  If someone 
 else can bisect the commit that changed this, maybe that can refresh my 
 memory and maybe I could see a reason to re-instate this behavior.  Also, if 
 anyone can spot where it is stated in the documentation or examples that None 
 acts the same as _nolegend_, then we can consider this a regression and get 
 it fixed.
 
 Cheers!
 Ben Root

If None means do the default thing, then great.  I always interpreted the 
default for a plot command (line, patch, scatter, bar, etc.) to be no legend 
entry, unless explicitly given.  While not the specification as you have given 
it (default is default labels), this is my working specification (I have not 
yet migrated to 1.2.0).

Cheers,
Sterling

PS Notwithstanding this possible point of difference of opinion, I think the 
matplotlib team is awesome, and puts out a great product.  So I am willing to 
concede the point if no reversion is made.



--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbars with multiple subplots

2012-12-13 Thread Sterling Smith
Claus,

f.colorbar may be trying to place the colorbar on the 'current axes'.  Does 
placing 
plt.axes(axarr[0,0])
before each f.colorbar help?  Also, the plt.colorbar function [1] (maybe 
f.colorbar also) can take a keyword argument for the axes in which to draw the 
colorbar.

-Sterling

[1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.colorbar


On Dec 13, 2012, at 7:45AM, Claus wrote:

 Hi,
 
 I am trying to plot a colorbar next to each subplot in a figure. In the 
 following example, I create two figures. In the second figure, I try to add 
 the colorbars. Is there a way to show the colorbar next to each subplot. The 
 way I did it, all the colorbars appear next to the last subplot, take away 
 space from it, and all are plotted using the jet colormap.
 Unfortunately, I am not sure how to do this better, and would appreciate 
 hints.
 
 
 import numpy as np
 import matplotlib.pylab as plt
 
 def main():
 
# four subplots, no colorbar, so far so good
f, axarr = plt.subplots(2, 2)
axarr[0, 0].imshow(np.random.rand(5,5)*10)
axarr[0, 1].imshow(np.random.rand(5,5))
axarr[1, 0].imshow(np.random.rand(5,5)*100)
axarr[1, 1].imshow(np.random.rand(5,5)*1000)
plt.show()
 
# four subplots, four colorbars
f, axarr = plt.subplots(2, 2)
a = axarr[0, 0].imshow(np.random.rand(5,5)*10)
cbar1 = f.colorbar(a, cmap='jet')
b = axarr[0, 1].imshow(np.random.rand(5,5))
cbar2 = f.colorbar(b, cmap='Reds')
c = axarr[1, 0].imshow(np.random.rand(5,5)*100)
cbar2 = f.colorbar(c, cmap='Blues')
d = axarr[1, 1].imshow(np.random.rand(5,5)*1000)
cbar2 = f.colorbar(d, cmap='Greens')
plt.show()
 
 if __name__ == '__main__':
main()
 --
 LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
 Remotely access PCs and mobile devices and provide instant support
 Improve your efficiency, and focus on delivering more value-add services
 Discover what IT Professionals Know. Rescue delivers
 http://p.sf.net/sfu/logmein_12329d2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Label for axhline

2012-11-28 Thread Sterling Smith
Mads,

I recommend trying a text object[1], with a transform which is a blended 
transform from a transform factory[2].  Also, you probably want the x 
coordinate in axes coordinates, with a left horizontal alignment.

-Sterling

[1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.text
[2] http://matplotlib.org/users/transforms_tutorial.html#blended-transformations


On Nov 28, 2012, at 4:27AM, Mads Ipsen wrote:

 Hi,
 
 I would like to add a label or tick label for an axhline(), in such a way 
 that the labels follows the location of the hline.
 
 The x-coordinate of the label should be in screen coordinates (a little to 
 the right of the plot) - but the y-coordinate should be in data coordinates.
 
 Any good suggestions?
 
 Best regards,
 
 Mads
  
 -- 
 +-+
 | Mads Ipsen  |
 +--+--+
 | Gåsebæksvej 7, 4. tv |  |
 | DK-2500 Valby| phone:  +45-29716388 |
 | Denmark  | email:  
 mads.ip...@gmail.com
  |
 +--+--+
 
 
 --
 Keep yourself connected to Go Parallel: 
 INSIGHTS What's next for parallel hardware, programming and related areas?
 Interviews and blogs by thought leaders keep you ahead of the curve.
 http://goparallel.sourceforge.net___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to put colorbar label beside the handle?

2012-11-19 Thread Sterling Smith
Chao,

I'm glad you were able to get what you wanted.  

I don't know how to add anything to the gallery.

-Sterling

On Nov 17, 2012, at 3:32AM, Chao YUE wrote:

 Hi Sterling,
 
 Thanks for the help. Now we have a complete script that works as what we want:
 
 labels parallel with the colorbar with colorbar seperated 
 
 By the way, is it possible to put in the gallery?
 
 
 from pylab import *
 a = np.arange(100).reshape(10,10)
 cbarlevel=np.arange(0,101,10)
 cs=contourf(a,levels=cbarlevel)
 cbar = colorbar()
 cbar.set_ticks(cbarlevel)
 
 #prepare the final label that we want
 cbar_label = []
 for i in range(len(cbarlevel)-1):
 cbar_label.append( {0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))
 
 cbar.set_ticklabels(['']*len(cbarlevel))  #remove the original labels
 #set ticks as white; the 'length' parameter is a bit dirty solution
 cbar.ax.tick_params(axis='y',left='on',length=10,color='w',width=5)
 cbar.outline.remove()  #remove the colorbar frame
 
 #add the label parallel to colorbar; 0.035 to be set by manual observation, a 
 bit dirty solution.
 yloc=np.arange(0.035,0.95,0.1)
 for l,y in zip(cbar_label,yloc):
 cbar.ax.text(1,y,l,transform=cbar.ax.transAxes,ha='left')
 
 cheers,
 
 Chao
 
 On Sat, Nov 17, 2012 at 12:12 AM, Sterling Smith smit...@fusion.gat.com 
 wrote:
 Chao,
 
 If you don't need the tick marks and are only annoyed by their appearance in 
 the colorbar, then I am pasting below our code so far setting the tick length 
 to 0.
 
 Code so far:
 
 from pylab import *
 fig = figure(2)
 fig.clear()
 a = np.arange(100).reshape(10,10)
 cbarlevel=np.arange(0,101,10)
 contourf(a,levels=cbarlevel)
 cbar = colorbar()
 cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
 
 #to manipulate the range:
 cbar_label = []
 for i in range(len(cbarlevel)-1):
cbar_label.append({0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))
 
 #Then to apply on the colorbar:
 cbar.set_ticklabels(cbar_label)
 
 ax = fig.axes[-1] #This is not as clean as making the axes before the 
 colorbar and passing to the colorbar...
 ax.yaxis.set_tick_params(length=0)
 
 
 If you still want the ticks, then you might think of keeping the ticks where 
 you had set them originally, then placing texts (pylab.text) with the 
 transAxes transform, using the following script:
 
 
 from pylab import *
 fig = figure(2)
 fig.clear()
 a = np.arange(100).reshape(10,10)
 cbarlevel=np.arange(0,101,10)
 contourf(a,levels=cbarlevel)
 cbar = colorbar()
 #cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
 cbar.set_ticks(cbarlevel)
 
 #to manipulate the range:
 cbar_label = []
 for i in range(len(cbarlevel)-1):
cbar_label.append({0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))
 #cbar_label.append('')
 
 print cbar_label
 #['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
 #'80-90', '90-100', '']
 
 #Then to apply on the colorbar:
 cbar.set_ticklabels(['']*len(cbarlevel))
 
 ax = fig.axes[-1]
 #ax.yaxis.set_tick_params(length=0)
 
 yloc = linspace(0,1,len(cbar_label)+1)
 yloc = yloc[:-1] + yloc[1]/2.
 for l,y in zip(cbar_label,yloc):
 ax.text(1,y,l,transform=ax.transAxes,ha='left')
 draw()
 
 -Sterling
 
 On Nov 16, 2012, at 12:58PM, Chao YUE wrote:
 
  Thanks Sterling. It's a good idea.
 
  Unluckily, I lose the original ticks and the ticks appeared in the middle. 
  Is there any approach I can keep the original ticks while realizing what 
  has been shown in the figure?
 
  Chao
 
  On Fri, Nov 16, 2012 at 5:47 PM, Sterling Smith smit...@fusion.gat.com 
  wrote:
  Chao,
 
  The secret is positioning your ticks.  I list here an untested attempt at 
  putting the labels at the average of the current and next levels:
 
  cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
 
  Because you have less ticks, then you will want to remove the line
 
  cbar_level.append('')
 
  Hope that helps,
  Sterling
 
  On Nov 16, 2012, at 7:46AM, ChaoYue wrote:
 
   I have a bit progress, but still not very well.
  
   #to have a contourf plot
   a = np.arange(100).reshape(10,10)
   cbarlevel=np.arange(0,101,10)
   contourf(a,levels=cbarlevel)
   cbar = colorbar()
   cbar.set_ticks(cbarlevel)
  
   #to manipulate the range:
   cbar_label = []
   for i in range(len(cbarlevel)-1):
  cbar_label.append({0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))
   cbar_label.append('')
  
   In [54]: print cbar_label
   ['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
   '80-90', '90-100', '']
  
   #Then to apply on the colorbar:
   cbar.set_ticklabels(cbar_label)
  
   The generated figure is attached. But how can I put the labels a little 
   bit
   upward to make them parallel with the respective small rectangles in the
   colorbar? http://matplotlib.1069221.n5.nabble.com/file/n39786/fig.jpg
  
  
  
  
  
   --
   View this message in context: 
   http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39786.html
   Sent from the matplotlib - users mailing list archive at Nabble.com

Re: [Matplotlib-users] how to put colorbar label beside the handle?

2012-11-16 Thread Sterling Smith
Chao,

The secret is positioning your ticks.  I list here an untested attempt at 
putting the labels at the average of the current and next levels:

cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)

Because you have less ticks, then you will want to remove the line

cbar_level.append('')

Hope that helps,
Sterling

On Nov 16, 2012, at 7:46AM, ChaoYue wrote:

 I have a bit progress, but still not very well.
 
 #to have a contourf plot
 a = np.arange(100).reshape(10,10)
 cbarlevel=np.arange(0,101,10)
 contourf(a,levels=cbarlevel)
 cbar = colorbar()
 cbar.set_ticks(cbarlevel)
 
 #to manipulate the range:
 cbar_label = []
 for i in range(len(cbarlevel)-1):
cbar_label.append({0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))
 cbar_label.append('')
 
 In [54]: print cbar_label
 ['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
 '80-90', '90-100', '']
 
 #Then to apply on the colorbar:
 cbar.set_ticklabels(cbar_label)
 
 The generated figure is attached. But how can I put the labels a little bit
 upward to make them parallel with the respective small rectangles in the
 colorbar? http://matplotlib.1069221.n5.nabble.com/file/n39786/fig.jpg 
 
 
 
 
 
 --
 View this message in context: 
 http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39786.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.
 
 --
 Monitor your physical, virtual and cloud infrastructure from a single
 web console. Get in-depth insight into apps, servers, databases, vmware,
 SAP, cloud infrastructure, etc. Download 30-day Free Trial.
 Pricing starts from $795 for 25 servers or applications!
 http://p.sf.net/sfu/zoho_dev2dev_nov
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to put colorbar label beside the handle?

2012-11-16 Thread Sterling Smith
Chao,

If you don't need the tick marks and are only annoyed by their appearance in 
the colorbar, then I am pasting below our code so far setting the tick length 
to 0.  

Code so far:

from pylab import *
fig = figure(2)
fig.clear()
a = np.arange(100).reshape(10,10)
cbarlevel=np.arange(0,101,10)
contourf(a,levels=cbarlevel)
cbar = colorbar()
cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)

#to manipulate the range:
cbar_label = []
for i in range(len(cbarlevel)-1):
   cbar_label.append({0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))

#Then to apply on the colorbar:
cbar.set_ticklabels(cbar_label)

ax = fig.axes[-1] #This is not as clean as making the axes before the colorbar 
and passing to the colorbar...
ax.yaxis.set_tick_params(length=0)


If you still want the ticks, then you might think of keeping the ticks where 
you had set them originally, then placing texts (pylab.text) with the transAxes 
transform, using the following script:


from pylab import *
fig = figure(2)
fig.clear()
a = np.arange(100).reshape(10,10)
cbarlevel=np.arange(0,101,10)
contourf(a,levels=cbarlevel)
cbar = colorbar()
#cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
cbar.set_ticks(cbarlevel)

#to manipulate the range:
cbar_label = []
for i in range(len(cbarlevel)-1):
   cbar_label.append({0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))
#cbar_label.append('')

print cbar_label
#['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
#'80-90', '90-100', '']

#Then to apply on the colorbar:
cbar.set_ticklabels(['']*len(cbarlevel))

ax = fig.axes[-1]
#ax.yaxis.set_tick_params(length=0)

yloc = linspace(0,1,len(cbar_label)+1)
yloc = yloc[:-1] + yloc[1]/2.
for l,y in zip(cbar_label,yloc):
ax.text(1,y,l,transform=ax.transAxes,ha='left')
draw()

-Sterling

On Nov 16, 2012, at 12:58PM, Chao YUE wrote:

 Thanks Sterling. It's a good idea. 
 
 Unluckily, I lose the original ticks and the ticks appeared in the middle. Is 
 there any approach I can keep the original ticks while realizing what has 
 been shown in the figure?
 
 Chao
 
 On Fri, Nov 16, 2012 at 5:47 PM, Sterling Smith smit...@fusion.gat.com 
 wrote:
 Chao,
 
 The secret is positioning your ticks.  I list here an untested attempt at 
 putting the labels at the average of the current and next levels:
 
 cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
 
 Because you have less ticks, then you will want to remove the line
 
 cbar_level.append('')
 
 Hope that helps,
 Sterling
 
 On Nov 16, 2012, at 7:46AM, ChaoYue wrote:
 
  I have a bit progress, but still not very well.
 
  #to have a contourf plot
  a = np.arange(100).reshape(10,10)
  cbarlevel=np.arange(0,101,10)
  contourf(a,levels=cbarlevel)
  cbar = colorbar()
  cbar.set_ticks(cbarlevel)
 
  #to manipulate the range:
  cbar_label = []
  for i in range(len(cbarlevel)-1):
 cbar_label.append({0}-{1}.format(cbarlevel[i],cbarlevel[i+1]))
  cbar_label.append('')
 
  In [54]: print cbar_label
  ['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
  '80-90', '90-100', '']
 
  #Then to apply on the colorbar:
  cbar.set_ticklabels(cbar_label)
 
  The generated figure is attached. But how can I put the labels a little bit
  upward to make them parallel with the respective small rectangles in the
  colorbar? http://matplotlib.1069221.n5.nabble.com/file/n39786/fig.jpg
 
 
 
 
 
  --
  View this message in context: 
  http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39786.html
  Sent from the matplotlib - users mailing list archive at Nabble.com.
 
  --
  Monitor your physical, virtual and cloud infrastructure from a single
  web console. Get in-depth insight into apps, servers, databases, vmware,
  SAP, cloud infrastructure, etc. Download 30-day Free Trial.
  Pricing starts from $795 for 25 servers or applications!
  http://p.sf.net/sfu/zoho_dev2dev_nov
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 -- 
 ***
 Chao YUE
 Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
 UMR 1572 CEA-CNRS-UVSQ
 Batiment 712 - Pe 119
 91191 GIF Sur YVETTE Cedex
 Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
 
 
 fig.jpg


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Matplotlib-users mailing list

Re: [Matplotlib-users] Why is pip not mentioned in the Installation Documentation?

2012-11-16 Thread Sterling Smith

On Nov 16, 2012, at 2:25PM, Russell E. Owen wrote:

 In article 50a61b5b.1090...@ed.ac.uk,
 Mathew Topper mathew.top...@ed.ac.uk wrote:
 
 Hi,
 
 I'm interested to know why the pip package manager is not more widely 
 supported for installation of python packages like matplotlib? 
 Matplotlib seems to be particularly slowly updated in the Fedora 
 repositories, for example, so I often find that a source installation is 
 necessary. I know this isn't especially difficult for the experienced 
 user, but surely using something like pip would make this process for 
 accessible for all users of python packages, particularly those that do 
 not receive much attention from the big distribution maintainers? Yet, 
 pip doesn't get a mention on the installation documentation of 
 matplotlib or many other python packs.
 
 I would love to hear anyone's thoughts on this matter.
 
 Unfortunately pip cannot install binaries, so any user that tried to 
 install matplotlib using pip would have to have a C compiler.
 
 Unfortunately many users do not have a compiler on MacOS and Windows.
 
 In addition, matplotlib has some important dependencies that may not be 
 available on all systems. MacOS now includes all necessary libraries. I 
 don't think that is true for most flavors linux (though there is 
 probably an easy way to get all missing packages). I have no idea about 
 Windows.
 
 I agree pip should be mentioned, but I don't see it as a viable 
 mainstream means of installing matplotlib.
 
 (Does it even work with matplotlib? I've never tried it.)
 
 -- Russell

pip is the only method I have used in my Linux work.

-Sterling

 
 
 --
 Monitor your physical, virtual and cloud infrastructure from a single
 web console. Get in-depth insight into apps, servers, databases, vmware,
 SAP, cloud infrastructure, etc. Download 30-day Free Trial.
 Pricing starts from $795 for 25 servers or applications!
 http://p.sf.net/sfu/zoho_dev2dev_nov
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] close a figure after show , when plotting many figures from script- using matplotlib.pyplot.figure

2012-10-17 Thread Sterling Smith
Hari,

While I am not intimately acquainted with the inner working of the interactive 
matplotlib functionality, I have seen that it tries to not update the figure if 
you ask for some change to it while it is trying to update the figure.  That 
sounds circular, but oh well.  

Perhaps you could have each analysis open a new figure, and have an if 
statement to close 5 (or 10...) figures ago.  

Another subtlety that I have noticed (and perhaps read somewhere) is that there 
could be a difference in behavior between having interactivity set in the 
matplotlibrc file and using the ion() call after having set interactive: False 
in the matplotlibrc file.

Another solution might be a time.sleep after each update of the figure.

(Note that with ion(), the command for updating the figure is pylab.draw, which 
may need to be issued after each case - the pylab/pyplot functions usually have 
a draw_if_interactive call in them.)

-Sterling

PS If I am causing more confusion than help, please let me know.


On Oct 17, 2012, at 10:54AM, hari jayaram wrote:

 Thanks Benjamin, Sterling and Damon  for your prompt  help
 
 However I am still not able to achieve what I wanted .
 
 I can get the headless script to work just great where it saves all the 
 figures and I can view them after the script is done running.
 
 But somehow when I try the figure number method that Sterling suggested , 
 along with the axis clear and redraw method (Damon) , or the decouple and 
 clear and then plot method (Benjamin Root) : I get the plot just spinning 
 with a blue circle on Windows 7 and the script just chugs merrily along.
 
 
 I think part of the problem was that I was wrong in the way I stated my 
 application. Each of the 384 data processing steps takes a few seconds..and 
 not a minute as I had indicated.  I tried with both ion() and ioff() and 
 giving the figure a number , which stays constant and clearing the  axis 
 everytime before plotting. But I get a spiining blue circle in Windows.
 
 I will try and cookup a test case , and send to the list , to reproduce what 
 I am seeing. it may still be that I am calling pylab , pyplot incorrectly and 
 hence not getting the continuously changing figure that your suggestions 
 should give me.
 
 hari
 
 
 
 
 Using plt.ion() or plt.ioff() causes a spinning blue-ball on windows..while 
 the rest of the script continues.
 If I use the figure number trick. I get the first figure displayed.
 
 On Tue, Oct 16, 2012 at 12:15 PM, Benjamin Root ben.r...@ou.edu wrote:
 
 
 On Tue, Oct 16, 2012 at 11:25 AM, hari jayaram hari...@gmail.com wrote:
 Hi 
 I am a relative newbie to matplotlib.
 
 I have a python script that handles a dataset that comprises 384 sets of data.
 
 At the present moment , I read in a set of data - process it - and the create 
 a figure using code shown below.
 I am using windows with the default backend ( I think I set it to wx).
 
 When I run the program, figure after figure shows up..the program continues 
 from well to well plotting the figure. I can close the figure window using 
 the X on the right -hand side..while the program chugs along.
 
 Is there a way to just recycle the figure object , so that the plot shows up 
 for a brief second and refreshes when the next calculation is complete. Each 
 process_data function , takes a few minutes. 
 
 Alternatively I just want to close the figure object I show after a brief 
 lag.  I am OK if that happens instantaneously..but I dont know how to achieve 
 this.
 Do I have to use the matplotlib.Figure object to achieve this functionality
 
 Thanks
 Hari
 
 
 
 Hari,
 
 To recycle the figure, try the following:
 
 
 
 import matplotlib.pyplot as plt
 
 def do_my_plot(par1, par2, well_id):
 processed_data_object = processed_dict[well_id]
 # Plot all the data
 par1.plot(processed_data_object.raw_x,processed_data_object.raw_y).
 par2.plot(
 # finally
 plt.show() 
 # I tried  fig.clf()
 
 
 def plot_and_process_data():
 plt.ion()  # Turn on interactive mode 
 fig = plt.figure(figsize=(7,7)
 ax = fig.add_subplot(1,1,1)
 par1 =ax.twinx()
 par2 = ax.twinx()
  
 for well_id in list_of_384_well_ids:
  par1.cla()
  par2.cla()
  process_data(well_id)
  do_my_plot(par1, par2, well_id)
 
 Note, this is completely untested, but it would be how I would go about it at 
 first.  The plt.ion() turns on interactive mode to allow your code to 
 continue running even after the plot window appears (but does not end until 
 the last window is closed.).  Of course, another approach would simply be to 
 do fig.savefig() after every update to the figure and never use show() and 
 ion() (essentially, a non-interactive head-less script).
 
 Hopefully, this helps.
 Ben Root
 
 
 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics 

Re: [Matplotlib-users] close a figure after show , when plotting many figures from script- using matplotlib.pyplot.figure

2012-10-16 Thread Sterling Smith
Hari,

You can give a number to figure(), as in figure(1), and it will reuse figure 1. 
 Also, you can close figure 1 with pyplot.close(1).

-Sterling

On Oct 16, 2012, at 8:25AM, hari jayaram wrote:

 Hi 
 I am a relative newbie to matplotlib.
 
 I have a python script that handles a dataset that comprises 384 sets of data.
 
 At the present moment , I read in a set of data - process it - and the create 
 a figure using code shown below.
 I am using windows with the default backend ( I think I set it to wx).
 
 When I run the program, figure after figure shows up..the program continues 
 from well to well plotting the figure. I can close the figure window using 
 the X on the right -hand side..while the program chugs along.
 
 Is there a way to just recycle the figure object , so that the plot shows up 
 for a brief second and refreshes when the next calculation is complete. Each 
 process_data function , takes a few minutes. 
 
 Alternatively I just want to close the figure object I show after a brief 
 lag.  I am OK if that happens instantaneously..but I dont know how to achieve 
 this.
 Do I have to use the matplotlib.Figure object to achieve this functionality
 
 Thanks
 Hari
 
 
 
 
 
 from matplotlib.pyplot import figure
 
 def do_my_plot(well_id):
 processed_data_object = processed_dict[well_id]
 fig = figure(figsize=(7,7)
 ax = fig.add_subplot(1,1,1)
 par1 =ax.twinx()
 par2 = ax.twinx()
 # Plot all the data
 par1.plot(processed_data_object.raw_x,processed_data_object.raw_y).
 par2.plot(
 # finally
 fig.show() 
 # I tried  fig.clf()
 
 
 def plot_and_process_data():
 for well_id in list_of_384_well_ids:
  process_data(well_id)
  do_my_plot(well_id)
 


 
 
 
 
  
  
 
 
 --
 Don't let slow site performance ruin your business. Deploy New Relic APM
 Deploy New Relic app performance management and know exactly
 what is happening inside your Ruby, Python, PHP, Java, and .NET app
 Try New Relic at no cost today and get our sweet Data Nerd shirt too!
 http://p.sf.net/sfu/newrelic-dev2dev___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Development advice needed

2012-10-03 Thread Sterling Smith
Jianbao,

The one thing I would add to Anthony's response, which is a good summary of 
what I would say, is that you should look into the animation aspects of 
matplotlib, and the xdata and ydata attributes of lines/axes for speed in 
replotting mostly similar situations.  I regret having not learned of these 
before I made an application, and I have yet to go back and implement these 
faster methods.

-Sterling

On Oct 3, 2012, at 9:49AM, Anthony Floyd wrote:

 Hi Jianbao,
 
 First some context: at the company I work for, we've been using
 matplotlib to do much of what you want to do for the past 4 years. We
 have created our own application for plotting, interrogating, and
 manipulating time-series data coming from both simulations and
 measurements, although from a completely different domain (in our case
 it's virtual manufacturing of composite materials). In the past two
 years, we've also been using matplotlib to plot in more-or-less
 realtime data from a cloud industrial sensors (temperature, pressure,
 etc).
 
 After reading the matplotlib documents and trying out several little
 examples for a few days, I now have a feeling that matplotlib at least has
 most of the infrastructure ready for my purposes. One thing that bothers me
 a little bit is that the plotting speed seems to be a little slow. But IDL
 had the same problem in the first place too. As computers became faster and
 faster, that problem just became less and less important. I expect the same
 thing will happen to matplotlib too.
 
 This is true, matplotlib can be slow, particularly for large data sets
 and many data sets. The trick is to downsample (and use tiling if
 you're going to be panning around a lot) what you're actually plotting
 before handing it off to the plot. I think more recent versions of
 matplotlib handle some of this for you, but we've found that it's
 faster to do the downsampling ourselves.
 
 Now let me turn to technical stuff. What I want is a time-series plotting
 [...]
 sufficient. Third, the system should have minimal dependencies for the sake
 of portability and installation easiness. As for now, I don't want any
 dependencies beyond numpy, scipy, and matplotlib. Ipython would be a highly
 recommended tool, but the system should be just fine without it.
 
 You're going to need more than that. At the very least you're going to
 need a widget framework like wxPython, pyQT, pyGTK, or some such.
 These will provide you with all the window management, widget
 controls, and so on. Our preference is wxPython but YMMV.
 
 After weighing all the options, I sense that I will probably be better off
 to use the matplotlib library directly, rather than the convenient utilities
 provided by pyplot. However, I am having a hard time to find good
 instructions for using the matplotlib infrastructure. So, I would like to
 hear some references on that. I also would like to hear general advice about
 how to construct such a system so that its structure is consistent with
 matplotlib conventions. Other comments and advice are warmly welcome too.
 
 Absolutely, you'll want to use the API rather than the utility
 functions. The best reference for that is the online documentation at
 matplotlib.org. In the past we've found the source code documentation
 (or, say, that generated by doxygen) more helpful than the Sphinx
 documentation, but frankly our matplotlib bits are pretty stable now
 and we haven't had to use the documentation for a while (perhaps it's
 better now).
 
 Good luck! We've been very happy with our design choices, and get
 nothing but positive feedback on how our plots look and feel.
 matplotlib and the amazing active community around it have everything
 to do with that.
 
 Anthony.
 
 --
 Don't let slow site performance ruin your business. Deploy New Relic APM
 Deploy New Relic app performance management and know exactly
 what is happening inside your Ruby, Python, PHP, Java, and .NET app
 Try New Relic at no cost today and get our sweet Data Nerd shirt too!
 http://p.sf.net/sfu/newrelic-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] sharex with different tick labels

2012-09-13 Thread Sterling Smith
Daniel,

I found that I came across this often, so I created three functions (one for 
sharing x, one for y, and one for both).  In looking over them right now, there 
may be some inconsistencies between their style, but the idea is there. I am 
pasting them below in case they are useful to someone else.  The original ideas 
came from figure.autofmt_xdate.

-Sterling

def autofmt_sharexy(fig=None):
 if fig==None:
  fig = gcf()
 for a in fig.axes:
  if a.is_first_col():
   if not a.is_first_row():
a.get_yticklabels()[-1].set_visible(False)
  else:
   for yl in a.get_yticklabels():
yl.set_visible(False)
   a.set_ylabel('')
  if not a.is_last_row():
   for xl in a.get_xticklabels():
xl.set_visible(False)
   a.set_xlabel('')
  else:
   if not a.is_last_col():
a.get_xticklabels()[-1].set_visible(False)
 subplots_adjust(hspace=0,wspace=0)

def autofmt_sharey(trim_xlabel=True,fig=None):
 if fig==None:
  fig = gcf()
 from matplotlib.ticker import MaxNLocator
 for a in fig.axes:
  if a.is_first_col():
   if not a.is_first_row():
a.get_yticklabels()[-1].set_visible(False)
  else:
   for yl in a.get_yticklabels():
yl.set_visible(False)
   a.set_ylabel('')
   if trim_xlabel:
a.get_xticklabels()[0].set_visible(False)
  if not trim_xlabel:
   a.xaxis.set_major_locator(MaxNLocator(6))
   xtl = a.get_xticklabels()
   setp(xtl[0::2],visible=False)
 subplots_adjust(wspace=0)


def autofmt_sharex(fig=None):
   if fig==None:
fig = gcf()
   nax=len(fig.get_axes())
   if nax==0: return
   try:
  nr=fig.axes[0].numRows
  nc=fig.axes[0].numCols
   except:
  print 'Unable to determine numRows,numCols'
  return
   def is_last_row(n):
  if nnax-nc-1:
 return True
  else:
 return False
   for i,ax in enumerate(fig.axes):
  if not is_last_row(i):
 for xt in ax.get_xticklabels(): xt.set_visible(False)
 ax.set_xlabel('')

-Sterling

On Sep 13, 2012, at 1:23PM, Daniel Welling wrote:

 Greetings, all.
 
 I have an issue: I have several axes stacked in a column with a common time 
 vector on each x-axis.  Each plot is a contour, so overplotting is not an 
 option.  In a perfect world, I want the following:
 1) The subplots are tightly spaced such that with ax.grid() activated, the 
 grid lines appear continuous.  This makes comparing simultaneous 
 characteristics between subplots very easy.
 2) The subplots are linked via the sharex keyword so I can move them all in 
 unison.
 3) Only the bottommost subplot has x tick labels; on other plots, the long 
 time-formatted labels stick out of the left and right of the plots.
 
 Items 2 and 3 are contradictory: if I turn off tick labels (e.g. 
 ax.set_xticklabels('')) on one axes, the others turn off as well, including 
 the bottom axes.  That is bad.
 Does anyone know of a good workaround for this?
 
 Thanks for your help.
 
 -dw
 --
 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


--
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] Legend Marker Color Bug

2012-09-05 Thread Sterling Smith
On Sep 4, 2012, at 5:33PM, Jae-Joon Lee wrote:

 On Wed, Sep 5, 2012 at 6:05 AM, Sterling Smith smit...@fusion.gat.com wrote:
 I still do not get black markers.  Furthermore, if you try to make a new 
 legend with the result of leg.get_lines(), you will get lines without 
 markers, which leads me to the conclusion I stated in my previous email 
 (which you did not copy)
 I suspect that this is because the legend marker is drawn separately from 
 the legend line to accommodate the numpoints argument of the legend 
 functions.  Then the question is how to access these markers if they are 
 separate from the line2d objects in the legend.  I didn't even see them in 
 the children of the legend [legend.get_children()].
 
 This is correct. To support legend handle like --o-- (i.e., no markers
 at the ends), lines and markers are drawn as a separate artist. You
 may use something like,
 
 line[0]._legmarker.set_markerfacecolor('black')
 line[1]._legmarker.set_markerfacecolor('black')
 
 I, personally, recommend you to use a proxy artist.
 
 http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
 
 For example,
 
 You may do something like
 
 import pylab
 pylab.plot(pylab.linspace(0,1,100),marker='o',ls='')
 pylab.plot(pylab.linspace(0,1,100),marker='o',ls='-')
 
 # creates artists for legend purpose only
 l1, = pylab.plot(pylab.linspace(0,1,100), 'ko-')
 l2, = pylab.plot(pylab.linspace(0,1,100), 'ko')
 # remove them from the axes.
 l1.remove()
 l2.remove()
 
 leg=pylab.legend([l1, l2], [Test 1, Test 2], loc='best')
 
 Regards,
 
 -JJ

JJ,

Thank you for responding.  I was looking for the _legmarker method, which works 
great.

Thanks,
Sterling


--
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] Legend Marker Color Bug

2012-09-04 Thread Sterling Smith
On Aug 31, 2012, at 11:29AM, Goyo wrote:

 2012/8/30 Sterling Smith smit...@fusion.gat.com:
 
 Thank you for taking the time to consider my question.  I'm sorry that I 
 didn't pose my question correctly.  I should have said: 'Consider the 
 _results_ of the following script:'  I originally tried to attach the 
 results I obtained, which showed no change in color for the markers in the 
 legend, while the line connecting the markers in the legend did change color.
 
 Actualy your question is correctly posted but I misread it. Calling
 set_color changes only the line color, not the markers. This is
 expected and documented behavoir. There are separate methods for the
 markers:
 
 line[0].set_markerfacecolor
 line[0].set_markeredgecolor
 
 See 
 http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D
 
 Regards
 
 Goyo

Goyo,

Again I thank you for taking time to look into this.  You are correct that 
there are separate functions for setting the marker properties vs the line 
properties.  However, I have tried your solution, and it does not work.  Given 
the following code:

import pylab
pylab.plot(pylab.linspace(0,1,100),label='Test',marker='o',ls='')
pylab.plot(pylab.linspace(0,1,100),label='Test2',marker='o',ls='-')
leg=pylab.legend(loc='best')
line=leg.get_lines()
line[0].set_markerfacecolor('black')
line[1].set_markerfacecolor('black')
pylab.draw()

I still do not get black markers.  Furthermore, if you try to make a new legend 
with the result of leg.get_lines(), you will get lines without markers, which 
leads me to the conclusion I stated in my previous email (which you did not 
copy)
 I suspect that this is because the legend marker is drawn separately from 
 the legend line to accommodate the numpoints argument of the legend 
 functions.  Then the question is how to access these markers if they are 
 separate from the line2d objects in the legend.  I didn't even see them in 
 the children of the legend [legend.get_children()].


Thanks,
Sterling


--
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] Legend Marker Color Bug

2012-08-30 Thread Sterling Smith

On Aug 30, 2012, at 12:35PM, Benjamin Root wrote:

 
 
 On Thu, Aug 30, 2012 at 3:26 PM, Goyo goyod...@gmail.com wrote:
 2012/8/28 Sterling Smith smit...@fusion.gat.com:
  List,
 
  Consider the following script:
 
  import pylab
  pylab.plot(pylab.linspace(0,1,100),label='Test',marker='o',ls='')
  pylab.plot(pylab.linspace(0,1,100),label='Test2',marker='o',ls='-')
  leg=pylab.legend(loc='best')
  line=leg.get_lines()
  line[0].set_color('black')
  line[1].set_color('black')
  pylab.draw()
 
  I am attaching the results I see with the TkAgg baackend.  I am using 
  version 1.1.0.
 
  I would expect the markers to change colors also.  However, I can't seem to 
  find the markers recorded in the legend object to be able to change them.  
  Is this a bug or a feature (resetting the color could lead to 
  inconsistencies between legend and plot)?
 
 
 I think it's a design issue, there's no connection kept between plot
 lines and the legend. You can change colors in the plot an then call
 legend again instead.
 
 Cheers
 
 Goyo
 
 
 That is correct.  The lines that one obtains from the get_lines() method of 
 legend are completely new line objects.  It is only upon the creation of 
 those lines (at legend creation) that the lines inherit the plot's line 
 properties.
 
 Now, in the future, it would be nice for artist objects to have shareable 
 styles, in which case an edit to a style in one place effects all artists 
 with the same style object.  But that might be something reserved for version 
 2+.
 
 Cheers!
 Ben Root
 

Ben, Goyo,

Thank you for taking the time to consider my question.  I'm sorry that I didn't 
pose my question correctly.  I should have said: 'Consider the _results_ of the 
following script:'  I originally tried to attach the results I obtained, which 
showed no change in color for the markers in the legend, while the line 
connecting the markers in the legend did change color.

I understand that the lines in the legend are new objects; this is desirable in 
my case because I have the same symbol with different colors, where the color 
means one thing (plasma condition), but the symbol means something else 
(simulated vs measured).  So it makes sense for the markers in the legend 
describing the meaning of the symbols to be black, as opposed to any of the 
colors of the markers.   However, setting the legend's new line2d object color 
properties does not change the appearance of the marker in the legend, only the 
appearance of the line.  I suspect that this is because the legend marker is 
drawn separately from the legend line to accommodate the numpoints argument of 
the legend functions.  Then the question is how to access these markers if they 
are separate from the line2d objects in the legend.  I didn't even see them in 
the children of the legend [legend.get_children()].

Thank you for your attention,
Sterling
--
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


[Matplotlib-users] Legend Marker Color Bug

2012-08-28 Thread Sterling Smith
List,

Consider the following script:

import pylab
pylab.plot(pylab.linspace(0,1,100),label='Test',marker='o',ls='')
pylab.plot(pylab.linspace(0,1,100),label='Test2',marker='o',ls='-')
leg=pylab.legend(loc='best')
line=leg.get_lines()
line[0].set_color('black')
line[1].set_color('black')
pylab.draw()

I am attaching the results I see with the TkAgg baackend.  I am using version 
1.1.0.

I would expect the markers to change colors also.  However, I can't seem to 
find the markers recorded in the legend object to be able to change them.  Is 
this a bug or a feature (resetting the color could lead to inconsistencies 
between legend and plot)?

Thanks,
Sterling
inline: legend_error.tiff--
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


[Matplotlib-users] How connect axes on matplotlib subplots

2012-02-02 Thread Sterling Smith
 Hello!
 
 How can I zoom exactly on the same region on two different subplots at
 the same time. This option is enable when I use plotfile but not if I
 use plot, and subplots?
 
 Thx!
 Fabien

Fabien,

When you create the new subplots, add the sharex=ax, sharey=ax keywords, where 
ax is the first set of axes you create.

-Sterling
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Removing ticks and frame (imshow)

2011-11-28 Thread Sterling Smith
 
 From: Marianne C. mariyann...@gmail.com
 Date: November 24, 2011 6:48:34 AM PST
 To: matplotlib-users@lists.sourceforge.net
 Subject: [Matplotlib-users] Removing ticks and frame (imshow)
 
 
 Hi all,
 
 My name is Marianne, I am a beginner user of matplotlib.
 I am using imshow in pyplot.  I am desperate to get rid of
 the ticks on both x and y axes (see attached picture).  I
 do not need the black box around the data either.  Should
 I use imshow in axes.Axes instead, to be able to call
 set_ticks_position(none)?
 Thank you for your help,
 Marianne
 
 Here is the code so far:
 
 import numpy
 from matplotlib import pyplot
 
 q=numpy.loadtxt('field.txt')
 
 myfield = pyplot.imshow(q,aspect=1)
 myfield.set_clim(vmin=0, vmax=0.6)
 
 pyplot.colorbar()
 
 pyplot.savefig('field_1.eps')
 
 field_1.pdf

Marianne,

Try

myfield.get_axes().axis('off')

-Sterling


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib-users Digest, Vol 65, Issue 49

2011-10-28 Thread Sterling Smith



 From: John Hunter jdh2...@gmail.com
 Date: October 28, 2011 5:54:36 AM PDT
 To: Adam Mercer ramer...@gmail.com
 Cc: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] Legend and proxy artists
 
 
 On Thu, Oct 27, 2011 at 8:12 AM, Adam Mercer ramer...@gmail.com wrote:
 value_plot = []
 for v in value:
  value_plot.append(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4))
 
 # legend
 date_axes.legend(([morning_plot], [evening_plot], [value_plot]),
(Morning, Evening, Value),
numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
 
 # save plot
 fig.savefig(plot_file)
 
 Your problem is that value_plot is a list of lists, and not a list of
 lines.  ax.plot_date returns a list of lines, so you need to do
 
 value_plot.extend(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4))

This by itself does not solve the problem.  The call to legend needs a list of 
handles (artists) and a list of labels.  If using the line JDH suggested, try

date_axes.legend((morning_plot[0], evening_plot[0], value_plot[0]),
   (Morning, Evening, Value),
   numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)

With the code as it is try

date_axes.legend((morning_plot[0], evening_plot[0], value_plot[0][0]),
   (Morning, Evening, Value),
   numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)

If neither works, then you might need to provide more information.

-Sterling
--
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] Legend and proxy artists

2011-10-27 Thread Sterling Smith
Adam,

Your example is not complete.  I don't understand the value variable that you 
are iterating over, or how it affects the different plots you are making.

I would guess that the problem is that you have a list of tuples of handles for 
value_plot, instead of a list of handles.  Note that each of the plot_date 
commands returns a length=1 tuple of lines.  So you should pick out the first 
item of each tuple, and you probably only need the 1st item of the value_plot 
list, since you only give 3 labels.

-Sterling

PS Sorry if somebody already responded; I get my list mail in digests.

 
 
 From: Adam Mercer ramer...@gmail.com
 Date: October 27, 2011 6:12:50 AM PDT
 To: matplotlib-users@lists.sourceforge.net
 Subject: [Matplotlib-users] Legend and proxy artists
 
 
 Hi
 
 I have recently updated to Matplotlib-1.1.0 and now one of my scripts
 displays the following warning:
 
 UserWarning: Legend does not support [[matplotlib.lines.Line2D object
 at 0x1026296d0]]
 Use proxy artist instead.
 
 http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
 
 The link it refers to doesn't seem to be much help, and I can't see
 what I need to do in order to correctly display the legend. Below is
 the appropriate plotting section of my script, could anyone offer
 suggestions as to how to correctly display the legend?
 
 # plot size, scale by golden ratio
 fig = pyplot.figure()
 fig.set_size_inches(10, 10 / ((1 + math.sqrt(5)) / 2))
 date_axes = fig.add_subplot(111)
 
 # setup secondary axes
 value_axes = date_axes.twinx()
 
 # set plot labels
 date_axes.set_xlabel(Date)
 date_axes.set_ylabel(Time)
 value_axes.set_ylabel(Value)
 
 # produce plot
 morning_plot = date_axes.plot_date(morning[:,0], morning[:,1], 'bo-', ms=4)
 evening_plot = date_axes.plot_date(evening[:,0], evening[:,1], 'go-', ms=4)
 value_plot = []
 for v in value:
  value_plot.append(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4))
 
 # legend
 date_axes.legend(([morning_plot], [evening_plot], [value_plot]),
(Morning, Evening, Value),
numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
 
 # save plot
 fig.savefig(plot_file)
 
 Cheers
 
 Adam
 


--
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] Legend and proxy artists

2011-10-27 Thread Sterling Smith
Adam,

I'm sorry that I wasn't clear before.

Here is a working example:

from pylab import figure, arange
fig = figure(1)
fig.clear()
ax = fig.add_subplot(111)
x = arange(0,1,.25)
y1 = x
y2 = x**2
y3 = x**3
l1 = ax.plot(x,y1,'bo-')
l2 = ax.plot(x,y2,'go-')
l3 = []
for xi,x1 in enumerate(x):
  l3.append(ax.plot(x1,y3[xi],'ro-'))
print l1,l2,l3
leg = ax.legend((l1[0],l2[0],l3[0][0]),('$x$','$x^2$','$x^3$'),
  numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)

Note that when l1 and l2 are printed that they are 1-element lists, and l3 is a 
list of 1-element lists, all of which are not the type of handles that legend 
is looking for.  Furthermore, in your code, you are trying to embed these lists 
in yet another layer of list.  

If  your code worked as it was with previous versions of matplotlib, then maybe 
someone with more knowledge could explain what changed to not allow your code 
to work now (it may be related to 
https://github.com/matplotlib/matplotlib/pull/534).

-Sterling

On Oct 27, 2011, at 8:32PM, Adam Mercer wrote:

 On Thu, Oct 27, 2011 at 12:05, Sterling Smith smit...@fusion.gat.com wrote:
 
 Your example is not complete.  I don't understand the value variable that 
 you are iterating over, or how it affects the different plots you are making.
 
 value is simply a list of different datasets to plot, read in using:
 
 value = []
 for v_file in glob.glob(value_glob):
  value.append(numpy.atleast_2d(numpy.loadtxt(v_file, converters={0:
 dates.datestr2num})))
 
 where value_glob specifies a glob pattern of files to read in.
 
 I would guess that the problem is that you have a list of tuples of handles 
 for value_plot, instead of a list of handles.  Note that each of the 
 plot_date commands returns a length=1 tuple of lines.  So you should pick 
 out the first item of each tuple, and you probably only need the 1st item of 
 the value_plot list, since you only give 3 labels.
 
 I'm not really following you, do you mean something like the following:
 
 # legend
 date_axes.legend(([morning_plot], [evening_plot], [value_plot[0]]),
   (Morning, Evening, Value),
   numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
 
 as that results in the same errors?
 
 Cheers
 
 Adam


--
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] Figure legend for 1.1.0 doesn't properly handle errorbars?

2011-10-19 Thread Sterling Smith
JJ,

The workaround works.  Thanks.

-Sterling

On Oct 17, 2011, at 6:58PM, Jae-Joon Lee wrote:
 Meanwhile, you may do
 
 from matplotlib.legend import Legend
 l = Legend(fig, h, l, loc='lower right')
 fig.legends.append(l)
 
 This should be equivalent to fig.legend(h,l,loc='lower right').
 
 Or, if you don't need axes legend, you may do
 
 legend(h,l,loc='lower right', bbox_to_anchor=[0,0,1,1],
   bbox_transform=fig.transFigure)
 
 Regards,
 
 -JJ
 
 On Tue, Oct 18, 2011 at 6:59 AM, Sterling Smith smit...@fusion.gat.com 
 wrote:
 Let me first say that I appreciate the work that the developers have put 
 into matplotlib.  You're doing a great job.
 
 I have filed a bug report at
 
 https://github.com/matplotlib/matplotlib/issues/533
 
 wherein I post the following
 
 Consider:
 
 from pylab import *
 x = arange(0,1,.01)
 y = x**2
 fig = figure(2)
 ax = fig.add_subplot(111)
 errorbar(x,y,yerr=x/10.,label='$x^2$')
 errorbar(x,y**3,yerr=x/10.,label='$x^6$')
 legend(loc='upper center')
 h,l = ax.get_legend_handles_labels()
 fig.legend(h,l,loc='lower right')
 
 
 I am getting the right legend for the axes based legend, but the figure 
 based legend seems to be using the different parts of the errorbar for 
 subsequent handles, instead of using them as a group.  From what I can tell, 
 this has appeared since the upgrade to version 1.1.0.
 
 I am running on Linux, python 2.7, gtkAgg backend.
 
 Thanks,
 Sterling
 
 
 --
 All the data continuously generated in your IT infrastructure contains a
 definitive record of customers, application performance, security
 threats, fraudulent activity and more. Splunk takes this data and makes
 sense of it. Business sense. IT sense. Common sense.
 http://p.sf.net/sfu/splunk-d2d-oct
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


--
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@Ciosco 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


[Matplotlib-users] Figure legend for 1.1.0 doesn't properly handle errorbars?

2011-10-17 Thread Sterling Smith
Let me first say that I appreciate the work that the developers have put into 
matplotlib.  You're doing a great job. 

I have filed a bug report at 

https://github.com/matplotlib/matplotlib/issues/533

wherein I post the following

Consider:

from pylab import *
x = arange(0,1,.01)
y = x**2
fig = figure(2)
ax = fig.add_subplot(111)
errorbar(x,y,yerr=x/10.,label='$x^2$')
errorbar(x,y**3,yerr=x/10.,label='$x^6$')
legend(loc='upper center')
h,l = ax.get_legend_handles_labels()
fig.legend(h,l,loc='lower right')


I am getting the right legend for the axes based legend, but the figure based 
legend seems to be using the different parts of the errorbar for subsequent 
handles, instead of using them as a group.  From what I can tell, this has 
appeared since the upgrade to version 1.1.0.

I am running on Linux, python 2.7, gtkAgg backend.

Thanks,
Sterling


--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users