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

2014-09-12 Thread Andreas Hilboll
On 12.09.2014 20:01, ConcreteVitamin wrote:
> Accidentally hit send, sorry.. Completed email:
> 
> I have a graph that looks like this [1], in which each line has
> different markers for the same number of points. I'd like to add a
> separate "legend box" (like the one already in the graph) for the
> markers only:
> 
>: description for circle
>: description for right triangle
>... and so on...
> 
> How can I do this? After googling a bit I couldn't find an answer. Thanks a 
> lot!

The plt.legend docstring says

   To make a legend for a list of lines and labels::

   legend( (line1, line2, line3), ('label1', 'label2', 'label3') )


So I would try something along the lines of

   # plot lines
   line1 = ax.plot(...)
   ...
   linen = ax.plot(...)
   lineleg = ax.legend((line1, ..., linen), ('linelabel1', ...))

   # plot symbols
   symb1 = ax.plot(...)
   ...
   symbn = ax.plot(...)
   symbleg = ax.legend((symb1, ..., symbn), ('symblabel1', ...))


Cheers,
  Andreas

> 
> 
> On Fri, Sep 12, 2014 at 11:00 AM, ConcreteVitamin
>  wrote:
>> Hi matplotlib-users@,
>>
>> I have a graph that looks like this [1], in which each line has
>> different markers for the same number of points. I'd like to add a
>> separate "legend box" (like the one already in the graph) for the
>> markers only:
>>
>>: description for circle
>>: description for right triangle
>>
>>
>> [1] http://imgur.com/tmFpix1
> 
> --
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


-- 
-- Andreas.

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


Re: [Matplotlib-users] datestr2num for day/month/year

2014-04-25 Thread Andreas Hilboll
On 25.04.2014 11:02, Mark Bakker wrote:
> OK, I figured out I can use:
> converters={0:strpdate2num('%d-%m-%y')}
> 
> What now if part of my dates are given as 'day-month-year' and part as
> 'day/month/year' in the same file (I know, who does that, an I could do
> a replace first and then read it in). Can I specify both formats for the
> converter? I guess not

Try this:

   def _conv_date(s):
   try:
   return strpdate2num('%d-%m-%y')
   except Exception:   # figure out which exception class to use
   return strpdate2num('%d/%m/%y')

   converters={0:_conv_date}

Cheers, Andreas.


> 
> Thanks,
> 
> Mark
> 
> 
> 
> On Fri, Apr 25, 2014 at 10:46 AM, Mark Bakker  > wrote:
> 
> Hello List,
> 
> datestr2num works great when dates are stored as month/day/year (as
> American like).
> 
> Europeans store them as day/month/year.
> 
> Any quick function to convert a day/month/year string do a date? Is
> there an eu version: datestr2numeu?
> 
> Thanks,
> 
> Mark
> 
> 
> 
> 
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> 
> 
> 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


-- 
-- Andreas.

--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Access to color cycle?

2014-03-05 Thread Andreas Hilboll
On 05.03.2014 20:56, Adam Hughes wrote:> Hi,
>
> I am making a stacked histogram where one must enter the desired colors
> together in a list/array when the histogram is called.  For certain
> objects in my code, it's helpful to assign a color to them, so that they
> are immediately identified across various plots.  Therefore, I
> essentially want to take the color cycle, swap out a few entries for
> which colors have been assigned by the user, and otherwise keep the
> cycle in tact.  For example, if the first object is to be orange, but no
> other colors are assigned, I want something like:
>
> colors= ['orange', default_cycle[1::]]
>
> However, according to some threads, the only way to access the color
> cycle that I'm aware of is through a generator stored in:
>
> axes._get_lines.color_cycle()

If I'm not mistaken, you should be able to set the appropriate rcParam,
i.e.,

   mpl.rcParams['axes.color_cycle'] = ['orange', default_cycle[1::]]

Cheers, Andreas.


>
> I don't like this approach because iterating through the color cycle
> will cause the next plot to start at a different point in the cycle.
>  I'm sure I can hack something up that gets around this, but there seems
> to be a canonical way to just list all of the default colors in a list
> once and be done with it.  Is this the case?
>
> Thanks.
>
>
>
--
> Subversion Kills Productivity. Get off Subversion & Make the Move to
Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works.
> Faster operations. Version large binaries.  Built-in WAN optimization
and the
> freedom to use Git, Perforce or both. Make the move to Perforce.
>
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


