Re: [Matplotlib-users] passing multiple path arguments to make_compound_path

2014-11-27 Thread Francesco Montesano
Hi,

put all them into a list

ps = [p1, p2, ..., pn]

and then unpack them

path.Path.make_compound_path(*ps)

Cheers,

Fra

ps: this is standard python unpacking


2014-11-27 18:12 GMT+01:00 Evan Mason :

> Hi, I have several path objects that I want to join together with
> make_compound_path.
>
> For example, with p1 and p2:
>
> In [136]: p1
> Out[136]:
> Path(array([[-29.85721973, -30.],
>[-29.84752676, -29.77715877],
>[-29.88734508, -29.55431755],
>[-29.97470553, -29.33147632],
>[-30., -29.28831083]]), None)
>
> In [138]: p2
> Out[138]:
> Path(array([[-30.,  45.166 ],
>[-29.94756898,  45.09749304],
>[-29.87227011,  45.32033426],
>[-29.84525888,  45.54317549],
>[-29.86787108,  45.76601671],
>[-29.93898847,  45.98885794],
>[-30.,  46.10595725]]), None)
>
> I can do path.Path.make_compound_path(p1, p2) which joins them
> successfully.
> If I have a another path, p3, I can do:
> path.Path.make_compound_path(p1, p2,p3), and so on.
>
> However, in my script I never know how many paths I will have, so I'd like
>  to put them into some sort of container, and pass that to
>  make_compound_path.  I've tried lists:
>
>
> In [140]: p1p2 = [p1, p2]
>
> In [141]: path.Path.make_compound_path(p1p2)
> ---
> AttributeErrorTraceback (most recent call last)
>  in ()
> > 1 path.Path.make_compound_path(p1p2)
>
> /usr/lib64/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg
> /matplotlib/path.py
> in make_compound_path(cls, *args)
> 330 total_length = sum(lengths)
> 331
> --> 332 vertices = np.vstack([x.vertices for x in args])
> 333 vertices.reshape((total_length, 2))
> 334
>
> AttributeError: 'list' object has no attribute 'vertices'
>
>
> without success.  Can anybody suggest a way to do this?
>
> Thanks, Evan
>
>
>
> --
> 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=157005751&iu=/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=157005751&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Defaults?

2014-11-07 Thread Francesco Montesano
Hi Sebastian,

If you want to set the defaults only once and use them forever, there is
the matplotlibrc file (http://matplotlib.org/users/customizing.html)

If you want to easily change the defaults according to the context of the
plot mpltools by Tony S. Yu can help you (
https://github.com/tonysyu/mpltools)

Cheers,
Fra

2014-11-07 16:15 GMT+01:00 Sebastian Berg :

> Hey,
>
> just something I was wondering about today. I commonly want to change
> certain things about my plots. For example I like a serif/larger fonts,
> and everyone knows that "jet" is an awful default colour map almost
> always...
>
> It could be neat to have some more "default" rc's or so that can be
> loaded easily. I mean I could just create one for myself, but having
> some examples of what can be done and being able to switch that could be
> neat. Such as some defaults that are better for printing, maybe in
> matplotlib or really just on a website which shows some example plot for
> uploaded RCs.
>
> Anyway, just rambling :), I am not planning to really think about it
> much. And maybe some things even exist and I am not aware of it.
>
> Regards,
>
> Sebastian
>
>
> --
>
> ___
> 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] a possible bug report

2014-06-12 Thread Francesco Montesano
Hi Michael,

I don't have an answer about your bug. But the official place to report
possible bugs is github.
https://github.com/matplotlib/matplotlib/issues?state=open

Cheers,
Fra



2014-06-12 18:07 GMT+02:00 M.Rule :

> Hi all,
>
> I haven't been able to find a more official place to report potential
> Matplotlib bugs, so I'm going to describe the issue I'm seeing here. Sorry
> if this is the wrong forum.
>
> On my system, it takes matplotlib a very very long time to close plots.
> Sometimes, up to 20 minutes to close a simple figure. Creating new figures
> remains fast. The problem seems to occur only when I've loaded a large
> amount of data in to python ( on the order of 1GB ). I am using the current
> version of Ubuntu and running "ipython --pylab". To reproduce on my system,
> it is sufficient to load a large amount of data, create a plot.. any plot,
> and then try to close it using the little "x" at the top right corner of
> the window. The whole session will freeze for an extended period of time.
> The plot does not have to be complex: a hundred datapoints, a thousand, it
> makes no difference. Since the problem only occurs when a large amount of
> data has been loaded, my guess is that there is a problem with how
> Matplotlib/Pylab/Python is trying to free the memory associated with the
> figure?
>
> So... I just though I'd put this out there in case anyone else sees the
> same issue, or in case a developer who knows why this might be happening
> reads this. The workaround for me is... to simply wait for the figures to
> close, however long that may take, or restart the whole session.
>
> Best,
> michael.
>
>
> --
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] video without black bands

2014-03-13 Thread Francesco Montesano
Dear Diego,


2014-03-13 14:49 GMT+01:00 diedro :

> Dear B.,
> thanks a lot for your replay. I get it.
> What do you think is the measure for "w" and "h". Is the unit of measure
> in pixels?.
>
yes


> What does "fps" stand for?
>
frames per second


Cheers,
Francesco


> Thanks a lot
>
> Diego
>
>
>
> On 12 March 2014 16:05, Benjamin Root-2 [via matplotlib] <[hidden 
> email]
> > wrote:
>
>> In your options to mencoder, you are specifying the width/height as:
>>
>> >>> 'type=png:w=9800:h=600:fps=0.6',
>>
>> But your PNGs have size of 704x538 pixels. That's why you have black bars
>> on either side of your animation.
>>
>> Cheers!
>> Ben Root
>>
>>
>>
>> On Wed, Mar 12, 2014 at 7:16 AM, diedro <[hidden 
>> email]
>> > wrote:
>>
>>> sorry for that,
>>> I supposed that I was not more in the the first mailing list. When I
>>> post the second one, I realized that I was still in the mailing list
>>>
>>> Regarding the post:
>>> Image Type: png (The PNG image format)
>>> Width: 704 pixels
>>> Height: 538 pixels
>>>
>>> Thanks a lot
>>>
>>> Diego
>>>
>>>
>>>
>>> On 12 March 2014 12:10, Oliver [via matplotlib] <[hidden 
>>> email]
>>> > wrote:
>>>
 Please don't double post. Also, this post is much more informative than
 the first, it's much clearer now where the problem is, and it is not
 related to matplotlib at all, but with the options you're passing to
 *mencoder*.

 What's the size of your orginal pngs?



 2014-03-12 11:58 GMT+01:00 diedro <[hidden 
 email]
 >:

> Dear all,
> I have created a video from *.png files. The problem is that my video
> has
> black bands on the left and on the right. I have used the following
> commands:
>
> command = ('mencoder',
>'mf://*.png',
>'-mf',
>'type=png:w=9800:h=600:fps=0.6',
>'-ovc',
>'lavc',
>'-lavcopts',
>'vcodec=mpeg4',
>'-oac',
>'copy',
>'-o',
>'output.avi')
>
> How could I create a video without the black bands.
>
> Thank you all,
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/video-without-black-bands-tp43045.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> 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
> [hidden email] 
> 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
 [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/video-without-black-bands-tp43045p43046.html
  To unsubscribe from video without black bands, click here.
 NAML

>>>
>>>
>>> --
>>> View this message in context: Re: video without black 
>>> bands
>>>
>>> Sent from the matplotlib - users mailing list 
>>> archiveat 
>>> Nabble.com.
>>>
>>>
>>> 

Re: [Matplotlib-users] savefig - legend only

2014-01-31 Thread Francesco Montesano
Hi Peter,

just get the legend handlers and labels with

handles,labels = ax.get_legend_handles_labels()

then create an empty plot with axes `axe` and do

axe.legend(handles, labels, loc=loc)

If you want to hide the axis:

axe.xaxis.set_visible(False)
axe.yaxis.set_visible(False)

and/or

for v in axe.spines.values():
v.set_visible(False)

Enjoy,

Fra


2014-01-31 Peter Van Wieren 

>
> I would like to ask if there is a way to print only the legend box of a
> figure.
>
> The motiviation for wanting to do this is a work around to the problem of
> having the legend box obscuring data without resorting to "outside"
> placement of the legend.   The idea here is that matplotlib would provide
> two images:
>
> 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.
>
> Example follows:
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> x = np.linspace(0, 1)
> fig, (ax)  = plt.subplots(nrows=1)
> ax.plot( x , np.sin(2*np.pi*x) , label='Curve1')
> ax.plot( x , np.sin(2*np.pi*x+0.2) , label='Curve2')
> ax.set_title('Set default color cycle to rgby')
> plt.savefig('without_legend.png',dpi=75)
>
> if True: # Difficult to automatically make a location choice robust
>   ax.legend(loc='upper left') # in this particular case, a poor choice for
> placement
> else:
>   ax.legend(loc='upper right') # in this particular case, a good choice
> for placement
>
> plt.savefig('with_legend.png',dpi=75)
>
> # worst case solution could be post processing these files with imagemagick
> #   begin with "composite without_legend.png with_legend.png -compose
> difference alpha_channel.png"
> #... then filter with alpha_channel.png against with_legend.png
> #... finally crop this to get "legend_only.png"
>
>
>
> --
> 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=123612991&iu=/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=123612991&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how do I set the order of layers?

2013-08-24 Thread Francesco Montesano
use the "zorder" keyword. higher zorder stay above lower values.

cheers
Francesco
Il giorno 24/ago/2013 11:27, "vwf"  ha scritto:

> Hello,
>
> In the attached example I would like to have the wedges under the
> arrows. Can someone tell me how do this? I tried to follow the tutorial
> from http://matplotlib.org/users/artists.html  but I didn't really get
> it all.
>
> Thank you
>
>
> from pylab import *
> from numpy import ma
> import math
> import matplotlib.pyplot as plt
> from matplotlib.patches import Wedge
>
> X,Y = meshgrid( arange(0,2*pi,1),arange(0,2*pi,1) )
> U = cos(X)
> V = sin(Y)
>
> def draw_w(x, y, p1, v, ax=None, **kwargs):
> if ax is None:
> ax = plt.gca()
> p1*=180/math.pi
> t1= (p1-v)
> t2= (p1+v)
> c=(x,y)
> radius=0.5
> w1 = Wedge(c, radius, t1, t2, fc='0.0', ec='None', alpha=1.0, **kwargs)
> ax.add_artist(w1)
>
> fig, ax = plt.subplots()
> Q = plt.quiver( U, V, color='LightSalmon', edgecolors='LightSalmon')
> (a,b)=shape(X)
> for i in range(a):
> for j in range(b):
> draw_w(X[i,j],Y[i,j],X[i,j], 25, ax=ax)
> plt.show()
>
>
>
> --
> 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=48897511&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
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=48897511&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] multiple overlaid contour plots

2013-06-13 Thread Francesco Montesano
Dear Lado,

You should be able to do it simply by calling countourf multiple times
changing the alpha value (or setting it to something like 0.5)

plt.contourf(..., alpha=0.8, ...)
plt.contourf(..., alpha=0.6, ...)
plt.contourf(..., alpha=0.4, ...)

The problem comes when you want to save the figure as eps: it does not
support transparency, so the alpha level is ignored and all colors are
solid.

Cheers,

Francesco




2013/6/13 Lado Samushia 

> How can I plot multiple overlaid transparent contour plots in matplotlib?
> The link below has a plot that shows I am trying to achieve.
>
> https://docs.google.com/file/d/0B4HYv5Dbtu1Zb1VtOG9PTkJCeVU/edit?usp=sharing
>
>
> --
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
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 Francesco Montesano
Il giorno 26/apr/2013 13:16, "Hackstein"  ha
scritto:
>
> Thanks, Ryan, this is (amost) exactly what I was looking  for. Now, I get
the markers and their colors right, but I still have two problems:
> The markers have a black edges, that I cannot get rid of. I've tried
>
> rect = Rectangle(..., ec=None)
>
> and also
>
> col.set=edgecolor(None)

