Re: [Matplotlib-users] how fix axes position by using set_position method?

2012-06-14 Thread wiswit

using axes.set_anchor will do the trick.

chao


wiswit wrote:
> 
> Dear all,
> 
> I think this is quite easy but I searched the internet and mailing list
> and
> not able to find an answer.
> ax2 is an inset axes within the "ax" axes in figure "fig", which I make
> following here
> http://matplotlib.sourceforge.net/examples/pylab_examples/axes_demo.html
> 
> but now my problem is that I cannot fix the ax2 the exact position I want,
> it seems that draw() command change this:
> 
> 
> In [352]:
> 
> ax2.set_position([0.125,0.63,0.25,0.25])
> 
> ax2.set_position([0.125,0.63,0.25,0.25])
> 
> In [353]:
> 
> ax2.get_position()
> 
> ax2.get_position()
> 
> Out[353]:
> 
> Bbox(array([[ 0.125,  0.63 ],
>[ 0.375,  0.88 ]]))
> 
> In [354]:
> 
> draw()
> 
> draw()
> 
> In [355]:
> 
> ax2.get_position()
> 
> ax2.get_position()
> 
> Out[355]:
> 
> Bbox(array([[ 0.15625,  0.63   ],
>[ 0.34375,  0.88   ]]))
> 
> 
> could anyone give any hints? thanks!
> 
> 
> Chao
> 
> 
> -- 
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> 
> 
> --
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/how-fix-axes-position-by-using-set_position-method--tp33982759p34011301.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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] confusion with axes.set_ratio

2012-06-14 Thread wiswit

so, I didn't notice the axes.set_anchor method. This will do the trick. 

Chao