-- 
-- Andreas.

--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] completely filling a figure canvas

2014-02-14 Thread Andreas Hilboll
>> Is there a way to have subplots_adjust() automatically chose left,
>> right, bottom, top values so that everything that's been drawn tightly
>> fits the figure? 
> What about plt.tight_layout() ?
> (or fig.tight_layout )

Yes, thanks, Pierre!

Andreas.

--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] completely filling a figure canvas

2014-02-13 Thread Andreas Hilboll
I need some help in saving effort to make a figure fill its canvas:

Is there a way to have subplots_adjust() automatically chose left,
right, bottom, top values so that everything that's been drawn tightly
fits the figure?  Basically I'm looking for something similar to
bbox_inclues='tight' in savefig, except that I want the figure
dimensions to stay the same and have the contents of the figure adjust
to the figsize so that no space is wasted.  Obviously, the hspace and
wspace in subplots_adjust would still have to be choseable by the user.

Any ideas?
-- Andreas.

--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Question about basic_example_writer.py

2013-11-27 Thread Andreas Hilboll
Hi,

when running basic_example_writer.py, I get *.mp4 files with a canvas
size of 800x600 pixels (at least that's what mplayer tells me). However,
I have trouble understanding where this canvas size comes from. The
example does not explicitly set the dpi or the figure size, and I don't
have a matplotlibrc which changes these settings. So figure.dpi is 80,
and the fig.size_inches is (8, 6). So how come this translates to a
800x600 pixel movie?

Thanks for you insight :)

-- Andreas.

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


[Matplotlib-users] cpt-city colormaps for matplotlib

2013-04-24 Thread Andreas Hilboll
Hi,
I'd like to have the cpt-city colormaps available in matplotlib. Is
there already a module for this? If not, I'll try to patch something
together. What do you think?
Cheers, Andreas

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


[Matplotlib-users] Vertical alignment of AnchoredTexts in ImageGrid

2013-03-28 Thread Andreas Hilboll
Hi,

I'm cross-posting a question I asked on SO:

   http://stackoverflow.com/q/15681890/152439

How can I vertically align text in matplotlib? My situation is as follows:

I'm using `ImageGrid`, to plot a row of five images:

grid = ImageGrid(fig,
 rect=(0.06, 0., 0.885, 1.),
 nrows_ncols = (1, 5),
 direction="row",
 axes_pad = 0.,
 add_all=True,
 label_mode = "L",
 share_all = True,
 cbar_location="right",
 cbar_mode="single",
 cbar_size="10%",
 cbar_pad="0%",
)

Within each axes, I want to add some text. For this, I defined the
following function (following one of the examples):

def add_inner_title(ax, title, loc, props):
from matplotlib.offsetbox import AnchoredText
at = AnchoredText(title, loc=loc, prop=props,
  pad=0., borderpad=0.5,
  frameon=False)
ax.add_artist(at)
return at

which I use like this:

ax = grid[i]
tit = add_inner_title(ax, title, loc=3,
  props={'size':'x-small',
 'color':'#b0b0b0',
 'weight' : 'bold',
 'va' : 'baseline'})

Now, in one of the plots, the axes, the title is "Pollution Signal", in
another, it is "one", and in another, it is "GOME" (all just examples).
The problem is that now the texts are not vertically aligned: The
baseline of the text with a *g* is higher to accomodate for the needed
space below the baseline.

How can I achieve that in my case, all texts are vertically aligned,
given that the heights of the individual text boxes are different?

Any help is greatly appreciated!
Andreas

--
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems to plot more than 9 subplots

2013-02-19 Thread Andreas Hilboll
On 02/19/2013 01:52 PM, patricia wrote:
> Thanks Andreas,
> Yes I usually do the same, but in this case I am not managing to do it due
> to the functions being used. It does not allow me to put (7,3, nfig) inside
> the "xx = TaylorDiagram(refstd, fig=fig, rect=122, label="xx")".
> This is the code that I am using:
> http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html
> Do you see an easy way of adding more than 9 Taylor diagrams subplots in
> test1 for example?