I think that you have to use the string 'none' instead of None type. The
latter is used to use the default value for the variable (in you case
black).

cheers
Francesco
>
> and 'None', respectively, both with no effect whatsoever.
>
> The second problem is, that I cannot get the colorbar to work.
> I tried
>
> sc = ax.add_collection(col)
> plt.colorbar(sc)
>
> and
>
> plt.colobar(col)
>
> both do not work.
> Any Ideas how to fix those two issues?
>
> Thanks,
>
> -Hackstein
>
>
> > Message: 4
> > Date: Thu, 25 Apr 2013 19:44:23 -0400
> > From: Ryan Nelson 
> > Subject: Re: [Matplotlib-users] Individual custom markers and colorbar
> > To: matplotlib-users@lists.sourceforge.net
> > Message-ID: <5179bfd7.7060...@gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hackstein,
> >
> > Unfortunately, I'm not sure of an 'elegant' way to do what your asking
> > with a single call to scatter. Others may know a better way. However,
> > you can use rectangle patches and patch collections. (Requires a bit
> > more code than scatter but is ultimately more flexible.)
> >
> > I think the example below does what you need, but with random numbers.
> >
> > Hope it helps a little.
> >
> > Ryan
> >
> > ###
> > import numpy as np
> > import matplotlib.pyplot as plt
> > from matplotlib.patches import Rectangle
> > from matplotlib.collections import PatchCollection
> >
> > n = 100
> >
> > # Get your xy data points, which are the centers of the rectangles.
> > xy = np.random.rand(n,2)
> >
> > # Set a fixed height
> > height = 0.02
> > # The variable widths of the rectangles
> > widths = np.random.rand(n)*0.1
> >
> > # Get a color map and color values (normalized between 0 and 1)
> > cmap = plt.cm.jet
> > colors = np.random.rand(n)
> >
> > rects = []
> > for p, w, c in zip(xy, widths, colors):
> > xpos = p[0] - w/2 # The x position will be half the width from the
> > center
> > ypos = p[1] - height/2 # same for the y position, but with height
> > rect = Rectangle( (xpos, ypos), w, height ) # Create a rectangle
> > rects.append(rect) # Add the rectangle patch to our list
> >
> > # Create a collection from the rectangles
> > col = PatchCollection(rects)
> > # set the alpha for all rectangles
> > col.set_alpha(0.3)
> > # Set the colors using the colormap
> > col.set_facecolor( cmap(colors) )
> >
> > # Make a figure and add the collection to the axis.
> > ax = plt.subplot(111)
> > ax.add_collection(col)
> > plt.show()
> >
> > ###
> >
> >
> > On 4/24/2013 5:35 PM, Hackstein wrote:
> >>
> >> Hi all,
> >>
> >> I am trying to get a scatter plot using a colormap. Additionally, I
> >> need to define every marker for every data point individually -- each
> >> being a rectangle with fixed height but varying width as a function of
> >> the y-value. X and y being the data coordinates, z being a number to
> >> be color coded with the colormap.
> >>
> >> Ideally, I would like to create a list of width and height values for
> >> each data point and tell the scatter plot to use those.
> >>
> >> So far I got colormapped data with custom markers (simplified):
> >>
> >> [code]
> >>
> >> import numpy as np
> >>
> >> import matplotlib.pyplot as plt
> >>
> >> from pylab import *
> >>
> >> x = y = [1,2,3,4,5]
> >>
> >> z = [2,4,6,8,10]
> >>
> >> colors = cm.gnuplot2
> >>
> >> verts_vec = list(zip([-10.,10.,10.,-10.],[-5.,-5.,5.,5.]))
> >>
> >> fig = plt.figure(1, figsize=(14.40, 9.00))
> >>
> >> ax = fig.add_subplot(1,1,1)
> >>
> >> sc = ax.scatter(x, y, c=np.asarray(z), marker=None, edgecolor='None',
> >> verts=verts_vec, cmap=colors, alpha=1.)
> >>
> >> plt.colorbar(sc, orientation='horizontal')
> >>
> >> plt.savefig('test.png', dpi=200)
> >>
> >> plt.close(1)
> >>
> >> [/code]
> >>
> >> But I need to define a marker size for each point, and I also need to
> >> do that in axis scale values, not in points.
> >>
> >> I imagine giving verts a list of N*2 tuples instead of 2 tuples, N
> >> being len(x), to define N individual markers.
> >>
> >> But when doing that I get the error that vertices.ndim==2.
> >>
> >> A less elegant way would be to plot every data point in an individual
> >> scatter plot function, using a for-loop iterating over all data
> >> points. Then, however, I see no way to apply a colormap and colorbar.
> >>
> >> What is the best way to accomplish that then?
> >>
> >> Thanks,
> >>
> >> -Hackstein
> >>
> >>
> >>
> >>
--
> >> Try New Relic Now & We'll Send You this Cool Shirt
> >> New Relic is the only SaaS-based application performance monitoring

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

2013-04-19 Thread Francesco Montesano
Hi John,

on Kubuntu Precise the standard repo has at least:

python3-pyqt4
python3-pyside
python3-tk

The first two should enable Qt4Agg backend, the last TkAgg

Fra


2013/4/19 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
>
--
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] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread Francesco Montesano
Hi John,

2013/4/18 John Ladasky 

> On 04/18/2013 01:01 AM, Francesco Montesano wrote:
>
>> does plt.savefig('test.png') work?
>>
> Yes, it does!  Thank you, that was a useful hint.


Good, than I would say that is a clear sign that you have a non interactive
backend.
Can you please give use the output of plt.get_backend() ?


>
>  If the figure get saved, it can be that you are using a non interactive
>> backend
>>
> Ugh, the one thing that I never understood about Matplotlib was backends.
>  So, what am I missing?  (Whatever I am missing now, I had it working a
> year ago when I was using matplotlib 1.1.0 on Python 2.7.)
>

This link http://matplotlib.org/faq/usage_faq.html#what-is-a-backend should
explain you what a backend is.

If you want to use always a specific backend, you should select it in the
matplotlibrc file

You should have a line like this
#backend  : TkAgg
Just uncomment it and put the backend that you want to use


> I have also just tried ipython3.  Nothing that I do in the live
> interpreter displays any graphs.
>
>
That is not surprising: if matplotlib doesn't use an interactive backend,
you can't show the figures, whatever interpreter you use.

I hope that now is clearer,

Fra

ps: try to remember to reply to the list :D
--
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] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread Francesco Montesano
Hi John,

does plt.savefig('test.png') work?

If the figure get saved, it can be that you are using a non interactive
backend

Cheers
Fra


2013/4/18 John Ladasky 

> Hello everyone,
>
> After not using Matplotlib for over a year, I'm returning to it.
> Meanwhile, I have upgraded from Python 2.7 to Python 3.2, and I want to
> do all of my software development in Python 3 from now on.
>
> My OS is Ubuntu 12.04.1.  Python 2.7 is still the default Python for
> Ubuntu, and many of the Python 3 packages are not offered as official
> repositories yet. I downloaded Matplotlib 1.2.1, then built it using
> Python 3.  Eventually, I got no build error messages, and proceeded to
> install. (I always have to pick through dependency problems one error
> message at a time.  I wish there was a better way.  The Matplotlib docs
> could be a little better in this respect.)
>
> When I open a Python3 interpreter, I can import matplotlib.  But I am
> not seeing ANYTHING with commands like plt.show().  It executes, and
> then returns.  No output is generated.
>
> This very short and simple test program of mine used to produce output
> with Python 2.7 and Matplotlib 1.1.0.  But with Python 3 and Matplolib
> 1.2.1, I am getting nothing...
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> x = np.arange(0, 5, 0.1);
> y = np.sin(x)
> plt.plot(x, y)
> plt.show()
>
> It runs.  No error messages are generated.  But I don't get a graph. I
> don't even see a graph flicker on to the screen and disappear an instant
> later.
>
> Any advice will be appreciated!
>
>
>
> --
> 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] "zig-zag" to represent suppressed 0 on axis?

2013-04-08 Thread Francesco Montesano
Il giorno 08/apr/2013 21:05, "Kevin Hunter Kesling"  ha
scritto:
>
> At 4:20pm -0400 Sun, 07 Apr 2013, Francesco Montesano wrote:
>>
>> Il giorno 07/apr/2013 21:03, Kevin Hunter Kesling ha scritto:
>>
>>> On the other hand, I'm still such a noob at Matplotlib ... is there
>>> a way to have one of the subplots take up more than its default 50%
>>> allotment?
>>
>>
>> you can give a look at the last two plots in this example
>> http://matplotlib.org/examples/pylab_examples/demo_tight_layout.html or
use
>> plot.axes providing the rectangle that you want
>
>
> That is closer to what I want, but still not there.  I was finally able
to find something that fit the bill to 95% of what I want:
>
>
http://matplotlib.1069221.n5.nabble.com/Proposal-for-Broken-Axes-td38050.html
>
> The first post by 'klukas' does exactly what I asked for.  It's a zig-zag
on the Y-axis to show that what is graphed is not continuous, and unlike
the various "official" examples, the zig-zag placement is user-specifiable,
as opposed to exactly halfway between the top and bottom.
>
> The only thing I have yet to figure out how to do is to simultaneously
have a zig-zag on the X axis as well -- an artifact of how these zig-zags
must be created via multiple axes on the same figure, rather than as built
in to the axis artist.
>
> For googleability:
>
> The above linked graph code enables for matplotlib:
>
>  - suppressed zeros on the Y-axis of an XY plot
>  - showing suppressed data on the Y-axis
>  - lightning bolt symbol on the Y-axis
>  - zig-zag on the Y-axis
>  - a "broken" Y-axis
>
> Thanks for your pointers, Francesco, as they helped me to fine-tune my
Google search terms.  And thank you, Klukas, whoever you are.
>

I'm half that you found the solution for your problem and to have been
useful just providing links. This has been one of the easiest answer I have
ever given :)

And mostly thanks for sharing your findings.

cheers and good night,
Fra

> Cheers,
>
> Kevin
--
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] "zig-zag" to represent suppressed 0 on axis?

2013-04-07 Thread Francesco Montesano
Il giorno 07/apr/2013 21:03, "Kevin Hunter Kesling"  ha
scritto:
>
> At 2:34pm -0400 Sun, 07 Apr 2013, Francesco Montesano wrote:
>>
>> 2013/4/7 Kevin Hunter Kesling
>>
>>> I'm looking for a way to represent on an X-Y graph the fact that an axis
>>> does not start from the origin.  When drawing by hand, I'll use a little
>>> zig-zag, lightning bolt, or slight space on the axis in question to
>>> represent this fact, just off from where the X and Y axis lines meet.
>>> How would I go about telling Matplotlib to do this?  After two hours of
>>> perusing the Axes documentation, and tooling around in an IPython shell,
>>> I appear to be striking out.
>>>
>>> If you are using a monospaced font to view this email, this may
>>> illustrate the functionality for which I'm looking:
>>>
>>>150 ||  * *
>>>145 ||  *  *
>>>140 || **
>>>135 || *
>>>130 ||
>>>/
>>> /  < "zig zag" I want
>>>||
>>>  0   
>>> 0   1   2   3   4   5   6   7   8
>
>
>> Have you given a look at this example:
>> http://matplotlib.org/examples/pylab_examples/broken_axis.html
>
>
> Damn, I clearly missed that one.  And once I know what I'm looking for,
my eye goes right to it.  Sorry for the noise.
>
> On the other hand, I'm still such a noob at Matplotlib ... is there a way
to have one of the subplots take up more than its default 50% allotment?
>
> Thanks,
>
> Kevin

hi Kevin,
you can give a look at the last two plots in this example
http://matplotlib.org/examples/pylab_examples/demo_tight_layout.html or use
plot.axes providing the rectangle that you want

fra
--
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] "zig-zag" to represent suppressed 0 on axis?

2013-04-07 Thread Francesco Montesano
2013/4/7 Kevin Hunter Kesling 