wiswit wrote:
> 
> Dear all,
> 
> asking question in a good way is art and I am trying to do that :-). I
> spent whole day trying to put an inset axes within another hosting axes
> the
> exact position I want.
> and from here
> http://old.nabble.com/Adding-custom-axes-within-a-subplot-td22159536.html
>  Jae-Joon
> Lee <http://old.nabble.com/user/UserProfile.jtp?user=1141641>  gave a good
> answer using only four lines:
> 
> Bbox = matplotlib.transforms.Bbox.from_bounds(.4, .1, .5, .3)
> #numbers in fraction of hosting axes
> trans = ax.transAxes + fig.transFigure.inverted()
> l, b, w, h = matplotlib.transforms.TransformedBbox(Bbox, trans).bounds
> axins = fig.add_axes([l, b, w, h])
> 
> It works fine. Now my question is I want inset axes to have 'equal' aspect
> because I want 1:1 ratio plot. and I found that using
> axins.set_aspect('equal')
> will change the position of the inset axes. Then I tried to adjust the
> width and height of inset axes with the hosting axes aspect ratio before I
> draw it so that
> I would expect they look already "aspect-equal" before I feed data to it.
> 
> So my first question is,  How can I get the axes aspect ratio,
> axes.get_aspect() and  axes._aspect both give only 'auto' but not
> numerical
> value.
> (I assume it's height/width ratio in terms of figure fraction or it's
> inverse?, I tried this but it doesn't work.)
> 
> another side-question, I have a feeling that understanding transform is of
> great value working with matplotlib. But I don't understand the
> four lines above, and I can not find further information either in the
> matplotlib document or online. Is there any source except having
> dig into source code? thanks
> 
> I make an example script below to show the problem (long but easy). I hope
> someone could offer some help. :-)
> 
> ###script showing the problem
> fig=plt.figure()
> #plot two subplot to have ax aspect far from 'equal'
> ax=fig.add_subplot(211)
> a=np.arange(0,2*np.pi,0.1)
> ax.plot(a,np.sin(a))
> 
> def create_inset_axes(x0,y0,width,height):  #the four numbers are
> x0,y0,width,height
> Bbox = matplotlib.transforms.Bbox.from_bounds(x0,y0,width,height)
> trans = ax.transAxes + fig.transFigure.inverted()
> l, b, w, h = matplotlib.transforms.TransformedBbox(Bbox, trans).bounds
> return fig.add_axes([l, b, w, h])
> 
> def get_axes_aspect_ratio(ax):
> box=ax.get_position()
> ratio=(box.x1-box.x0)/(box.y1-box.y0)
> return ratio
> 
> axins=create_inset_axes(0.1,0.05,0.2,0.2)
> axins.plot(np.arange(10),'ro')
> ax.text(0.35,0.15,'no any adjustment',transform=ax.transAxes)
> 
> axins=create_inset_axes(0.1, 0.3, 0.2, 0.2)
> axins.plot(np.arange(10),'ro')
> axins.set_aspect('equal')
> ax.text(0.35,0.4,'explicitly set aspect as equal',transform=ax.transAxes)
> 
> axins=create_inset_axes(0.1, 0.55, 0.2, 0.2*ratio) #adjust the height by
> ax
> axes width/height ratio
> axins.plot(np.arange(10),'ro')
> ax.text(0.35,0.7,'adjust with hosting axes width/length
> ratio',transform=ax.transAxes)
> 
> cheers,
> 
> Chao
> -- 
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> 
> 
> --
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/confusion-with-axes.set_ratio-tp34006883p34011256.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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 set popup window always on top?

2012-06-12 Thread wiswit

Dear all, 

Is there a way that I can set the popup window that appears when I issue a
plotting command always on top?

cheers,

Chao
-- 
View this message in context: 
http://old.nabble.com/how-to-set-popup-window-always-on-top--tp34000345p34000345.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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] What is your matplotlib workflow?

2012-06-12 Thread wiswit

Hi, Thanks Fernando! I am using vim and I checked a little bit the tool and
it seems of great help!
I am not saying that we need something perfect. It's already great to have
these tools (ipython, matplotlib). Just imagine what's kind of feeling
working within pure python shell... thanks for these great work.

Chao


Fernando Perez wrote:
> 
> On Mon, Jun 11, 2012 at 2:05 PM, wiswit  wrote:
>> While in emacs or vim, you cannot simple select lines and execute them,
>> so
>> you have to frequently copy and code and use %cpaste or %paste to paste
>> the
>> code.
> 
> In emacs you can activate ipython in your emacs.el file and then you
> can send arbitrary snippets you highlight, with C-c |.  In vim, Paul
> Ivanov's vim-ipython integration
> (https://github.com/ivanov/vim-ipython) gives even more powerful and
> detailed control.
> 
> Not saying the issues being discussed don't exist, but we do have some
> tools to partially address them (the questions about the MPL api are
> obviously beyond IPython's control).
> 
> Cheers,
> 
> f
> 
> --
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/What-is-your-matplotlib-workflow--tp33987463p3400.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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] What is your matplotlib workflow?

2012-06-11 Thread wiswit

I think this is worth discussing. But I have only 1.3 years experience with
matplotlib and python. Basically, I do the same as you. But I think there
are few tips I would like to follow:

1. I would agree to make one major theme plot one script file. Avoid make
very long scripts with many plots. It's much more difficult to revisit. 
2. I would avoid writing too much fancy loops as it takes much more time
when you want to make some change later.
3. I would like to divide complex figures into simple ones. like I would use
scatter to plot only scatter, and plot for only plotting lines. but not use
plot to plot both. I think this allows more flexible way in the future to
make necessary modifications.

But I still don't manage to find a good way for efficiently modifying
scripts and interactive plotting. It's very nice to have interactive
plotting (with --pylab) using ipython notebook, but when you want to make
some substitutions, it's much more tedious than in an editor like vim/emacs.
While in emacs or vim, you cannot simple select lines and execute them, so
you have to frequently copy and code and use %cpaste or %paste to paste the
code. And., a lot lot windows shifting 

Chao


pybokeh wrote:
> 
> Maybe workflow may not be the appropriate term.  Essentially, when I want
> to plot something using matplotlib, I find myself having to look up the
> api
> docs or examples online because quite frankly, matplotlib's syntax is very
> hard to remember.  I use ipython and use tab browsing, help(), dir(), etc,
> and that seem to help to some extent.  I absolutely love matplotlib, but
> when I want to put a chart up quickly, matplotlib is just a "hassle"
> depending on what chart you want to create.  I do expect this since
> plotting with matplotlib, you are essentially creating a chart
> "programmatically", instead of GUI interface environment.  But still, I
> feel like an improvement could still be made in making charts simpler with
> matplotlib.
> 
> While surfing the web, I ran into this module called Canvas:
> https://github.com/mdipierro/canvas
> 
> Canvas appears to be what I am after or what I wish matplotlib's future
> syntax should strive for.
> 
> Currently, I store my matplotlib chart source code in folders with the
> file
> name describing what chart it creates (for example, "box_plot.py" or
> "control_chart.py", etc.) and use them as "cheat sheets" when I need to
> make a chart.  I am curious what other matplotlib users do?  Otherwise, I
> do find myself sometimes just creating the chart in Excel as a 1st option,
> and make charts in matplotlib if it is something Excel can't handle.
> 
> Thanks in advance,
> Daniel
> 
> --
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/What-is-your-matplotlib-workflow--tp33987463p33996351.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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] get colorlist and values from existing matplotlib colormaps?

2012-06-05 Thread wiswit

Thanks Eric. This is quite an informative answer about colormap! 
The first part of the answer is exactly what I need. 

cheers,

Chao


efiring wrote:
> 
> On 06/02/2012 03:37 AM, Chao YUE wrote:
>> Dear all,
>>
>> I find I would like to make some change from the existing colormaps. for
>> example, I would like to change the color at the beginning of the
>> colormap (let's say mat.cm.jet) but I still
>> want to use the remaining other colors. So is there way I can easily use
>> some functions already in matplotlib to extract the colorlist and levels
>> from a mat.cm.jet?
>> Then I can just change the first color of the colorlist, and use
>> mat.colors.LinearSegmentedColormap.from_list to easily construct the
>> colormap I want.
> 
> Try playing with something like this (in ipython --pylab):
> 
> jetcmap = cm.get_cmap("jet", 10) #generate a jet map with 10 values
> jet_vals = jetcmap(np.arange(10)) #extract those values as an array
> jet_vals[0] = [0.1, 0, 0.1, 1] #change the first value
> newcmap = mpl.colors.LinearSegmentedColormap.from_list("newjet", jet_vals)
> imshow(rand(18,20), cmap=newcmap, vmin=0, vmax=1, interpolation="nearest")
> colorbar()
> 
> Alternatively, you can copy the cm.datad['jet'] dictionary (datad is a 
> dictionary of dictionaries), modify it, and use it to initialize a 
> custom LinearSegmentedColormap instance.  See 
> http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html.
> 
> 
>>
>> I can use mat.cm.jet._segmentdata to retrieve the dictionary. I also
>> have a look at the source code
> 
> In general it is not a good idea to work with attributes with leading 
> underscores, which flag them as especially low-level 
> implementation-dependent details. cm.jet._segmentdata can be accessed as 
> cm.datad['jet'].
> 
> Note also that the _segmentdata is not what is used directly to look up 
> the colors; instead it is used to generate the lookup table (_lut 
> attribute).  See below.
> 
>> /usr/local/lib/python2.7/dist-packages/matplotlib/colors.py but I didn't
>> manage to find a solution.
>>
>> both mat.colors.LinearSegmentedColormap and mat.colors.ListedColormap
>> finally calls mat.colors.Colormap.__init__ and then I don't understand
>> how these colorlist are really used for plotting.
>>
> 
> Typically it is a two-stage process.  First, a data array is passed to a 
> Normalize instance which scales it to the range from zero to one. 
> Second, that scaled array is passed to the Colormap instance, which uses 
> its lookup table to map any point in the 0-1 range to a color.
> 
> Less commonly, instead of passing an array of floats to the Colormap 
> instance, one may pass in an integer array, in which case these integers 
> are used directly as indices into the lookup table (which is the _lut 
> attribute of the Colormap instance.)
> 
>> Another question, where can I find the source code where mat.cm.jet is
>> defined?
> 
> Good question; the answer is obscured by somewhat convoluted coding in 
> cm.py.  The relevant part is this:
> 
> for cmapname in datad.iterkeys():
>  cmap_d[cmapname] = _generate_cmap(cmapname, LUTSIZE)
> 
> locals().update(cmap_d)
> 
> 
> The first block is filling a dictionary with LinearSegmentedColormap 
> instances corresponding to the named sets of segment data from _cm.py.
> The "locals" line is the tricky part: it is adding each entry in that 
> dictionary to the local namespace, so that cm.cmap_d["jet"] can be 
> accessed as cm.jet, etc.
> 
> There is a bit more to it, because Colormap instances can handle three 
> special values: over range, under range, and "bad" (masked).  See 
> http://matplotlib.sourceforge.net/examples/pylab_examples/contourf_demo.html
> and
> http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html
> 
> Eric
> 
> 
>>
>> thanks et cheers,
>>
>> Chao
> 
> --
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/get-colorlist-and-values-from-existing-matplotlib-colormaps--tp33949604p33965531.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


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

Re: [Matplotlib-users] how to remove colorbar?

2012-05-22 Thread wiswit

Thanks Jerzy. It works fine. I may return to this topic for more discussion
later. 

chao


Jerzy Karczmarczuk-2 wrote:
> 
> Benjamin Root :
>> Colorbars are a bit tricky.  They are actually a subplot axes separate 
>> from your plotting axes.  And I don't think they are very easy to 
>> remove.  You could do a "cbar.axes.cla()", but that would still leave 
>> the "ticks", tick labels and the colorbar label.
>>
>> I am sure that there is a way to get to what you want, but it isn't 
>> immediately obvious.
> Well, I tried with some success the following. Suppose the programme is:
> 
> from pylab import *
> fig = figure()
> ax = fig.add_subplot(111)
> data = rand(250, 250)
> cax = ax.imshow(data)
> cbar = fig.colorbar(cax)
> show()
> 
> Now, fig has two axes, the main, and the bar. The command
> 
> fig.delaxes(fig.axes[1])
> 
> gets rid of the bar and the ticks.
> Is there anything wrong with that? Of course, I knew that fig.axes[1] 
> was the bar, but finding it in a more complicated case should not be 
> difficult.
> 
> All the best.
> 
> Jerzy Karczmarczuk
> 
> 
> 
> --
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/how-to-remove-colorbar--tp33882320p33892056.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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] numpoints in legend() function for scatter plot is not working in matplotlib 1.1.0?

2012-04-10 Thread wiswit

Dear all,

I found that the numpoints in legend function for scatter plot is not
working?

import matplotlib as mat
import matplotlib.pyplot as plt
In [59]: mat.__version__
Out[59]: '1.1.0'

#ordinary plot working
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(np.arange(10),'ro',label='tst')
ax.legend(numpoints=1)
plt.show()

#but not scatter plot
fig=plt.figure()
ax=fig.add_subplot(111)
ax.scatter(np.arange(10),np.arange(10),marker='o',label='tst')
ax.legend(numpoints=1)
plt.show()

cheers,

chao

-- 
View this message in context: 
http://old.nabble.com/numpoints-in-legend%28%29-function-for-scatter-plot-is-not-working-in-matplotlib-1.1.0--tp33662785p33662785.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] markeredgecolor (mec) in the plot function not working?

2012-04-10 Thread wiswit

Dear all,

I use matplotlib 1.1.0.

import matplotlib.pyplot as plt
plt.plot(np.arange(10),'ro',mec='none')

when I use plt.show(),

there is only blank frame with axis not no points.

but plt.plot(np.arange(10),'ro') will give good plot with read filled
circles and black edges.

plt.scatter(np.arange(10),np.arange(10),c='r',marker='o',edgecolor='none')
is working fine.

but I really think plt.plot is a very good and easy function if you don't
make complex scatter points. and the circles look much nicer than that
produced by plt.scatter (thought I don't know why
as they use the same symble)

does anyone else have found the same ?

thanks to all,

Chao
-- 
View this message in context: 
http://old.nabble.com/markeredgecolor-%28mec%29-in-the-plot-function-not-working--tp33662659p33662659.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to change the frame size of legend?

2011-06-24 Thread wiswit

and also,  how can I make only one point for the scatter legend?
if I use 

leg=ax1.legend(loc='upper left', numpoints=1)

all the lines will disapper too...



wiswit wrote:
> 
> Dear all,
> 
> I've made a plot (as attached). The problem is the frame of the legeng is
> too big that It covers some part of the lines in the figure.
> I used a 'x-samll' font size in the legend text, but the problem is that
> the space between the lines of different texts is too big that the
> whole frame of the legend becomes big.
> 
> another question is, the font size of legend text can only be set as
> 'xx-small' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' |
> 'xx-large' , but not specific numbers?
> 
> Any ideas about this will be very much appreciated.
> 
> 
> ### the script:
> fig1=plt.figure()
> fig1.text(0.5,0.04,'Years since last
> burn',ha='center',rotation='horizontal')
> fig1.text(0.05,0.45,'Total biomass(gC
> m-2)',va='center',rotation='vertical')
> ax1=fig1.add_subplot(111)
> for i in range(7):
>
> ax1.plot(np.arange(1,len(ns2['TOTAL_M'][i])+1),ns2['TOTAL_M'][i],g.pline[i],label=bsite.NSlist[i])
> ax1.plot(data[:,0],data[:,13],'k.',markersize=10,label='Goulden et
> al.,2011')
> ax1.plot(wdata[:,0][0:7],wdata[:,6][0:7],'r.',markersize=10,label='Wang et
> al.,2003 Dry')
> ax1.plot(wdata[:,0][7:14],wdata[:,6][7:14],'g.',markersize=10,label='Wang
> et al.,2003 Wet')
> leg=ax1.legend(loc='upper left')
> ltext  = leg.get_texts()
> llines = leg.get_lines()
> frame  = leg.get_frame()
> plt.setp(ltext, fontsize='x-small')
> 
> 
> Best wishes,
> 
> Chao
> http://old.nabble.com/file/p31918421/CA-NS_BiomassCarbon_modelVSob.png 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-change-the-frame-size-of-legend--tp31918421p31918424.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


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


[Matplotlib-users] How to change the frame size of legend?

2011-06-24 Thread wiswit

Dear all,

I've made a plot (as attached). The problem is the frame of the legeng is
too big that It covers some part of the lines in the figure.
I used a 'x-samll' font size in the legend text, but the problem is that the
space between the lines of different texts is too big that the
whole frame of the legend becomes big.

another question is, the font size of legend text can only be set as
'xx-small' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' |
'xx-large' , but not specific numbers?

Any ideas about this will be very much appreciated.


### the script:
fig1=plt.figure()
fig1.text(0.5,0.04,'Years since last
burn',ha='center',rotation='horizontal')
fig1.text(0.05,0.45,'Total biomass(gC m-2)',va='center',rotation='vertical')
ax1=fig1.add_subplot(111)
for i in range(7):
   
ax1.plot(np.arange(1,len(ns2['TOTAL_M'][i])+1),ns2['TOTAL_M'][i],g.pline[i],label=bsite.NSlist[i])
ax1.plot(data[:,0],data[:,13],'k.',markersize=10,label='Goulden et
al.,2011')
ax1.plot(wdata[:,0][0:7],wdata[:,6][0:7],'r.',markersize=10,label='Wang et
al.,2003 Dry')
ax1.plot(wdata[:,0][7:14],wdata[:,6][7:14],'g.',markersize=10,label='Wang et
al.,2003 Wet')
leg=ax1.legend(loc='upper left')
ltext  = leg.get_texts()
llines = leg.get_lines()
frame  = leg.get_frame()
plt.setp(ltext, fontsize='x-small')


Best wishes,

Chao http://old.nabble.com/file/p31918421/CA-NS_BiomassCarbon_modelVSob.png 
-- 
View this message in context: 
http://old.nabble.com/How-to-change-the-frame-size-of-legend--tp31918421p31918421.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


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