>From how I understand the FA.FloatingSubplot docstring (I'm running
1.1.1rc), you could try

   class TaylorDiagram(object):
  def __init__(self, refstd, fig=None, rect=(1, 1, 1), label='_',
srange=(0,1.5)):
  ...
  from matplotlib.projections import PolarAxes
  import mpl_toolkits.axisartist.floating_axes as FA
  import mpl_toolkits.axisartist.grid_finder as GF
  ...

  ax = FA.FloatingSubplot(fig, rect[0], rect[1], rect[2],
grid_helper=ghelper)
  fig.add_subplot(ax)
 ...

   dia = TaylorDiagram(refstd, fig=fig, rect=(3, 7, nrfig, label="EM")


FA.FloatingSubplot  docstring says:

 Definition:FA.FloatingSubplot(self, fig, *args, **kwargs)
 Docstring:
*fig* is a :class:`matplotlib.figure.Figure` instance.

*args* is the tuple (*numRows*, *numCols*, *plotNum*), where
the array of subplots in the figure has dimensions *numRows*,
*numCols*, and where *plotNum* is the number of the subplot
being created.  *plotNum* starts at 1 in the upper left
corner and increases to the right.


If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.



Hope that helps,
A.

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


Re: [Matplotlib-users] Problems to plot more than 9 subplots

2013-02-19 Thread Andreas Hilboll
> The " subplot(111) " works only until 9 subplots, and this function does
> not allow me to put rect=(7,3,nrfig). I get the error: 
> 'Single argument to subplot must be a 3-digit integer')
> ValueError: Single argument to subplot must be a 3-digit integer

I always do

   ax = fig.add_subplot(7, 3, nfig)

which works. (in list iterations, make sure nfig starts at 1).

Andreas.

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


[Matplotlib-users] interactively getting z-value on a pcolormesh

2013-02-01 Thread Andreas Hilboll
Hi,

I often use mpl interactively (in ipython --pylab) to plot 2d data on
basemaps using pcolormesh. When moving the mouse over the map, I can see
x,y coordinates being displayed in the bottom right of the plot window.
What would be more interesting for me is the value of the pcolomesh'ed
data variable at the point where the mouse cursor is.

Any way I can get this information?

Cheers, Andreas.

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


[Matplotlib-users] 3d surfaces in basemap?

2012-10-27 Thread Andreas Hilboll
Hi, maybe matplotlib is capable of doing this:

I have two gridded datasets, A and B, for say Europe. Now I want to plot
a 3d surface with the z-values given by dataset A. The surface should be
colored using a given color palette and the values from dataset B.

Any ideas on how to do this are greatly appreciated =)

Cheers, Andreas.

--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Filling area with a color like in an integral

2012-10-16 Thread Andreas Hilboll
> I have a coordination system with some plotted dots connected with a
> line. Now I'd like to fill up the whole space between the line and the
> x-axis. It is the same as in a integral calculation:
> http://www.definicionabc.com/wp-content/uploads/Integral.png
> What I want to do is the same as the green color in the linked picture.

You can find an example in the matplotlib gallery
(http://matplotlib.org/gallery.html):

   http://matplotlib.org/examples/pylab_examples/fill_between_demo.html

The function you're looking for is ``fill_between``.

Cheers, Andreas.


--
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] xlabels on top, ylabels on right

2012-10-12 Thread Andreas Hilboll
>> > Hi, me again :)
>> >
>> > I'm looking for a way to have the xlabels on the top (instead of
>> bottom),
>> > and the ylabels on the right (instead of left). I guess I could do
>> > something with twinx / twiny and just not use the left/bottom axis,
>> but
>> > I'm sure there is some more elegant way ...
>>
>> I need to correct myself: I want the xticklabels / yticklabels to be on
>> top/right.
>>
>>
> I believe you are looking for tick_params():
> http://matplotlib.org/api/axes_api.html?highlight=tick_param#matplotlib.axes.Axes.tick_params
>
> ax.tick_params(axis='x', labelbottom=False, labeltop=True)
> ax.tick_params(axis='y', labelleft=False, labelright=True)

Yes, that's it, Ben. Thanks!



--
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] xlabels on top, ylabels on right

2012-10-12 Thread Andreas Hilboll
> Hi, me again :)
>
> I'm looking for a way to have the xlabels on the top (instead of bottom),
> and the ylabels on the right (instead of left). I guess I could do
> something with twinx / twiny and just not use the left/bottom axis, but
> I'm sure there is some more elegant way ...