> Hullo Matplotlib List,
>
> I'm looking for a way to represent on an X-Y graph the fact that an axis
> does not start from the origin.  When drawing by hand, I'll use a little
> zig-zag, lightning bolt, or slight space on the axis in question to
> represent this fact, just off from where the X and Y axis lines meet.
> How would I go about telling Matplotlib to do this?  After two hours of
> perusing the Axes documentation, and tooling around in an IPython shell,
> I appear to be striking out.
>
> If you are using a monospaced font to view this email, this may
> illustrate the functionality for which I'm looking:
>
>
>   150 ||  * *
>   145 ||  *  *
>   140 || **
>   135 || *
>   130 ||
>   /
>/  < "zig zag" I want
>   ||
> 0   
>0   1   2   3   4   5   6   7   8
>
>
> Many thanks for any help,
>
> Kevin
>
>
> --
> 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
>

Hi Kevin,

Have you given a look at this example:
http://matplotlib.org/examples/pylab_examples/broken_axis.html

Francesco
--
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] real time plotting

2013-03-11 Thread Francesco Montesano
Dear Neal,

2013/3/11 Neal Becker 

> I want to update a plot in real time.  I did some goog search, and saw
> various
> answers.  Trouble is, they aren't working.
>
> Here's a typical example:
>
> import matplotlib.pyplot as plt
> import numpy as np
> fig=plt.figure()
> plt.axis([0,1000,0,1])
>
> i=0
> x=list()
> y=list()
>
> while i <1000:
> temp_y=np.random.random()
> x.append(i)
> y.append(temp_y)
> plt.scatter(i,temp_y)
> i+=1
> plt.draw()
>
> If I run this, it draws nothing.
>
> This is my matplotlibrc:
> backend : Qt4Agg
> mathtext.fontset: stix
>

do you use interactive mode? (plt.ion() before creating the figure)
Francesco



>


>
>
> --
> 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] Newbie help with subplots

2013-02-01 Thread Francesco Montesano
2013/2/1 Benjamin Root 

>
>
> On Fri, Feb 1, 2013 at 11:04 AM, Jeff Layton  wrote:
>
>> Good morning,
>>
>> I'm been using matplotlib for a while but it's always been very
>> simple plots (hey - I'm a simple person). I have a need for some
>> "fancier" plots using subplots.
>>
>> I want to have 3 charts one above the other with a single set of
>> x-axis labels on the bottom subplot that works for all three charts.
>> I'd also like to put a legend outside the set of three charts - either
>> to the top right or horizontally along the bottom.
>>
>> I've been reading a number of links and nothing really works.
>> Most everything is around pylab and I'm using just straight
>> matploblib. I hate to say it, but I need to have the solution and
>> I'm looking for some newbie help. One of the frustrating aspects
>> is I need to make sure it works for version 0.91 :(
>>
>> I'm attaching a simple example script that shows the plots
>> as I currently have achieved them. Apologies for any bad coding.
>> Just in case the attachment doesn't make it through the code is
>> below.
>>
>> Thanks!
>>
>> Jeff
>>
>>
>>
> I don't know when it was introduced, but ax.label_outer() (called on each
> axes object) can help you with the axis labeling.  If that works, we can
> then tackle legend placement.
>

if it does not work should be possible to do for ax1 and ax2

[t.set_visible(False) for t in ax.get_xticklabels()]

Francesco



> Ben Root
>
>
>
> --
> 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_jan
> ___
> 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_jan___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] creating an object oriented matplotlib figure

2013-01-16 Thread Francesco Montesano
Hi Kelson,

2013/1/16 Kelson Zawack 

> I want to create a matplotlib figure as part of a program I am writing
> and therefore would like to create the figure in a fully object oriented
> way, ie not in the pyplot state-full way.  I understand how to work with
> a figure object to create axes objects and then fill the axes objects
> with primitive artists but I can't figure out what type of object to put
> the figure object in to get it displayed.

using qt4agg for me this works (version 1.2.0)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,2])
fig.show()

>From digging around in the
> source it looks like the show() method comes from the backend, but when
> I looked in 'matplotlib/backends/backend_agg' I saw no such object.
> What am I missing?  I guess I could put the figure in a Qt window, but I
> like the functionality provided by the default matplotlib window.
>
> Thanks for the help
>

"agg" is not an interactive backend and is useful only when saving figures (
http://matplotlib.1069221.n5.nabble.com/Backend-Agg-show-plot-td13162.html).
Thats why there is no show().
e.g. qt4agg gets show from qt4

does this help?

Francesco


>
>
>
> --
> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
> and much more. Keep your Java skills current with LearnJavaNow -
> 200+ hours of step-by-step video tutorials by Java experts.
> SALE $49.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122612
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] subplots: common x and y labels

2012-11-13 Thread Francesco Montesano
Dear matplolibers,

when dealing with multi-axes plot sometimes would be nice to use
figure-wide x and y labels.
On the web I've found some suggestion on how to do this, but I found
no solution valid in the general case and that integrate in the
matplotlib ecosystem.
The ideal would be to have a "set_xlabel" and "set_ylabel" method in the
Figure class, with the same api of the corresponding Axes methods.

As a proof of concept I've written a class derived from Figure , which
implements the two methods simply adding a horizontal (vertical) text below
(left of) the lowest (leftmost) axes.
The class together with a short example is attached.
I'm aware that the current implementation is really poor (no integration
with tight_layout, the padding must be adjusted by hand, a problem in
particular for the y label).

The best is to use "self.xaxis.set_label_text(xlabel, fontdict, **kwargs)"
as in the Axis set_xlabel (as I gather this create a label that is rendered
in the correct position accounting for ticklabels, ticks, tight_layout,
etc). To do this one would have to create:

   - a figure-wide invisible axes that encloses all the other
   axes/subplots, and whose dimension has to be updated every time a new
   axis/subplot is added (this should be easily done) with only the label
   visible. This could also allow to use axis features, like twin axis.
   - just the required axis (invisible) that hosts the labels. I think that
   this approach is less demanding computationally, but I don't know how much
   sense have two axis not attached to axes.

Any suggestions/hints on how to implement these methods in a better way is
very welcome.

If there is no opposition, later in the day I'll submit PR on github with
the two new method and see if we can get something out of this idea.

Cheers,
Francesco


test_set_label_fig.py
Description: Binary data
--
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] default backend on 1.2.0rc1 and master

2012-10-17 Thread Francesco Montesano
2012/10/17 Damon McDougall 

> On Wed, Oct 17, 2012 at 9:12 AM, Francesco Montesano
>  wrote:
> >
> >
> > 2012/10/17 Eric Firing 
> >>
> >> On 2012/10/16 9:22 PM, Francesco Montesano wrote:
> >> > Dear list,
> >> >
> >> > I've see a difference between the default backend between
> >> >
> >> > v1.1.1 (shipped with kubuntu 12.10dev) and v1.2.0.rc1, 1.2.0rc2 and
> >> > master (1.3.x).
> >> >
> >> >
> >> > My set up is to call ipython with pylab and turn on interactive mode.
> I
> >> > still haven't copied over my matplotlibrc file from my work computer
> >> > (there I use qtagg, if I remember well)
> >> >
> >> >
> >> > On v1.1.1 the default is [backend: TkAgg], while in the other two
> cases
> >> > it is  [backend: agg]. Is there some reason for this difference?
> >>
> >> The default should be based on what is found when mpl is built, so it
> >> sounds like when you are building v1.2.x, none of the supported gui
> >> toolkits is being found.  I don't know why that is.  Are you installing
> >> on a system that has gui toolkits already installed?
> >
> > I think so, as the v1.1.1 shipped with my OS is using TkAgg as backend
> and I
> > can plot interactively.
> >
> > When I build from source I get
> > OPTIONAL BACKEND DEPENDENCIES
> > libpng: found, but unknown version (no pkg-config)
> >Tkinter: no
> > * Using default library and include directories
> for
> > * Tcl and Tk because a Tk window failed to open.
> > * You may need to define DISPLAY for Tk to work
> so
> > * that setup can determine where your libraries
> are
> > * located. Tkinter present, but header files are
> not
> > * found. You may need to install development
> > * packages.
> > * You may need to install 'dev' package(s) to
> > * provide header files.
> >   Gtk+: no
> > * Could not find Gtk+ headers in any of
> > * '/usr/local/include', '/usr/include',
> > * '/usr/local/include', '/usr/include', '.'
> >Mac OS X native: no
> > Qt: no
> >Qt4: Qt: 4.8.2, PyQt4: 4.9.3
> > PySide: no
> >  Cairo: 1.8.8
> >
> > Could be a problem with Tkinter and dev packages.
> >
> >
> >>
> >>
> >> One useful
> >> technique with ubuntu derivatives is to do
> >>
> >> sudo apt-get build-dep python-matplotlib
> >>
> > probably it's easier if I just switch to qtagg, as I already have it
> >
> >>
> >> It might pull in more than you really want, but it will certainly
> >> include gui toolkits.
> >>
> >> Eric
> >
> > Thanks,
> > Francesco
> >
> >>
> >>
> >> >
> >> >
> >> > cheers,
> >> >
> >> > Francesco
>
> Packages have whatever default backend the maintainer decided to build
> them with. For example, the macports packaged version of matplotlib is
> maintained by someone who specifies the macosx backend to be the
> default. When building from source, I think the TkAgg backend is the
> default, because most platforms have tkinter installed out of the box.
> Since it appears you don't have Tkinter installed, Agg is the default.
>
> Agg is a non-gui backend (but it produces awesome output).
>

Thanks for the explanation.

Fra


>
> --
> Damon McDougall
> http://www.damon-is-a-geek.com
> B2.39
> Mathematics Institute
> University of Warwick
> Coventry
> West Midlands
> CV4 7AL
> United Kingdom
>
--
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_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] default backend on 1.2.0rc1 and master

2012-10-17 Thread Francesco Montesano
2012/10/17 Eric Firing 

> On 2012/10/16 9:22 PM, Francesco Montesano wrote:
> > Dear list,
> >
> > I've see a difference between the default backend between
> >
> > v1.1.1 (shipped with kubuntu 12.10dev) and v1.2.0.rc1, 1.2.0rc2 and
> > master (1.3.x).
> >
> >
> > My set up is to call ipython with pylab and turn on interactive mode. I
> > still haven't copied over my matplotlibrc file from my work computer
> > (there I use qtagg, if I remember well)
> >
> >
> > On v1.1.1 the default is [backend: TkAgg], while in the other two cases
> > it is  [backend: agg]. Is there some reason for this difference?
>
> The default should be based on what is found when mpl is built, so it
> sounds like when you are building v1.2.x, none of the supported gui
> toolkits is being found.  I don't know why that is.  Are you installing
> on a system that has gui toolkits already installed?

I think so, as the v1.1.1 shipped with my OS is using TkAgg as backend and
I can plot interactively.

When I build from source I get
OPTIONAL BACKEND DEPENDENCIES
libpng: found, but unknown version (no pkg-config)
   Tkinter: no
* Using default library and include directories for
* Tcl and Tk because a Tk window failed to open.
* You may need to define DISPLAY for Tk to work so
* that setup can determine where your libraries are
* located. Tkinter present, but header files are not
* found. You may need to install development
* packages.
* You may need to install 'dev' package(s) to
* provide header files.
  Gtk+: no
* Could not find Gtk+ headers in any of
* '/usr/local/include', '/usr/include',
* '/usr/local/include', '/usr/include', '.'
   Mac OS X native: no
Qt: no
   Qt4: Qt: 4.8.2, PyQt4: 4.9.3
PySide: no
 Cairo: 1.8.8

Could be a problem with Tkinter and dev packages.



>
> One useful
> technique with ubuntu derivatives is to do

sudo apt-get build-dep python-matplotlib
>
> probably it's easier if I just switch to qtagg, as I already have it


> It might pull in more than you really want, but it will certainly
> include gui toolkits.
>
> Eric
>
Thanks,
Francesco


>
> >
> >
> > cheers,
> >
> > Francesco
> >
> >
> >
> >
> --
> > 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_sfd2d_oct
> >
> >
> >
> > ___
> > 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_sfd2d_oct
> ___
> 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_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] default backend on 1.2.0rc1 and master

2012-10-17 Thread Francesco Montesano
Dear list,

I've see a difference between the default backend between

v1.1.1 (shipped with kubuntu 12.10dev) and v1.2.0.rc1, 1.2.0rc2 and master
(1.3.x).


My set up is to call ipython with pylab and turn on interactive mode. I
still haven't copied over my matplotlibrc file from my work computer (there
I use qtagg, if I remember well)


On v1.1.1 the default is [backend: TkAgg], while in the other two cases it
is  [backend: agg]. Is there some reason for this difference?


cheers,

Francesco
--
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_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Corrupted percent signs in labels

2012-10-09 Thread Francesco Montesano
Hi

2012/10/9 Nikolaus Rath 

> Hello,
>
> For some reason, my matplotlib isn't able to print percent signs ('%')
> properly:
>
> [1] inspiron:~/tmp# cat mplbug.py
>
> import matplotlib
> import matplotlib.pyplot as plt
> import numpy as np
>
> print matplotlib.__version__
> plt.plot(np.arange(10), np.arange(10)**2)
> plt.xlabel('Percent [%]')
> plt.savefig('mplbug.pdf')
>
> [0] inspiron:~/tmp# python mplbug.py
> 1.1.1rc2
>
> I have attached the resulting PDF. For some reason, the slash in the
> percent sign becomes a triangle that partially covers the upper left
> circle.
>
> Known bug? Any workarounds that don't require upgrading (I'd like to
> stick with the Debian package)?
>

confirmed for pdf and eps figures. For jpg and png, as well as the
matplotlib window with TkAgg the percentage looks fine.
matplotlib version: 1.1.1 shipped with kubuntu 12.10

Francesco


>
>
> Thanks,
>
>-Nikolaus
>
> --
>  »Time flies like an arrow, fruit flies like a Banana.«
>
>   PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C
>
>
> --
> 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] Matplotlib produced plots in academic journal articles

2012-10-05 Thread Francesco Montesano
2012/10/5 Gökhan Sever 

>
>
> On Fri, Oct 5, 2012 at 1:23 PM, Damon McDougall  > wrote:
>
>> On Fri, Oct 5, 2012 at 8:11 PM, Gökhan Sever 
>> wrote:
>> > Seeing mpl produced plots would be only 1 or 2 clicks away, plus this
>> would
>>
>> This is not true. A lot of articles are unavailable to certain
>> institutions due to a lack of subscription. A major sticking point.
>>
>>
> I was only thinking open-access journals, which open-source users (i.e.
> users of python tools) tend to publish their articles in open-journals. Of
> course, there are subscription required articles but those are secondary
> concerns. Sometimes authors make their articles publicly available even the
> article is on a paid journal.
>
>
>
>>
>>
>> > provide context to the use of plots rather that extracting figures and
>> > putting them separately (dealing with copyright issues and such) on an
>> > alternative gallery page. The figures you linked look shinny but not
>> much
>> > practical use in my field.
>>
>> Point taken on the context argument. I'll take that. To resolve it,
>> make the figure/html image link to the underlying publication?
>>
>>
> Citation listing is easier for me, we can go both ways, a page listing
> only citations, another one a more experimental figure/citation if
> copyright issues can be resolved easily. In anyways, we will have to gather
> citations. Let's start doing that?
>
>
I think that an official acknowledgment that people can copy and paste (and
adapt) in their paper would be a great idea.

Francesco


>
> --
> Gökhan
>
>
> --
> 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 Francesco Montesano
Hi Daniel,

2012/9/13 Daniel Welling 
>
> 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?

To obtain what you want you have to set the tick labels invisible is
the axes where you don't want them to show up.
>From http://matplotlib.org/examples/pylab_examples/shared_axis_demo.html:
setp( ax.get_xticklabels(), visible=False)

As the axis are shared, the ticklabels are also shared, so setting
them to "", erase them from all the axes.
I hope that this helps.

Cheers,
Francesco


>
> 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] strange behaviour with fill_between

2012-09-04 Thread Francesco Montesano
Dear Eric,

sorry for the delay in replying, and thanking: I forgot the mail after
reading it.

2012/8/30 Eric Firing :
> On 2012/08/27 5:10 AM, Francesco Montesano wrote:
>> Dear matplotlibers,
>>
>> I encountered a bug (?) in fill_between when using logarithmic scales and
>> the last part of y and yerr arrays as set to zero: a diagonal stripe going 
>> from
>> the rightmost non zero value to the first value is drawn.
>> It's visible in the right panel of the attached figure, while is not
>> present if the plot is linear (left panel).
>> If xaxis is log and yaxis is linear the plot is correctly drawn.
>>
>> I'm using mpl.__version__ = '1.1.1rc' under Kubuntu 12.04 with Python 2.7.3
>>
>> The plot has been created with the script below.
>>
>> Is this a bug or am I missing something?
>
> I don't think it is exactly a bug, but I don't know why the fill region
> is appearing as it does.  The underlying problem is that fill_between is
> doing what it is told to do without knowing that it is going to be
> plotted on a log axis.
I think that also most of the other plotting functions (e.g. errorbar)
do not know about the scale used on the axis, but they behave
correctly. Am I right?


> A good workaround is to change your call to fill_between to look like this:
> positive = y - yerr > 0
> ax2.fill_between( x,y-yerr,y+yerr, where=positive, color='b', alpha=0.4)
>
> Alternatively, you could use np.clip to put a floor under y - yerr and y
> + yerr.

The workaround works fine, but I dare say that it's not THE solution.
I think that the problem lies in the way PolyCollection is drawn when
y=yerr=0 (and probably also if y+- yerr <=0) if the yaxis is log. I
have no clue where to look in the source to go deeper in the problem.

cheers,
Fra

> Eric
>
>>
>> Cheers
>> Francesco
>>
>>
>> # error_fill_between.py ##
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>> #values to plot
>> x = np.linspace( 1, 10, num=100 )
>> y = np.exp( -x**2 )
>> y[50:] = 0
>> yerr = y* np.random.rand(100)
>>
>> #figure
>> fig = plt.figure()
>>
>> ax1 = fig.add_subplot(121)  #first axes: linear
>> ax1.errorbar( x,y,yerr, c='r' )
>> ax1.fill_between( x,y-yerr,y+yerr, color='b', alpha=0.4 )
>>
>> ax2 = fig.add_subplot(122)  #second axes: logarithmic
>> ax2.errorbar( x,y,yerr, c='r' )
>> ax2.fill_between( x,y-yerr,y+yerr, color='b', alpha=0.4 )
>> ax2.set_xscale( "log" )
>> ax2.set_yscale( "log" )
>>
>> plt.show()
>> ## end script  #
>>
>>
>>
>> --
>> 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

--
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] strange behaviour with fill_between

2012-08-27 Thread Francesco Montesano
Dear matplotlibers,

I encountered a bug (?) in fill_between when using logarithmic scales and
the last part of y and yerr arrays as set to zero: a diagonal stripe going from
the rightmost non zero value to the first value is drawn.
It's visible in the right panel of the attached figure, while is not
present if the plot is linear (left panel).
If xaxis is log and yaxis is linear the plot is correctly drawn.

I'm using mpl.__version__ = '1.1.1rc' under Kubuntu 12.04 with Python 2.7.3

The plot has been created with the script below.

Is this a bug or am I missing something?

Cheers
Francesco


# error_fill_between.py ##
import matplotlib.pyplot as plt
import numpy as np

#values to plot
x = np.linspace( 1, 10, num=100 )
y = np.exp( -x**2 )
y[50:] = 0
yerr = y* np.random.rand(100)

#figure
fig = plt.figure()

ax1 = fig.add_subplot(121)  #first axes: linear
ax1.errorbar( x,y,yerr, c='r' )
ax1.fill_between( x,y-yerr,y+yerr, color='b', alpha=0.4 )

ax2 = fig.add_subplot(122)  #second axes: logarithmic
ax2.errorbar( x,y,yerr, c='r' )
ax2.fill_between( x,y-yerr,y+yerr, color='b', alpha=0.4 )
ax2.set_xscale( "log" )
ax2.set_yscale( "log" )

plt.show()
## end script  #


error_fill_between.pdf
Description: Adobe PDF document
--
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] basemap via macports

2012-08-24 Thread Francesco Montesano
2012/8/24 Carlos Grohmann :
> Hello all,
>
> I just did a fresh macports install, and installed py27-matplotlib-basemap,
> so all dependencies were installed as well.
>
> After installing python, I did run port-select (or something like it) to
> make sure I'm using macports python.
>
> My problem is that I can't run it:
>
>
> GuanoMac:~ guano$ python
> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
 from mpl_toolkits.basemap import Basemap
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: No module named basemap
>
>
> Anyone experienced in this kind of installation could share hints?

if you do
import sys
print sys.path

you can check if the directory of basemap is in your path

if not, you can add it both in the scritp/session
appending/inserting/extending sys.path (which is a list):
e.g.: sys.path.append( "dir/to/basemap" )
or in the .profile, .bash_profile or .bash_rc files (in this way is
loaded in every session)
export PYTHONPATH=$PYTHONPATH:dir/to/basemap


cheers,
Francesco

>
> tks
>
> Carlos
>
> --
> Prof. Carlos Henrique Grohmann
> Institute of Geosciences - Univ. of São Paulo, Brazil
> - Digital Terrain Analysis | GIS | Remote Sensing -
>
> http://carlosgrohmann.com
> 
> Can’t stop the signal.
>
>
> --
> 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] Axis ticks 'zorder'

2012-07-30 Thread Francesco Montesano
Hi,

2012/7/30 oc-spam65 :
> Hello,
>
> Can the 'zorder' of the ticks be set? This minimal example shows a
> hard-coded value of 2.5
>
> This may come from file "matplotlib/axes.py", function "draw()". Can it
> be adjusted? Shall it be bug-reported?
>
> ###
> import matplotlib.pyplot as pyplot
>
> fig = pyplot.figure()
> ax = fig.add_subplot("111")
>
> ax.add_patch(pyplot.Rectangle((0,0), 1, 1, zorder=3))
> ax.xaxis.set_zorder(4)
> # Expected behavior: the ticks should be drawn after the Rectangle,
> # because 4 > 3. They should therefore be visible.
>
> pyplot.show()
> # Problem: The ticks are hidden by the rectangle, contrary to the
> # expected behavior.
>
> print(ax.xaxis.get_zorder())
> # Prints 2.5 instead of 4!
>
> ###

I confirm the bug on matplotlib v: 1.1.0, Kubuntu 11.04, Python 2.7.1+

>>> ax.xaxis.set_zorder(4)
>>> ax.xaxis.get_zorder()
 4
>>> plt.draw()
>>> ax.xaxis.get_zorder()

It seems that the call to draw or show sets the zorder to default,
instead of updating it.

@Mr Spam (can you sign your mail, please)
In one of my scripts managed to set zorder to the spines as, e.g.,
ax.spines['left'].set_zorder(101).
This puts the axis spine well on top, but ax.xaxis.set_zorder does
nothing. I've also found a method ax.tick_params,
that has a zorder keyword, but it does nothing too.

Cheers,
Francesco

>
> --
> 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] Placing a 'title' inside a legend

2012-07-27 Thread Francesco Montesano
Hi Andreas,

2012/7/27 Andreas Hilboll :
>> Hi Andreas,
>>
>> 2012/7/27 Andreas Hilboll :
>>> Hi,
>>>
>>> I'd like to place something like a 'title' inside a legend's box. In my
>>> specific case, I have a legend with 5 entries, arranged in 5 columns, so
>>> they're horizontally next to each other in one row. Now what I'd like to
>>> have is inside the legend's box a first row (above the legend entries),
>>> where I can write some text.
>>>
>>> Any ideas?
>>
>> The keyword 'title' in legend
>> (http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend)
>> should work.
>
> Almost embarassingly simple ... however: It looks like the title is in a
> smaller font size than the other legend texts. Do I have some control
> about the font size of the legend's title? Couldn't find anything in the
> plt.legend docstring (I'm on 1.1.1).

try:
l = ax.legend( patches, labels, ..., title="legend title")
t = l.get_title()  #get the text object containing the title
t.set_fontsize(30)  #set the font size

you can merge the last two lines together l.get_title().set_fontsize(30)

Francesco

>
> Cheers, A.
>
>
> --
> 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] Placing a 'title' inside a legend