I need to correct myself: I want the xticklabels / yticklabels to be on
top/right.


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


[Matplotlib-users] xlabels on top, ylabels on right

2012-10-12 Thread Andreas Hilboll
Hi, me again :)

I'm looking for a way to have the xlabels on the top (instead of bottom),
and the ylabels on the right (instead of left). I guess I could do
something with twinx / twiny and just not use the left/bottom axis, but
I'm sure there is some more elegant way ...

Cheers, Andreas.


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


[Matplotlib-users] x-label location not at xtick location?

2012-10-12 Thread Andreas Hilboll
Hi,

another question. Given the plot from my last email (I attached the code
to this one as well), I would like to have the x-labels ("J", "F", ...)
not at the location of the xticks, but centered in between to xticks. I
would then move the xticks so that they form the bins to the data chunks,
and the labels should be where the current xticks are.

Any suggestions are again extremely welcome :)

Cheers, Andreas.from numpy import arange, linspace, where, searchsorted, zeros, nan, loadtxt, asarray, random
from numpy.ma import masked_invalid
import matplotlib.pyplot as plt

data = random.randn(12,72)

nxbin, nybin = data.shape
xbin = linspace(0, 12, nxbin + 1)
ybin = linspace(-90, 90, nybin + 1)
pdata = masked_invalid(data)

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

cmap = mpl.cm.seismic
cmap.set_bad('#cc', 1.)

pl = spl.pcolormesh(xbin, ybin, pdata.T,
cmap=cmap, edgecolors='None',
vmin=-7,vmax=7,
)
spl.axis([0., 12., ybin.min(), ybin.max()])

spl.set_xticks(xbin[1:]-.5)
spl.set_xticklabels(['J','F','M','A','M','J','J','A','S','O','N','D'],
size='large')
spl.set_xlim([0.,12.])
spl.set_xlabel(u'Month', size='x-large', fontname='Arial')

spl.set_ylabel(u'Latitude [°]', size='x-large', fontname='Arial')
spl.set_yticks(linspace(-90., 90., 7))
spl.set_yticklabels(arange(-90,91,30), size='large', fontname='Arial')

cb = plt.colorbar(mappable=pl, orientation='horizontal',
  fraction=0.075, aspect=50, pad=.15)
--
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


[Matplotlib-users] color pallette suggestions wanted

2012-10-12 Thread Andreas Hilboll
Hi,

I have some data I want to plot using pcolormesh. It's 2d climatological
data, see the attached plot. My data is in a range from -7 to +0.6. I want
to be 0.0 to be clearly visible, while at the same time, the color range
should show the full dynamic of the values. I played with the bwr and
seismic color maps, centering on zero, so that white is 0.0. However, I'm
not too happy with the dynamic range I get in the negative.

Any suggestions are very welcome ...

Cheers, Andreas.<>--
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-08 Thread Andreas Hilboll
> Hello,
>
> Is there any collection of articles that shows academic articles using
> matplotlib produced plots? I have come across a few recent articles in my
> field with plots produced by matplotlib. Though, the mpl page shows some
> nice examples of publication quality plots, it would be nice to have a
> discipline specific collection of academic paper citations/links
> (hopefully
> mostly open-access titles) to raise awareness of mpl usage in academia by
> attracting other language users.
>
> What do you think?

I like that idea. Probably, a wiki page at github would be best for this?


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

2012-07-27 Thread Andreas Hilboll
Hi Francesco,

 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)

Thanks - that did the trick :)

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


Re: [Matplotlib-users] Placing a 'title' inside a legend

2012-07-27 Thread 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).

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


Re: [Matplotlib-users] How to plot only a legend?

2012-07-27 Thread Andreas Hilboll
> 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.

Thanks for your help, guys! I wasn't totally happy with the 'tight'
bounding box, as the margins to the legend were not uniform on all four
sides. So I did indeed return to a subprocess.call(['pdfcrop', ...]).

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


[Matplotlib-users] Placing a 'title' inside a legend

2012-07-27 Thread 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?

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


Re: [Matplotlib-users] How to plot only a legend?

2012-07-26 Thread Andreas Hilboll
> 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?

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


[Matplotlib-users] How to plot only a legend?

2012-07-26 Thread 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.

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


Re: [Matplotlib-users] high resolution map image