2012-07-27 Thread Francesco Montesano
Hi Andreas,

2012/7/27 Andreas Hilboll :
> Hi,
>
> I'd like to place something like a 'title' inside a legend's box. In my
> specific case, I have a legend with 5 entries, arranged in 5 columns, so
> they're horizontally next to each other in one row. Now what I'd like to
> have is inside the legend's box a first row (above the legend entries),
> where I can write some text.
>
> Any ideas?

The keyword 'title' in legend
(http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend)
should work.

Francesco

>
> Cheers, Andreas.
>
>
> --
> 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] How to plot only a legend?

2012-07-26 Thread Francesco Montesano
Hi,

you should be also able to create the axes as:

ax = plt.figure( figsize=(x,y) ).add_subplot(111)
with figsize big enough to fit just the legend

Cheers
Francesco

2012/7/26 Damon McDougall :
> On Thu, Jul 26, 2012 at 06:05:39PM +0200, Andreas Hilboll wrote:
>> > Hi Andreas,
>> >
>> > 2012/7/26 Andreas Hilboll :
>> >> Hi,
>> >>
>> >> I would like to create a figure which only contains a legend, and no
>> >> axes
>> >> at all. I would like to manually assign the colors. I found this here:
>> >>
>> >>http://stackoverflow.com/a/3302666
>> >>
>> >> but from there on, I'd like to remove the axes, and put the legend into
>> >> three columns.
>> >
>> > If the plot attached it's fine for you it's easy:
>> >
>> > import matplotlib.pyplot as plt
>> > ax = plt.subplot()  #create the axes
>> > ax.set_axis_off()  #turn off the axis
>> >   #do patches and labels
>> > ax.legend(patches, labels, ...)  #legend alone in the figure
>> > plt.show()
>> >
>> > Cheers,
>> > Francesco
>>
>> That's really easy :) I could live with this solution, applying some
>> external tool like pdfcrop to the result. Of course, it would be nicer if
>> the PDF's page size would be exactly that of the legend (plus some
>> margin), so that I wouldn't have to resort to external tools ...
>>
>> Any ideas?
>>
>
> How about
>
> plt.savefig('roflcakes.png', bbox_inches='tight', pad_inches=0.1)
>
> Since the other artists are invisible, that should crop to just your
> legend. I'm assuming matplotlib updates the BoundingBox such that it
> doesn't include invisible artists.
>
>>
>> Cheers, A.
>>
>>
>> --
>> 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
>
> --
> Damon McDougall
> http://damon-is-a-geek.com
> B2.39
> Mathematics Institute
> University of Warwick
> Coventry
> West Midlands
> CV4 7AL
> United Kingdom
>
> --
> 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] How to plot only a legend?

2012-07-26 Thread Francesco Montesano
Hi Andreas,

2012/7/26 Andreas Hilboll :
> Hi,
>
> I would like to create a figure which only contains a legend, and no axes
> at all. I would like to manually assign the colors. I found this here:
>
>http://stackoverflow.com/a/3302666
>
> but from there on, I'd like to remove the axes, and put the legend into
> three columns.

If the plot attached it's fine for you it's easy:

import matplotlib.pyplot as plt
ax = plt.subplot()  #create the axes
ax.set_axis_off()  #turn off the axis
  #do patches and labels
ax.legend(patches, labels, ...)  #legend alone in the figure
plt.show()

Cheers,
Francesco

>
> Any help is greatly appreciated :)
> Andreas.
>
>
> --
> 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


test.pdf
Description: Adobe PDF document
--
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] mimic alpha (channel) v0.1

2012-07-19 Thread Francesco Montesano
2012/7/18 Francesco Montesano :
> 2012/7/18 Jonathan Slavin :
>> Ben,
>>
>> Yes, you're right, but I doubt any solution that involves mimicking an
>> alpha channel will work for one case that I've been using.  That is,
>> making the legend box partially transparent.  I use that to allow the
>> box to fit in the plot without blocking the data and without the need to
>> make the upper y limit too large.
> My solution would probably work if you could, pixel by pixel (or patch
> by patch), mimic alpha in each layer using as background the resulting
> color of the previous layer.
>
> Do anyone know if it is possible to implement something like this in
> matplotlib when saving a eps or in a backend?
>
>>
>> I don't notice any problems with blockiness in the text or lines in the
>> raster image.  I'll find out soon if the editors of the Astrophysical
>> Journal are okay with the figures.
> I guess that you produce the figures roughly of the right size (about
> 8 or 16 cms wide for single or double column figures)  and then
> convert. So probably you see that the figure is a raster if you zoom
> in.
>
> Fra
>
>>
>> Jon
>>
>> On Tue, 2012-07-17 at 15:34 -0500, Benjamin Root wrote:
>>>
>>>
>>> On Tue, Jul 17, 2012 at 3:01 PM, Jonathan Slavin
>>>  wrote:
>>> Francesco,
>>>
>>> While I like your solution, there is an alternative that is
>>> simpler and
>>> works for me.  That is 1) save matplotlib plot as a png, 2)
>>> convert to
>>> eps using either ImageMagick or GraphicsMagick.  You do end up
>>> with
>>> relatively large files, but they look identical to the
>>> original plots.
>>>
>>> Regards,
>>> Jon
>>>
>>> No, it is not the same thing.  Text in a vector-based format such as
>>> eps is scalable.  ImageMagick and GraphicsMagick are inherently
>>> raster-based, and before that, PNGs are raster-based.  Therefore, the
>>> text is not scaled and anti-aliased according to the display size.
>>>
>>> I will be looking over the proposed solution this evening.
>>>
>>> Cheers!
>>> Ben Root
>>>
>>>

Dear matplotlibers,
I've uploaded a new version which accepts also lists/tuple/numpy
arrays of colors and/or alphas and returns a list of RGB colors.
https://github.com/montefra/mimic_alpha
https://github.com/montefra/mimic_alpha/downloads

Cheers,
Francesco

--
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] gallery link broken/not working

2012-07-19 Thread Francesco Montesano
done: https://github.com/matplotlib/matplotlib/issues/1024
Fra

2012/7/19 Phil Elson :
> I can confirm the bad link.
> Would you mind opening a new issue on github for this?
>
> github.com/matplotlib/matplotlib/issues/new
>
> Thanks,
>
> On 19 July 2012 10:15, Francesco Montesano  wrote:
>> Hi,
>>
>> roaming through the gallery I've found that in
>> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_00.html
>> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_01.html
>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider_01.html
>> and maybe others do not work
>>
>> error:
>> 1. Server: matplotlib.sourceforge.net
>> 2. URL path: /examples/pylab_examples/demo_tight_layout_00.html
>> 3. Error notes: NONE
>> 4. Error type: 404
>> 5. Request method: GET
>> 6. Request query string: NONE
>> 7. Time: 2012-07-19 09:12:32 UTC (1342689152)
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout.html
>> works fine
>>
>> Cheers,
>>
>> Francesco
>>
>> --
>> 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] need an icon for a new featureH

2012-07-19 Thread Francesco Montesano
2012/7/19 Nicolas Rougier :
>
>
> What size/format do you need and would that be an option to transform/use 
> Tango icons ?
>
> http://tango.freedesktop.org/
> http://commons.wikimedia.org/wiki/Tango_icons
>
>
> Tango (for fullscreen but might suit tight-layout)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Nicolas
>
>
> On Jul 19, 2012, at 0:47 , Benjamin Root wrote:
>
>> Hello all!
>>
>> I have just about completed a PR that would add a new button to the 
>> navigation toolbar for the tight_layout() action.  I am hardly an artist and 
>> have no clue how to graphically represent the tight_layout action in a tiny 
>> icon.  I would greatly welcome any graphics artist out there who could 
>> provide such an icon for matplotlib.
>>
>> Thanks!
>> Ben Root
>> --
>> 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
>

Hi
What about modify the icon suggested by Nicolas with a small square
inside the arrows?
Francesco

--
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] gallery link broken/not working

2012-07-19 Thread Francesco Montesano
Hi,

roaming through the gallery I've found that in
http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_00.html
http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_01.html
http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider_01.html
and maybe others do not work

error:
1. Server: matplotlib.sourceforge.net
2. URL path: /examples/pylab_examples/demo_tight_layout_00.html
3. Error notes: NONE
4. Error type: 404
5. Request method: GET
6. Request query string: NONE
7. Time: 2012-07-19 09:12:32 UTC (1342689152)

http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout.html
works fine

Cheers,

Francesco

--
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] Combining 4 plots into one figure

2012-07-19 Thread Francesco Montesano
Hi Brad,

2012/7/19 Alexander Eberspaecher :
> On Wed, 18 Jul 2012 15:50:50 -0700
> Brad Malone  wrote:
>
>> Hi, I have a collection of 4 plots that I spent some time in
>> constructing. They themselves include modifications of the axes
>> labels, have rotated subplots next to them, etc. I need to be able to
>> take these 4 plots and consolidate them into a single plot (referee
>> suggestion to save space).
>
> Assuming you are using LaTeX to write your paper, you could use a LaTeX
> solution. Here are some links:
>
> http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Subfloats
> ftp://ctan.tug.org/tex-archive/macros/latex/contrib/subfig/subfig.pdf
>
> This might be easier - and would also make your figures more reusable
> (for e.g. presentations).

The solution from Alex might work, but not being optimal in saving
space, in particular if you can share axis.

The labels (a),(b),... can be inserted in the figures with
a.text(x,y,'(a)', ... ). I know that some journals want them in the
figure and not made with latex, so you probably have to rerun your
script with the text added.

If you want to make a unique figure you can try to declare the axis
directly, insead of using subplot, and play with the rect keyword:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axes
.
You can also play with gridspec
(http://matplotlib.sourceforge.net/users/gridspec.html), but I've
never used myself

Cheers,
Francesco

--
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] mimic alpha (channel) v0.1

2012-07-18 Thread Francesco Montesano
2012/7/18 Jonathan Slavin :
> Ben,
>
> Yes, you're right, but I doubt any solution that involves mimicking an
> alpha channel will work for one case that I've been using.  That is,
> making the legend box partially transparent.  I use that to allow the
> box to fit in the plot without blocking the data and without the need to
> make the upper y limit too large.
My solution would probably work if you could, pixel by pixel (or patch
by patch), mimic alpha in each layer using as background the resulting
color of the previous layer.

Do anyone know if it is possible to implement something like this in
matplotlib when saving a eps or in a backend?

>
> I don't notice any problems with blockiness in the text or lines in the
> raster image.  I'll find out soon if the editors of the Astrophysical
> Journal are okay with the figures.
I guess that you produce the figures roughly of the right size (about
8 or 16 cms wide for single or double column figures)  and then
convert. So probably you see that the figure is a raster if you zoom
in.

Fra

>
> Jon
>
> On Tue, 2012-07-17 at 15:34 -0500, Benjamin Root wrote:
>>
>>
>> On Tue, Jul 17, 2012 at 3:01 PM, Jonathan Slavin
>>  wrote:
>> Francesco,
>>
>> While I like your solution, there is an alternative that is
>> simpler and
>> works for me.  That is 1) save matplotlib plot as a png, 2)
>> convert to
>> eps using either ImageMagick or GraphicsMagick.  You do end up
>> with
>> relatively large files, but they look identical to the
>> original plots.
>>
>> Regards,
>> Jon
>>
>> No, it is not the same thing.  Text in a vector-based format such as
>> eps is scalable.  ImageMagick and GraphicsMagick are inherently
>> raster-based, and before that, PNGs are raster-based.  Therefore, the
>> text is not scaled and anti-aliased according to the display size.
>>
>> I will be looking over the proposed solution this evening.
>>
>> Cheers!
>> Ben Root
>>
>>
> --
> __
> Jonathan D. Slavin  Harvard-Smithsonian CfA
> jsla...@cfa.harvard.edu 60 Garden Street, MS 83
> phone: (617) 496-7981   Cambridge, MA 02138-1516
>  cell: (781) 363-0035   USA
> __
>
>
> --
> 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] emulate transparency in eps