2012-07-16 Thread Andreas Hilboll
> Hi all,
>
> I've to draw a plot in a very small area (about 1 degree of height/width)
> with
> a map image.
> I've tried with the warpimage method and with the Nasa visible Earth
> images
> (http://visibleearth.nasa.gov/view_cat.php?categoryID=1484), but I've some
> problems:
> - with the resolution 21600x10800 the image is still too bad
> - with the resolution 21600x21600 the image is distributed in panels and
>   warpimage method required a whole world image
>
> Merging the 6 panels maybe it can works, but I think my laptop can't
> process a
> so big image.
>
> Any suggestion for cutting the image area before passing it to Basemap?
> Or another kind of images to use?
>
> Thank you very much,
>

I recommend using GDAL (http://gdal.org/) for geospatial stuff. There's
Python bindings, but it'd be easier to just select the area you need from
the input file (using gdal_translate or gdalwarp), and then load the newly
created file for Basemap processing.

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


Re: [Matplotlib-users] Dates interpretation on csv2rec

2012-06-29 Thread Andreas Hilboll
> Dear all,
>
> I have a CSV file with the first column with timestamps:
>
> 0:00:00 01/01/2007,   0.000, 10,   0.000, 10,
> 0.000, 10:
> 00:00:00 02/01/2007,   0.000, 10,   0.000, 10,
> 0.000, 10
> 00:00:00 03/01/2007,   0.000, 10,   0.000, 10,
> 0.000, 10
> ...
> 00:00:00 29/12/2009,   0.000, 10,   0.000, 10,
> 0.000, 10
> 00:00:00 30/12/2009,   0.000, 10,   0.000, 10,
> 0.000, 10
> 00:00:00 31/12/2009,   0.000, 10,   0.000, 10,
> 0.000, 10
>
> As you can see, the format is hour:minute:second (nor relevant, always
> 00) day/month/year.
>
> When loaded with mlab.csv2rec, it automatically detects them as dates
> and creates datetime objects, but it is not consistent with the
> interpretation of the dates. When the day is < 13, it interprets it as
> month/day/year. It's loaded correctly otherwise (as day/month/year). I
> could pre-process the files and change the dates format, but imho it's
> not very elegant. Any suggestion about how to address this issue?
>
> Regards,
> Sergi

You could use numpy.genfromtxt together with its `converters` parameter:

converters : variable, optional
The set of functions that convert the data of a column to a value.
The converters can also be used to provide a default value
for missing data: ``converters = {3: lambda s: float(s or 0)}``.

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


Re: [Matplotlib-users] Pgf Backend with Xelatex support

2012-06-27 Thread Andreas Hilboll
>
> Hi,
>
> When creating figures to be included in Latex documents I encountered a
> few
> problems. In the end the text rendering just doesn't blend in well, one
> way
> or another. I found that the problems can be fixed by using Xelatex, which
> provides full unicode support and is able to use the installed fonts of
> your
> operating system.
>
> I wrote a new backend that uses the "pgf" latex package for drawing
> matplotlib figures. It is compatible with pdflatex, xelatex and lualatex.
> The pgf pictures can be included in latex documents or can be directly
> compiled to PDF by the backend, utilizing the benefits of Xelatex.
>
> The code for the backend and a script creating a test figure is on github:
> https://github.com/pwuertz/matplotlib-backend-pgf/
>
> A document that demonstrates the benefits of using pgf/xelatex is also
> there:
> https://github.com/pwuertz/matplotlib-backend-pgf/raw/master/demo/demo.pdf
>
> Although I think the pgf backend is very useful already and produces
> figures
> in publication quality (an overused expression ;) ), there are still some
> loose ends. Basically, everything I need works but I don't have the time
> anymore to figure out all the rest. Maybe someone is interested in
> improving
> this backend, possibly making it a real option for the masses? I wrote
> down
> all open questions I had in TODO comments within the code. To summarize
> them:
>
> * The default font for the backend is the unicode variant of Computer
> Modern
> (CMU Serif), which might not be present on most users' systems. If you
> don't
> want to install/use it, you can just specify another (see test script). I
> could as well check for the fonts specified in the rc parameters but these
> just do fit in Latex documents.
>
> * When printing pgf commands, the actual font depends on the latex
> environment you are embedding the figure in. Matplotlib only needs a font
> for calculating the text positions and for direct PDF output.
>
> * I'm not sure how certain draw methods of the renderer should behave due
> to
> lack of documentation.
>
> * Some text properties like switching font families or making the text
> italic/bold are ignored since I did not need them.
>
> * Backends like svg or pdf are able to display the document upon show(). I
> don't know how this is achieved without creating a graphical user
> interface
> myself. The other backends don't implement it.
>
> * The method of obtaining the metrics of text elements is pretty cool I
> think (XelatexManager), but it breaks easily since there is no way of
> defining a timeout for reading the output of a subprocesses that keeps
> running during the figure creation process. Right now, if Latex doesn't
> understand a text-element the process stalls. An alternative is to run a
> new
> latex process for every single text element or start using threads.
>

Looks great! How do I use this with my currently installed matplotlib 1.1.0?

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


[Matplotlib-users] export colormap to GMT's CPT format

2012-06-19 Thread Andreas Hilboll
Hi,

I have a `LinearSegmentedColormap` which I would like to export to GMT's 
CPT format. However, I couldn't find a way to get the RBG values of the 
`N` color slices of the colormap, which I need in order to create the 
CPT file.

Any help is greatly appreciated.

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


[Matplotlib-users] hist() and masked_array

2010-06-17 Thread Andreas Hilboll
Hi there,

I just noticed today that when I call hist() on a masked_array, also those
values which are masked out are displayed (with their fill_value). Is that
really the desired behaviour?

I'm working in an environment where we're mostly using masked_array, but
also sometimes the 'normal' ndarray. So I would need to do something like

try:
  data = data.compressed()
except:
  pass
hist(data)

all the time ... Is there any easier solution?

Cheers,

Andreas.


--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scatterplots with colorscale?

2010-05-21 Thread Andreas Hilboll
> You want to make a kernel density estimate (a.k.a. a "heatmap").

Thanks for the link, i'll look into it and compare it to the suggested
hexbin().

> This approach would
> likely
> be a bit slow if you have a very large number of points, though.  It's
> usually less visually messy to just plot the image

Well, that's not an option. I once tried to create a 'normal' scatterplot
of my data (it's a couple of million points), and that took a *long* time.
Plus, it made me see a 700M pdf file for the first time in my life ;)

Cheers,

Andreas.


--

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


[Matplotlib-users] Scatterplots with colorscale?

2010-05-21 Thread Andreas Hilboll
Hi there,

the attached figure shows a scatterplot, where the colors indicate the 
density of measurement points.

Is there any way to do this with matplotlib?

Thanks for your insight,

Andreas.


<>--

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


[Matplotlib-users] Setting boundaries for a colorbar

2010-04-14 Thread Andreas Hilboll
Hello there,

using matplotlib 0.99, I have a problem with colorbars, which is illustrated
by the following code:

---8<---
from matplotlib import ticker
import numpy as np

a = np.arange(676).reshape((26,26))
x = y = np.arange(26)

colorMap = mpl.cm.get_cmap('jet', 10)
colorNorm = mpl.colors.Normalize(vmin=0, vmax=400,clip=True)

plot = contourf(x,y,a,10,cmap=colorMap,norm=colorNorm, \
 locator=ticker.LinearLocator(10))
cb = colorbar(plot,orientation='horizontal',cmap=colorMap,norm=colorNorm, \
 extend='neither',spacing='uniform')
---8<---

So I have data ranging from 0 up to say 675. I want to create a contour plot,
but the colorbar should only go up to 400, and all values higher than that
should be shown in the color of the maximum value 400, which is working 
fine.

However, the colorbar does not go from 0 to 400, but rather from 0 to 675:

---8<---
In [52]: cb._boundaries
Out[52]:
array([ -6.7500e-04,   7.5000e+01,   1.5000e+02,
  2.2500e+02,   3.e+02,   3.7500e+02,
  4.5000e+02,   5.2500e+02,   6.e+02,
  6.75000675e+02])
---8<---

The colors shown are correct, but the colorbar looks ugly, because two 
thirds
of it are filled with the color of the maximum value.

According to the documentation
(http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.Normalize):

If clip is True and the given value falls outside the range, the
returned
value will be 0 or 1, whichever is closer.

So my question is: What do I need to do so that the colorbar actually  has
the
range as specified by my colorNorm?

Thanks for your help,

Andreas.


<>--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users