2012-07-16 Thread Francesco Montesano
2012/6/20 Michael Droettboom :
> The postscript output of the Cairo backend supports transparency
> emulation, though it hasn't been tested in some time.  Eric's suggestion
> (to output PDF and then convert to EPS) is also a reasonable one.
>
> Mike
>
> On 06/20/2012 10:38 AM, Francesco Montesano wrote:
>> Dear list,
>>
>> it might be that this is not the best place to ask, but I guess that
>> there are enough people with experience with colors.
>>
>> I think plots with nice colors and shaded areas are very nice, but for
>> my publication I have to use eps files, that do not support
>> transparency.
>> The script below produce a figure like the one that I would like to
>> make. If I save it as eps all the shaded areas are not transparent and
>> the plot look ugly and unreadable.
>>
>> A way to emulate transparency that I've applied some time ago was to
>> get the RGB value of the transparent color (with DigitalColor Meter on
>> Mac) and to insert it by hand in fill_between, with a low value for
>> the zorder option. The results was fine, but I don't like too much
>> this approach, as any change in color or alpha value would require to
>> go, get the new color, insert it and redo the figure.
>>
>> Is anyone aware of a way to obtain automatically a RGB color that on
>> screen or printed looks similar to the corresponding RGBA?
>>
>> Thanks in advance,
>> Francesco
>>
>> Sample code*
>>
>> "plot with errors done with fill_between. Emulation of alpha in eps"
>>
>> import itertools as it
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>> col = it.cycle([ 'm', 'r', 'g', 'b', 'c', 'y', 'k', ])
>> ls = it.cycle( [ '-', '--', '-.', ':' ][::-1])
>>
>> #figure
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>>
>> x= np.linspace(0.5,5,100)
>> for i in range(3):
>>c = col.next()
>>l = ls.next()
>>ax.plot( x, np.sin(x)**i, color=c, ls=l,
>> label='$sin^{0}(x)$'.format(i), zorder=10+i )
>>ax.fill_between( x, np.sin(x)**i + 1./x, np.sin(x)**i - 1./x,
>> color=c, linestyle=l, alpha=0.5, zorder=i+1)
>>
>> ax.legend(frameon=False)
>>
>> plt.savefig("test_alpha.pdf")
>> plt.savefig("test_alpha.eps")
>> plt.show()
>>
>> exit()
>> End sample code*
>>

Hi,

I was doing again some search on the topic when I realised that I just
replied to Eric.
This is my reply (Eric sorry for sending this mail twice to you)


I remember trying to convert pdf to eps in different ways with usually
ugly results and/or very large files.

Now I've tried the following commands on test_alpha.pdf (from
http://tex.stackexchange.com/questions/20883/how-to-convert-pdf-to-eps):
i) pdf2ps -eps test_alpha.pdf test_alpha.conv.eps
ii) gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=epswrite
-sOutputFile=test_alpha.gs.eps test_alpha.pdf

the results are:

39K 2012-06-19 17:37 test_alpha.eps   (original eps: no transparency)
23K 2012-06-19 17:37 test_alpha.pdf   (original pdf: transparency)
90M 2012-06-20 20:20 test_alpha.gs.eps  (converted with gs: transparency)
613K 2012-06-20 20:14 test_alpha.pdf2ps.eps   (converted with pdf2ps:
transparency [from my understanding it uses gs])
In both the converted cases the texts (tick labels, legend) are badly
rendered. The lines and contours of the filled areas look noisier than
in the original pdf.

It might be that increasing the resolution the situation improves, but
the file size increases, which is not an option.

Michael, I've tried Cairo (import matplotlib as mpl; mpl.use("Cairo")
 before importing pyplot), but the eps is not transparent.

Cheers,
Francesco

--
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] emulate transparency in eps

2012-06-20 Thread Francesco Montesano
Dear list,

it might be that this is not the best place to ask, but I guess that
there are enough people with experience with colors.

I think plots with nice colors and shaded areas are very nice, but for
my publication I have to use eps files, that do not support
transparency.
The script below produce a figure like the one that I would like to
make. If I save it as eps all the shaded areas are not transparent and
the plot look ugly and unreadable.

A way to emulate transparency that I've applied some time ago was to
get the RGB value of the transparent color (with DigitalColor Meter on
Mac) and to insert it by hand in fill_between, with a low value for
the zorder option. The results was fine, but I don't like too much
this approach, as any change in color or alpha value would require to
go, get the new color, insert it and redo the figure.

Is anyone aware of a way to obtain automatically a RGB color that on
screen or printed looks similar to the corresponding RGBA?

Thanks in advance,
Francesco

Sample code*

"plot with errors done with fill_between. Emulation of alpha in eps"

import itertools as it
import matplotlib.pyplot as plt
import numpy as np

col = it.cycle([ 'm', 'r', 'g', 'b', 'c', 'y', 'k', ])
ls = it.cycle( [ '-', '--', '-.', ':' ][::-1])

#figure
fig = plt.figure()
ax = fig.add_subplot(111)

x= np.linspace(0.5,5,100)
for i in range(3):
  c = col.next()
  l = ls.next()
  ax.plot( x, np.sin(x)**i, color=c, ls=l,
label='$sin^{0}(x)$'.format(i), zorder=10+i )
  ax.fill_between( x, np.sin(x)**i + 1./x, np.sin(x)**i - 1./x,
color=c, linestyle=l, alpha=0.5, zorder=i+1)

ax.legend(frameon=False)

plt.savefig("test_alpha.pdf")
plt.savefig("test_alpha.eps")
plt.show()

exit()
End sample code*

--
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] [matplotlib-users] definition to show quikly a plot

2012-05-29 Thread Francesco Montesano
2012/5/29 Fabien Lafont :
> Thx Francesco, it works great!
>
> What for the .T at the end of genfromtxt?

genfromtxt with usecols=(0,1) return an array with 2 columns. with .T
you transpose it so that you can save it in two variables. For more
info, e.g., 
http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.T.html#numpy-ndarray-t

Cheers,
Francesco

>
>
>
> 2012/5/29 Francesco Montesano :
>> Dear Fabien
>>
>> 2012/5/29 Fabien Lafont :
>>> Hello everyone,
>>>
>>> I have a problem. I have to look at many plots. Usely I do it like that:
>>>
>>> from pylab import*
>>>
>>> X1 = genfromtxt("Myfile.dat", usecols =(0))
>>> Y1 = genfromtxt("Myfile.dat", usecols =(1))
>>> plot(X1,Y1, label ="My curve")
>>>
>>> show()
>>>
>>>
>>> But the problem is when I have many plots I have to copy paste and
>>> change manually all the name of the variables X1, X2, X3...etc. It's
>>> not really convenient.
>>> I want to create a def with the name of my file as argument which do
>>> something like that:
>>>
>>> from pylab import*
>>>
>>> def plotgraph(name):
>>>    X_name = genfromtxt("name", usecols =(0))
>>>    Y_name = genfromtxt("name", usecols =(1))
>>>    plot(X_name,Y_name, label ="name")
>>>
>>> plotgraph(MyFile)
>>>
>>> show()
>>>
>>
>> Try this:
>>
>> def plotgraph(name):
>>   """Plot stuff:
>>   name: string
>>     file name
>>   """
>>   X_name, Y_name = genfromtxt(name, usecols =(0,1)).T
>>   plot(X_name,Y_name, label =name)
>>
>> 'name' should contain already a string, so you have to pass it to
>> genfromtxt. I you pass "name", the file name is "name" and not the
>> what is in the variable.
>> Just a note: if you read the file as 'X_name, Y_name =
>> genfromtxt(name, usecols =(0,1)).T'  you open, read and close the file
>> only once.
>>
>> Cheers,
>> Francesco
>>
>>
>>> But it doesn't work. Do you know why? Do you have a smarter idea?
>>>
>>> Thanks!
>>>
>>> Fab
>>>
>>> --
>>> 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
>>
>>
>>
>> --
>> personals: monty...@yahoo.it, monte_...@hotmail.com (messenger),
>> franz.berges...@googlemail.com.
>> work: monte...@mpe.mpg.de
>>
>> http://picasaweb.google.it/franz.bergesund



-- 
personals: monty...@yahoo.it, monte_...@hotmail.com (messenger),
franz.berges...@googlemail.com.
work: monte...@mpe.mpg.de

http://picasaweb.google.it/franz.bergesund

--
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] [matplotlib-users] definition to show quikly a plot

2012-05-29 Thread Francesco Montesano
Dear Fabien

2012/5/29 Fabien Lafont :
> Hello everyone,
>
> I have a problem. I have to look at many plots. Usely I do it like that:
>
> from pylab import*
>
> X1 = genfromtxt("Myfile.dat", usecols =(0))
> Y1 = genfromtxt("Myfile.dat", usecols =(1))
> plot(X1,Y1, label ="My curve")
>
> show()
>
>
> But the problem is when I have many plots I have to copy paste and
> change manually all the name of the variables X1, X2, X3...etc. It's
> not really convenient.
> I want to create a def with the name of my file as argument which do
> something like that:
>
> from pylab import*
>
> def plotgraph(name):
>    X_name = genfromtxt("name", usecols =(0))
>    Y_name = genfromtxt("name", usecols =(1))
>    plot(X_name,Y_name, label ="name")
>
> plotgraph(MyFile)
>
> show()
>

Try this:

def plotgraph(name):
   """Plot stuff:
   name: string
 file name
   """
   X_name, Y_name = genfromtxt(name, usecols =(0,1)).T
   plot(X_name,Y_name, label =name)

'name' should contain already a string, so you have to pass it to
genfromtxt. I you pass "name", the file name is "name" and not the
what is in the variable.
Just a note: if you read the file as 'X_name, Y_name =
genfromtxt(name, usecols =(0,1)).T'  you open, read and close the file
only once.

Cheers,
Francesco


> But it doesn't work. Do you know why? Do you have a smarter idea?
>
> Thanks!
>
> Fab
>
> --
> 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



-- 
personals: monty...@yahoo.it, monte_...@hotmail.com (messenger),
franz.berges...@googlemail.com.
work: monte...@mpe.mpg.de

http://picasaweb.google.it/franz.bergesund

--
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] "mpl_toolkits.axisartist.floating_axes.FloatingSubplot" required option

2012-04-27 Thread Francesco Montesano
Dear matplotlibers,

I know almost nothing about mpl_toolkits (matplolib.__version__ = 1.1.0).
>From the help of
"mpl_toolkits.axisartist.floating_axes.FloatingSubplot", the init
function reads
__init__(self, fig, *args, **kwargs)

In the example here
(http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html)
the object is initialised as
 FloatingSubplot(fig, rect, grid_helper=grid_helper)

If I take out 'grid_helper' I get this error:
"ValueError: FloatingAxes requires grid_helper argument"

In my understanding, **kwargs (like grid_helper) are optional
arguments and I think that 'required' options do not make much sense.
Besides its not documented in the help of the class.

Could grid_helper be upgraded to *args?

Cheers,
Francesco

--
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] position of xtick labels

2012-04-27 Thread Francesco Montesano
Dear Nils,

I think that I've found what you need (example adapted from
http://notes.brooks.nu/2008/03/plotting-on-left-and-right-axis-simulateously-using-matplotlib-and-numpy/
)

import matplotlib.pyplot as plt
import numpy as np

#data to plot
x = np.linspace(0,5,num=100)
y = np.sinc(x)

fig   = plt.figure(figsize=(16,10))  #figure
ax= fig.add_subplot(111)#axis containing the figure
ax1 = fig.add_subplot(111, sharex=ax, sharey=ax, frameon=False)
#axis that shares both x and y and without frame (so ax is visible)

ax.plot(x, y)   #plot the data

ax1.xaxis.tick_top()  #show ticks on top
ax1.yaxis.tick_right()  #show ticks on the right

Now if you do any modification on the ax limits should reflect on ax1.

Might be that there is some smarter way of doing it, but if the
project is not too long and efficiency is not a problem, I think that
this example will suffice

Cheers,
Francesco

Il 27 aprile 2012 14:50, Nils Wagner  ha scritto:
> Dear Francesco,
>
> Thank you for your prompt reply !
> My incomplete example is below.
>
> import matplotlib.pyplot as plt
> fig   = plt.figure(figsize=(16,10))
> ax    = fig.add_subplot(111)
> ind = np.arange(nfreq)
> yoff = np.array([0.0]*nfreq)
> for row in range(nsets):
>
>    ax.bar(ind,A[row,:],width,bottom=yoff, 
> color=colours[row],label=elabel[row])
>    yoff = yoff + A[row,:]
>
> plt.legend(loc="upper left", bbox_to_anchor=(1,1))
> plt.xticks(ind+0.5*width,np.arange(nfreq)+1,rotation=90)
> ax.set_xlim(0.,nfreq)
> ax.set_ylim(0.,102.)
> plt.subplots_adjust(left=0.075, right=0.85, top=0.9, bottom=0.05)
> plt.show()
>
> How can I add xtick labels on the top of my figure ?
>
> Cheers,
>               Nils
>
>
> On 4/27/12, Francesco Montesano  wrote:
>> Dear Nils,
>>
>> you can try to play with
>> i) ax.axis["right", "top", "bottom", "left"] and their methods (see
>> setup_axis3 here
>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html
>> for an example)
>> ii) twinx and twiny axes (example
>> http://matplotlib.sourceforge.net/examples/api/two_scales.html )
>>
>> The first one can be a bit confusing with orientations. Once I found
>> an explanation about it on matplotlib website, but I cannot find it
>> right now.
>> The second way creates a second axis that you probably don't need.
>>
>> Cheers,
>> Francesco
>>
>> Il 27 aprile 2012 11:48, Nils Wagner  ha
>> scritto:
>>> Hi all,
>>>
>>> I would like to add different xtick labels on the top and
>>> bottom of a figure. The number and position of the xticks
>>> is the same.
>>> How can I do that ?
>>>
>>> An example would be appreciated.
>>>
>>> Nils
>>>
>>> --
>>> 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
>>



-- 
personals: monty...@yahoo.it, monte_...@hotmail.com (messenger),
franz.berges...@googlemail.com.
work: monte...@mpe.mpg.de

http://picasaweb.google.it/franz.bergesund

--
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] position of xtick labels

2012-04-27 Thread Francesco Montesano
Dear Nils,

you can try to play with
i) ax.axis["right", "top", "bottom", "left"] and their methods (see
setup_axis3 here
http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html
for an example)
ii) twinx and twiny axes (example
http://matplotlib.sourceforge.net/examples/api/two_scales.html )

The first one can be a bit confusing with orientations. Once I found
an explanation about it on matplotlib website, but I cannot find it
right now.
The second way creates a second axis that you probably don't need.

Cheers,
Francesco

Il 27 aprile 2012 11:48, Nils Wagner  ha scritto:
> Hi all,
>
> I would like to add different xtick labels on the top and
> bottom of a figure. The number and position of the xticks
> is the same.
> How can I do that ?
>
> An example would be appreciated.
>
> Nils
>
> --
> 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] (no subject)

2012-03-30 Thread Francesco Montesano
Dear Dorm,

Il 30 marzo 2012 14:17, Dorm Eight  ha scritto:
> Dear Francesco,
> Yes, I just tried it, it can be save perfectly.

so might be a problem with the backend.
Give a look to this page:
http://stackoverflow.com/questions/2512225/matplotlib-not-showing-up-in-mac-osx
and try to change the backend.
I think that I cannot help much more here. Does anyone else has an
idea if there might be any other problem?

Cheers,
Francesco

>
> ____
> From: Francesco Montesano 
> To: Dorm Eight ; matplotlib-users@lists.sourceforge.net
> Sent: Friday, March 30, 2012 8:01 PM
>
> Subject: Re: [Matplotlib-users] (no subject)
>
>> ________
>> From: Francesco Montesano 
>> To: Dorm Eight 
>> Cc: "matplotlib-users@lists.sourceforge.net"
>> 
>> Sent: Tuesday, March 27, 2012 3:38 PM
>> Subject: Re: [Matplotlib-users] (no subject)
>>
>> Il 27 marzo 2012 05:08, Dorm Eight  ha scritto:
>>> hi, everybody!
>>>
>>> when I run my script, why there is no figure show up? I downloaded the
>>> demos
>>> from matplotlib gallery and it didn't work either.
>>>>>>
>>>>>> x=np.arange(100)
>>>>>> y=x**2+3*x-1
>>>>>> pl.plot(x,y)
>>> []
>>>>>> pl.show()
>>>>>>
>>> there is no error, no figure pop-up!
>>>
>>> Thank you for any answer!
>>>
>>
>> Hi Dorm
>> If you can send more info about the operating system and matplotlib
>> version, it's easier to help you
>> (for the latter do
>> import matplotlib
>> print matplotlib.__version__
>> )
>>
>> Cheers,
>> Francesco
>>
>>>
>>>
>>> --
>>> This SF email is sponsosred by:
>>> Try Windows Azure free for 90 days Click Here
>>> http://p.sf.net/sfu/sfd2d-msazure
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>>Il 30 marzo 2012 13:23, Dorm Eight  ha scritto:
>
> Dear Dorm,
>
> please reply to all the list.
>>  My system is Fedora 3.3.0-4.fc16.x86_64, after I recently updated the
>> system with 'yum update', the problem appeared.
>> the Matplotlib version is 1.10. I have no idea at all now.
>
> I've tested your small example on python 2.6, matplotlib 1.0.0 with
> MacOSX backend and on Kubuntu 11.04, python 2.7, matplotlib 1.1, with
> TkAgg and Qt4Agg backends and the small code works for me. In all
> cases I have set "plt.ion()"
>
> If you save the figure instead of showing, does it work?
> Which backend are you using: the name is stored in
> "matplotlib.backends.backend"
>
> Cheers
> Francesco
>
>
>
> --
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] (no subject)

2012-03-30 Thread Francesco Montesano
> 
> From: Francesco Montesano 
> To: Dorm Eight 
> Cc: "matplotlib-users@lists.sourceforge.net"
> 
> Sent: Tuesday, March 27, 2012 3:38 PM
> Subject: Re: [Matplotlib-users] (no subject)
>
> Il 27 marzo 2012 05:08, Dorm Eight  ha scritto:
>> hi, everybody!
>>
>> when I run my script, why there is no figure show up? I downloaded the
>> demos
>> from matplotlib gallery and it didn't work either.
>>>>>
>>>>> x=np.arange(100)
>>>>> y=x**2+3*x-1
>>>>> pl.plot(x,y)
>> []
>>>>> pl.show()
>>>>>
>> there is no error, no figure pop-up!
>>
>> Thank you for any answer!
>>
>
> Hi Dorm
> If you can send more info about the operating system and matplotlib
> version, it's easier to help you
> (for the latter do
> import matplotlib
> print matplotlib.__version__
> )
>
> Cheers,
> Francesco
>
>>
>> --
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>Il 30 marzo 2012 13:23, Dorm Eight  ha scritto:

Dear Dorm,

please reply to all the list.
>  My system is Fedora 3.3.0-4.fc16.x86_64, after I recently updated the
> system with 'yum update', the problem appeared.
> the Matplotlib version is 1.10. I have no idea at all now.

I've tested your small example on python 2.6, matplotlib 1.0.0 with
MacOSX backend and on Kubuntu 11.04, python 2.7, matplotlib 1.1, with
TkAgg and Qt4Agg backends and the small code works for me. In all
cases I have set "plt.ion()"

If you save the figure instead of showing, does it work?
Which backend are you using: the name is stored in "matplotlib.backends.backend"

Cheers
Francesco

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] (no subject)

2012-03-27 Thread Francesco Montesano
Il 27 marzo 2012 05:08, Dorm Eight  ha scritto:
> hi, everybody!
>
> when I run my script, why there is no figure show up? I downloaded the demos
> from matplotlib gallery and it didn't work either.

 x=np.arange(100)
 y=x**2+3*x-1
 pl.plot(x,y)
> []
 pl.show()

> there is no error, no figure pop-up!
>
> Thank you for any answer!
>

Hi Dorm
If you can send more info about the operating system and matplotlib
version, it's easier to help you
(for the latter do
import matplotlib
print matplotlib.__version__
)

Cheers,
Francesco

> --
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


matplotlib-users@lists.sourceforge.net

2012-01-16 Thread Francesco Montesano
2012/1/16 Michael Cracraft :
> I prepared some plots for a conference paper using pcolormesh.  The plots
> need to work both for color and for a b&w print copy.  Does anyone have a
> goto color map for that sort of occassion?  I was using YlGrBu, but I'm just
> not happy with it.
>
> Thanks,
> Michael
>
>
> --
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

Dear Michael,

Recently I've used 'hot' which I think is very clear in color and
works perfectly in grayscale.

Cheers,
Francesco

--
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] legend border, frameon keyword

2011-11-11 Thread Francesco Montesano
Hi,

I usually do like this

l = ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'))
l.draw_frame(False)

Cheers,

Francesco

2011/11/9 magurling :
>
> I want a legend without the black border. I've tried a few things that have
> been suggested on this forum and elsewhere to no avail. According to what
> I've seen, it should be as simple as:
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> N = 5
> Means1 = (20, 35, 30, 35, 27)
> Means2 = (25, 32, 34, 20, 25)
>
> ind = np.arange(N)  # the x locations for the groups
> width = 0.20       # the width of the bars
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
> rects1 = ax.bar(ind, Means1, width, color='k')
> rects2 = ax.bar(ind+width, Means2, width, color='w')
>
> ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'), frameon=False )
>
> plt.show()
>
>
> It all works except for "frameon=False"
>
> I get this:
>
> /usr/lib/pymodules/python2.7/matplotlib/axes.pyc in legend(self, *args,
> **kwargs)
>   4042
>   4043         handles = cbook.flatten(handles)
> -> 4044         self.legend_ = mlegend.Legend(self, handles, labels,
> **kwargs)
>   4045         return self.legend_
>   4046
>
> TypeError: __init__() got an unexpected keyword argument 'frameon'
>
> I've also checked my matplotlibrc under the "Legend" section and I don't see
> a "legend.frameon" line.
>
> It must be something simple that I am doing wrong. Any ideas?
> --
> View this message in context: 
> http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32807933.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] fill with a semilogy axis?

2011-05-06 Thread Francesco Montesano
Hi Michael,

I use fill_between() and log axis without problems in the following way (it's 
by memory, I hope the sintax is correct)

fig = plt.figure()
spl = fig.add_subplot(111)

spl.fill_between(x,y1,y2)

spl.set_yscale("log")

plt.show()

Cheers,

Fra

Il giorno 06/mag/2011, alle ore 01.34, Benjamin Root ha scritto:

> 
> 
> On Tue, May 3, 2011 at 3:40 AM, K.-Michael Aye  wrote:
> A colleague posed an interesting challenge:
> How to do a filled plot having the y-axis in logarithm?
> I think I can do it with creating patches myself an adding it to the
> axis, but isn't there anything built-in?
> 
> Best regards,
> Michael
> 
> 
> 
> Does fill_between() not work for you?  Note, I have never tried it on a log 
> scale plot.
> 
> Ben Root
> 
> --
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network 
> management toolset available today.  Delivers lowest initial 
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] multiline legend tags

2011-03-17 Thread Francesco Montesano
Dear all,

I have a rather complex code that takes a list of file names and of
legend tags from command line and compute contour plots

./contour_plots.py [options] filename1 ... filename2 tag1 ... tagn

The codes make filled contours at required levels, then line contours.
>From the latter I extract one line from each file and create a legend

spl.legend(lines, [tag1...tagn], other options)

All it works fine. The only problem is that sometimes I have tags that
are long and I would like to be able to break between multiple lines.
In examples/legend_demo3.py is shown that 'ax1.plot([1],
label="multi\nline")' the \n is interpreted (correctly) as new line.

Normaly I have something like
./contour_plots.py [options] filename1 \(long\)tag\$_\{very long\}\$
that gives me a legend with the correct formatting. If I try to add a
'\n' after 'tag', I get out the tag as before plus a 'n' after 'tag'.
I've tried to enclose the whole string or just \n in "" or r"" but
nothing good happens (either I get 'n' or 'rn').
Is there a way to do what I want to do?

Thanks in advance
Francesco

--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hide labels

2011-02-04 Thread Francesco Montesano
Dear all again,

I've tried to play with it again, but I couldn't find a solution for
the problem.
For clarity I report an example of what each of the subplots looks like:

> import numpy as np
> import matplotlib.pyplot as plt
> mean = np.array([-0.9206394,  -0.90127456, -0.91983625, -0.97765539, 
> -1.02991184, -1.02267017, -0.97730167, -0.93715172, -0.94324653, -0.92884379])
> stddev = np.array([0.16351397, 0.15075966,  0.13413909,  0.15404823,  
> 0.13559582,  0.13109754,  0.12128598,  0.11589682,  0.11921571,  0.10866761])
>
> ax = plt.figure().add_axes([0.1,0.1,0.8,0.8])
> ax.errorbar(np.arange(10,20)/100., mean, yerr=stddev)
>
> ax.set_xlim([0.095, 0.195])
> lab = ax.get_ymajorticklabels()
>
> print lab
> for i in lab:
>  print i
>
> plt.show()

as output of this script I get
> 
> Text(0,0,'')
> Text(0,0,'')
> Text(0,0,'')
> Text(0,0,'')
> Text(0,0,'')
> Text(0,0,'')
> Text(0,0,'')
In the plot instead I only have only 5 y tick labels, as visible from
the attachment. In this case if I set the first and the last label
invisible, nothing changes, and if I have other plots under this the
plot becomes ugly/unreadable.

I hope to have been clearer than in my previous mail.
Any suggestion on how to fix or find a workaround in order to get the
same number of tick labels as the ones actually plotted.

Thank in advance
Fra


2011/2/1 Francesco Montesano :
> Dear all,
>
> I'm producing a single figure with subplots arrange in a single columns.
> They all share the same x range but the y variable change from subplot to
> subplot
>
> In order have a nicer figure I hide the first and the last y label of each
> subplot in the following way
>>
>> ytl = subpl.get_ymajorticklabels()
>> ytl[0].set_visible(False)
>> ytl[-1].set_visible(False)
>
> It was well in most cases. But I've noticed that in some plot the first
> and/or the last label remains.
> In this cases, if I "print ytl", it writes " objects>", where "n" is larger by 1 or 2 than the number of labels shown
> before I make them invisible.
> So I end up having some label (nearly) exactly on the upper and/or bottom
> range of the plot.
>
> Is there a way to force the axis to return exactly the number of labels
> shown in the plot?
>
> Thanks in advance,
>
> Francesco
>
>
>



--
personals: monty...@yahoo.it, monte_...@hotmail.com (messenger),
franz.berges...@googlemail.com.
work: monte...@mpe.mpg.de

http://picasaweb.google.it/franz.bergesund
<>--
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Limits with errorbar

2011-02-02 Thread Francesco Montesano
Hi Paul,

2011/2/1 Paul Ivanov 

> I'm not sure what you're hoping to see, but you should either use
> xerr with xuplims, or yerr with uplims.
>

Thank you for the reply. As usually I checked everything except the correct
one.
By the way, if one uses (by error) yerr and xuplims/xlolims or xerr and
uplims/lolims, no error bar shows up. Is this a bug or a feature?

Cheers,
Fra
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hide labels

2011-02-01 Thread Francesco Montesano
Dear all,

I'm producing a single figure with subplots arrange in a single columns.
They all share the same x range but the y variable change from subplot to
subplot

In order have a nicer figure I hide the first and the last y label of each
subplot in the following way

> ytl = subpl.get_ymajorticklabels()
> ytl[0].set_visible(False)
> ytl[-1].set_visible(False)
>

It was well in most cases. But I've noticed that in some plot the first
and/or the last label remains.
In this cases, if I "print ytl", it writes "", where "n" is larger by 1 or 2 than the number of labels shown
before I make them invisible.
So I end up having some label (nearly) exactly on the upper and/or bottom
range of the plot.

Is there a way to force the axis to return exactly the number of labels
shown in the plot?

Thanks in advance,

Francesco
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Limits with errorbar

2011-02-01 Thread Francesco Montesano
Dear all,

I am trying to make a plot with errorbars and upperlimits.
I've found the following pylab example
http://matplotlib.sourceforge.net/examples/pylab_examples/errorbar_limits.htmland
it works fine both on a Mac OSX10.6 with python 2.6.1 and on Kubuntu
10.04 with python 2.6.5.
I've tried the to reproduce the example using matplotlib.pyplot but the
limits do not show up, regardless of syntax or system (matplotlib 1.0.0 on
Mac and 1.0.1 on Kubuntu)

I attach a sample code which does not work.

import numpy as np
> import matplotlib.pyplot as plt
>
> #create function to plot plus random error
> x = np.linspace(0,3,100)
> y = np.sin(x)
> err = np.random.random(100)
>
> plt.errorbar(x,y, yerr=err, color='g',linestyle='None',xuplims=True)
> plt.show()
>

Does anyone know how to solve this problem?

Thanks in advance,
Francesco
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Legend for contour plots

2011-01-22 Thread Francesco Montesano
Dear Paul,

Thank you, it does exacly what I want to do. I searched a bit into the
"contour" instance, but I was biased since I was looking for something
like "get_line".

cheers

Francesco


2011/1/21 Paul Ivanov :
> Francesco Montesano, on 2011-01-21 15:44,  wrote:
>> Dear All,
>>
>> I am using contour plot and I am drawing different contours with
>> different colors and linestyles and I would like to have a legend with
>> a caption for each contour function used.
>> Here you can see an example of what I would like to do
>>
>> >> #create the 2D histogram and the x and y axis
>> >> x, y = np.random.normal(0, 0.5, 1000), np.random.normal(0, 1, 1000)
>> >> h, xe,ye = np.histogram2d(x,y, bins=25)
>> >> xe, ye = (xe[1:]+xe[:-1])/2, (ye[1:]+ye[:-1])/2
>> >>
>> >> lines,text = [], []   # initialise lists
>> >>
>> >> #contour plots
>> >> lines.append(plt.contour(xe,ye,h, levels=[10,9], linestyles="-", 
>> >> colors="k"))
>> >> text.append("level=10, 9")
>> >>
>> >> lines.append(plt.contour(xe,ye,h, levels=[5,4], linestyles="--", 
>> >> colors="r"))
>> >> text.append("level=5, 4")
>> >>
>> >> plt.legend(lines, text)
>>
>> Everything goes well untill I plot the legend. At the end of the mail
>> I report the error that I get.
>> Anyway, if I do
>> >> plt.legend(lines)
>> I don't get any errors but it's quite useless, since the text of the
>> legend is just like:
>> 
>> as you can see from the attached figure.
>>
>>
>> I've the feeling that the problem is that "contour" gives back a
>> "matplotlib.contour.ContourSet instance", while the functions like
>> "plot" gives back a ">
>> Does anyone knows how to do what I want?
>>
> Hi Francesco,
>
> here's one way of getting what you want, instead of calling
> legend on your 'lines' variable as you had it, do this:
>
>  actual_lines = [cs.collections[0] for cs in lines]
>  plt.legend(actual_lines, text)
>
> As you note, the call to plt.countour does not return lines, it
> returns contour sets (which is why I called the variable 'cs' in
> my example). Poking around in ipython, I saw that each contour
> set has a collections attribute which holds the actual lines.
>
> hope that helps,
> --
> Paul Ivanov
> 314 address only used for lists,  off-list direct email at:
> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk05+ssACgkQe+cmRQ8+KPfQnACaAr1YGFoiUmRrmz1/W+eTB8ly
> 3b0AoInVelg2TYu1J3QpDj3WfO0Ko5zW
> =vh8b
> -END PGP SIGNATURE-
>
> --
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Smooth contourplots

2010-09-07 Thread Francesco Montesano
Dear Joe,

finally I had time to come back to my python scritp for the contour plots.
You're code works very nicelly and does exactly what I need.

Thank you for the help

Francesco

2010/7/26 Joe Kington :
> It sounds like you're wanting a gaussian kernel density estimate (KDE) (not
> the desktop!).  The other options you mentioned are for interpolation, and
> are not at all what you're wanting to do.
>
> You can use scipy.stats.kde.gaussian_kde(). However, it currently doesn't
> take a weights array, so you'll need to modify it for your use case.
>
> If you prefer, I have faster version of a gaussian KDE that can take a
> weights array.  It's actually slower than the scipy's gaussian kde for a low
> number of points, but for hundreds, thousands, or millions of points, it's
> several orders of magnitude faster.  (Though the speedup depends on the
> covariance of the points... higher covariance = slower, generally speaking)
>
> Here's a quick pastebin of the code.  http://pastebin.com/LNdYCZgw
>
> To use it, you do something like the below... (assuming the code in the
> pastebin is saved in a file called fast_kde.py)
>
> import numpy as np
> import matplotlib.pyplot as plt
> from fast_kde import fast_kde
>
> # From your description of your data...
> weights, x, y = np.loadtxt('chain.txt', usecols=(0,4,6)).T
>
> kde_grid = fast_kde(x, y, gridsize=(200,200), weights=weights)
>
> # Plot the grid
> plt.figure()
> plt.imshow(kde_grid, extent=(x.min(), x.max(), y.max(), y.min())
>
> # Reverse the y-axis
> plt.gca().invert_yaxis()
>
> plt.show()
>
> Hope that helps a bit,
> -Joe
>
>
>
>
> On Sat, Jul 24, 2010 at 3:56 AM, montefra 
> wrote:
>>
>> Hi,
>>
>> I am writing a program that reads three columns (one column containing the
>> weights, the other two containing the values I want to plot) from a file
>> containing the results from a MonteCarlo Markov Chain. The file contains
>> thousends of lines. Then create the 2D histogram and make contourplots.
>> Here
>> is a sample of the code (I don't know if is correct, it's just to show
>> what
>> I do)
>>
>> >>> import numpy as np
>> >>> import matplotlib.pyplot as mplp
>> >>> chain = np.loadtxt("chain.txt", usecols=[0,4,6])   #read columns 0
>> >>> (the
>> >>> weights), 4 and 6 (the data), from the file "chain.txt"
>> >>> h2D, xe, ye = np.histogram2D(chain[:,1],chain[:,2],
>> >>> weights=chain[:,0])
>> >>> #create the 2D histogram
>> >>> x = (xe[:-1] + xe[1:])/2. #x and y values for the plot (I use the mean
>> >>> of each bin)
>> >>> y = (ye[:-1] + ye[1:])/2.
>> >>> mplp.figure()   #open the figure
>> >>> mplp.contourf(x, y, h2D.T, origin='lower')  #contour plot
>>
>> As it is the contours are not smooth and they look not that nice. After
>> days
>> of searches I've found three methods and tried, unsuccesfully, to apply
>> them
>> 1) 2d interpolation: I got "segmentation fault" (on a quadcore machine
>> with
>> 8Gb of RAM)
>> 2) Rbf (radial basis functions): I got wrong contours
>> 3) ndimage: it creates spurious features (like secondary peaks parallel to
>> the direction of the main one)
>>
>> Before beginning with Python, I used to use IDL to plot, and there is a
>> function 'smooth' that smooth for you 2D histograms. I haven't found
>> anything similar for Python.
>> Does anyone have an idea or suggestion on how to do it?
>>
>> Thank in advance
>> Francesco
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Smooth-contourplots-tp29253884p29253884.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> The Palm PDK Hot Apps Program offers developers who use the
>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>> of $1 Million in cash or HP Products. Visit us here for more details:
>> http://ad.doubleclick.net/clk;226879339;13503038;l?
>> http://clk.atdmt.com/CRS/go/247765532/direct/01/
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>



-- 
personals: monty...@yahoo.it, monte_...@hotmail.com (messenger),
franz.berges...@googlemail.com.
work: monte...@mpe.mpg.de

http://picasaweb.google.it/franz.bergesund

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users