Re: [Matplotlib-users] Blurry Scatter Plot

2015-08-03 Thread ChaoYue
You may need to remove the alpha=0.05 or set it as 1 I think.

Chao

On Mon, Aug 3, 2015 at 12:51 AM, albad17 [via matplotlib] 
ml-node+s1069221n45995...@n5.nabble.com wrote:

 For some reason when I plot a scatter plot like this:

 plt.scatter(diamonds['carat'], diamonds['price'], color = 'black', alpha =
 0.05)
 plt.xlabel('Carat')
 plt.ylabel('Price')

 I get a blurry scatter plot as shown in the image


 I want something more like this:


 Any help would be greatly appreciated.

 Thanks

 --
 If you reply to this email, your message will be added to the discussion
 below:
 http://matplotlib.1069221.n5.nabble.com/Blurry-Scatter-Plot-tp45995.html
 To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click here
 http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAML
 http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




-- 
please visit:
http://www.globalcarbonatlas.org/
***
Chao YUE
postdoc at LGGE
LGGE, BP 96, 38402 St Martin d'Hères Cedex, France





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Blurry-Scatter-Plot-tp45995p45997.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap shiftgrid

2014-08-27 Thread ChaoYue
Hi Michelle,

I might not fully understand your problem, could you have a look at this
thread and see if it helps?

http://matplotlib.1069221.n5.nabble.com/Fwd-Strange-behaviour-on-plotting-data-on-Ronbinson-projection-using-Basemap-td43222.html#a43233

Cheers,

Chao


On Wed, Aug 27, 2014 at 9:58 AM, mmc [via matplotlib] 
ml-node+s1069221n43851...@n5.nabble.com wrote:

 Hi All,

 I am having problems plotting data in Basemap. I have tried some of the
 different projections such as Robinson and Equidistant Cylindrical, however
 kept running into the error

 WARNING: x coordinate not monotonically increasing - contour plot
 may not be what you expect.  If it looks odd, your can either
 adjust the map projection region to be consistent with your data, or
 (if your data is on a global lat/lon grid) use the shiftgrid
 function to adjust the data to be consistent with the map projection
 region (see examples/contour_demo.py).


 Having read some other forums, I see that it is due to the fact that the
 longitude is based on 0-360 rather that -180 to 180. I have been trying to
 rectify this with shiftgrid.

 I have used shiftgrid and have moved my longitudes to -180 to 180 however
 I keep running up with the error:


 ValueError: lon0 outside of range of lonsin


 I also manage to get one plot out, which has the right projection I want
 (I am looking over the Atlantic) however the data isnt shifting in line
 with the longitudes. Would anyone know why this is the case?

 I have am using shiftgrid as below and the Basemap projection of
 Equidistant cylindrical (I have also tried Robinson however end up with
 similar result of data not moving in line with the longitude)

 MSLP = aso_mslp.data
 MSLP_background = np.mean(MSLP, axis = 0)

 # shifting grid to run from -180 to 180 rather than 0-360
 MSLP_background,lon = shiftgrid(180., MSLP_background, lon,
 start=False)

 #setting the map in order to plot the data
 map = Basemap(projection ='cyl', llcrnrlat=-90, urcrnrlat=90,
 llcrnrlon=-180, urcrnrlon=180, resolution='c')

 Thanks
 Michelle

 --
  If you reply to this email, your message will be added to the discussion
 below:
 http://matplotlib.1069221.n5.nabble.com/Basemap-shiftgrid-tp43851.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click here
 http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAML
 http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Basemap-shiftgrid-tp43851p43853.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Altering Basemap Colobar and Label positioning

2014-06-16 Thread ChaoYue
Hi Andruska,

The Basemap.colorbar has a size keyword to allow you have the shrink-like
function to adjust the size of the colorbar.
Otherwise you can creat an axes on the exact position you want to hold the
colorbar, like below I have prepared an example for you:

arr = np.arange(100).reshape(10,10)
fig,ax = plt.subplots(1,1)
cs = ax.imshow(arr)
ax.set_position([0.2, 0.3, 0.6, 0.6])
axt = fig.add_axes([0.4,0.2,0.4,0.05])
cbar = plt.colorbar(cs,cax=axt,orientation='horizontal')
fig.text(0.25,0.22,'I am label',va='center',size=13)
draw()

I think it's hard to use the colorbar.set_label put the label directly on
the left of your colorbar, I rather suggest you to use fig.text to
position exactly a text for your label.

At the beginning of matplotlib you might feel confused, but after investing
a significant amount of time you feel it extremely flexible, and going to
like it :)

Cheers,

Chao



On Mon, Jun 16, 2014 at 6:32 PM, Andruska, Michael [via matplotlib] 
ml-node+s1069221n43534...@n5.nabble.com wrote:

  Hi all,



 I am having great difficulty understanding how to change the size of my
 basemap colorbar, altering its position and moving the text label all at
 the same time. I would like to:

 1.   Shrink the size of the colorbar (there doesn’t seem to be a
 shrink property in the basemap.colorbar() method (only plt.colorbar() or
 fig.colorbar())

 2.   Move the bar so it is not centered but instead so its right edge
 is aligned vertically with the right end of the basemap.

 3.   Move the colorbar W/m^2 text label so it is not below the
 colorbar but is instead directly to its left.



 I looked up several other responses online that mentioned doing things
 such as adding a second axes, or using the shrink command from
 plt.colorbar(), and changing some other properties such as padding, but in
 the end, most of these alterations seem to introduce another problem when I
 try them. Even after viewing their documentation, I still do not fully
 understand their proper usage. Also, I tried a few properties listed in the
 matplotlib documentation such as anchor and panchor in my the
 fig.colorbar() method in attempt to move the bar around but when I tried to
 run it, the keyword was not recognized by the interpreter and produced an
 error (it seems strange that some of the keywords listed in the docs aren’t
 being recognized; and I’m pretty sure I have the most current matplotlib
 version too). You can see some of the commented commands I tried in the
 code below (not all at once, of course, but just in various conjunctions
 with one another). Here is an example of my code and an attached example of
 what the plot currently looks like after running said code. Any helpful
 advice would be greatly appreciated. So confused right now and I feel like
 I’ve read the docs over and over to little avail (P.S. Getting down to the
 nitty gritty of working with matplotlib objects and understanding its inner
 workings to customize my plots better is really confusing, even with the
 docs, (sigh)):



 swi = swi.reshape(1059, 1799)

 lat = lat.reshape(1059, 1799)

 lon = lon.reshape(1059, 1799)



 def plot_conus():

 m = mpl_toolkits.basemap.Basemap(

 llcrnrlon=-135.0,

 llcrnrlat=19.0,

 urcrnrlon=-60.0,

 urcrnrlat=54.0,

 projection='mill',

 resolution='c')

 m.drawcoastlines()

 m.drawcountries()

 m.drawstates()

 # draw parallels

 parallels = np.arange(0.,90,10.)

 m.drawparallels(parallels,labels=[1,0,0,0],fontsize=10)

 # draw meridians

 meridians = np.arange(180.,360.,10.)

 m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10)

 return m



 # find hex color values at http://www.colorpicker.com

 swi_colors = [

 ##f800fd, # light purple

 ##9854c6, # dark purple

 #04e9e7,

 #019ff4,

 #0300f4,

 #02fd02,

 #01c501,

 #008e00,

 #fdf802,

 #e5bc00,

 #fd9500,

 #fd,

 #d4,

 #bc,

 #A10505 # brick

 ]



 swi_colormap = matplotlib.colors.ListedColormap(swi_colors)



 m = plot_conus()



 levels = []

 for i in range(13):

 levels.append(i*90.0)



 # create black and white cross at observatory location on map

 site_lon = -87.99495

 site_lat = 41.70121

 x_site, y_site = m(site_lon, site_lat)

 m.plot(x_site, y_site, 'w+', markersize=30, markeredgewidth=8) # white
 cross

 m.plot(x_site, y_site, 'k+', markersize=25, markeredgewidth=3) # black
 cross



 norm = matplotlib.colors.BoundaryNorm(levels, 13)

 cax = m.pcolormesh(lon, lat, swi, latlon=True, norm=norm,

 cmap=swi_colormap)



 #cbar = m.colorbar(cax)

 fig = plt.gcf()

 #ax = plt.gca()

 #cbar = fig.colorbar(cax, orientation='horizontal', shrink=0.75)

 #cbaxes = fig.add_axes([0.8, 0.1, 0.03, 0.8])

 #cb = fig.colorbar(cax)

 cbar = m.colorbar(cax, location='bottom', pad='6%')

 cbar.set_label('$W/m^2$', fontsize=18)



 plt.title('NOAA LAPS GHI, RT ' + modelrun_time_label + ', VT ' +
 fcst_time_label)

 plt.show()





 --

 HPCC Systems Open 

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

2014-04-21 Thread ChaoYue
Hi all,

Thank you all for your kind response. I am sorry, but none of these
solutions significantly improved the visual quality on microsoft powerpiont
2007. Thought I didn't try eps. So probably l have to go with the current
quality.
here is a best case I have now:
https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx
You can still see the a bit blur everywhere (currently with jpg being
inserted directly). I didn't have better quality than this one by trying
the method as suggested by you. Let me know if I am raising too much high
demand for this.

Cheers,

Chao


On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] 
ml-node+s1069221n43262...@n5.nabble.com wrote:

 ​Another alternative, if a vector graphics format doesn't work, is to make
 your png figure large.  Then when you shrink it down to fit in your slide,
 it should still have good resolution.

 Jon​

 On Mon, Apr 21, 2014 at 10:13 AM, [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=43262i=0
  wrote:

 No Powerpoint version I know supports SVG (or any vector graphics format
 useful in this case) and Matplotlib does not
 export WMF graphics anymore. So the easiest way is to use PNGs, if you
 can live with raster graphics.

 Alternatively, if you need vector graphics, you can export the Matplotlib
 plot as SVG and convert it to WMF or EMF using
 Inkscape. This can be done in the command line like this:

 c:\Program Files\Inkscape-0.48\inkscape.exe --without-gui
 --export-emf=output.emf input.svg


   Juergen



 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 [hidden email] http://user/SendEmail.jtp?type=nodenode=43262i=1
 60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 


 --

 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
 [hidden email] http://user/SendEmail.jtp?type=nodenode=43262i=2
 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/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43262.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43264.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
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] Make clear figure used in the powerpoint slides?

2014-04-21 Thread ChaoYue
OK, I tried but I don't really see the difference between jpg and png by my
eyes in the attached case, maybe for other more complicated plots there
will be real difference. Anyway, thanks to all for your nice discussions.
And, BTW, I tried 2 hours trying to find a way to convert svg to emf, but
now I konw :p

Cheers,

Chao


On Mon, Apr 21, 2014 at 9:49 PM, Benjamin Root-2 [via matplotlib] 
ml-node+s1069221n43265...@n5.nabble.com wrote:

 JPGs will *always* have bit blur as it is a lossy image format. PNGs
 would be a better bet.

 Ben Root


 On Mon, Apr 21, 2014 at 3:33 PM, ChaoYue [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=43265i=0
  wrote:

 Hi all,

 Thank you all for your kind response. I am sorry, but none of these
 solutions significantly improved the visual quality on microsoft powerpiont
 2007. Thought I didn't try eps. So probably l have to go with the current
 quality.
 here is a best case I have now:
 https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx
 You can still see the a bit blur everywhere (currently with jpg being
 inserted directly). I didn't have better quality than this one by trying
 the method as suggested by you. Let me know if I am raising too much high
 demand for this.

 Cheers,

 Chao


 On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] [hidden
 email] http://user/SendEmail.jtp?type=nodenode=43264i=0 wrote:

 ​Another alternative, if a vector graphics format doesn't work, is to
 make your png figure large.  Then when you shrink it down to fit in your
 slide, it should still have good resolution.

 Jon​

 On Mon, Apr 21, 2014 at 10:13 AM, [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=43262i=0
  wrote:

 No Powerpoint version I know supports SVG (or any vector graphics
 format useful in this case) and Matplotlib does not
 export WMF graphics anymore. So the easiest way is to use PNGs, if you
 can live with raster graphics.

 Alternatively, if you need vector graphics, you can export the
 Matplotlib plot as SVG and convert it to WMF or EMF using
 Inkscape. This can be done in the command line like this:

 c:\Program Files\Inkscape-0.48\inkscape.exe --without-gui
 --export-emf=output.emf input.svg


   Juergen



 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 [hidden email] http://user/SendEmail.jtp?type=nodenode=43262i=1
60 Garden Street, MS 83
 phone: a href=tel:%28617%29%20496-7981 value=+16174967981
 target=_blank(617) 496-7981   Cambridge, MA 02138-1516
 fax: a href=tel:%28617%29%20496-7577 value=+16174967577
 target=_blank(617) 496-7577USA
 


 --

 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
 [hidden email] http://user/SendEmail.jtp?type=nodenode=43262i=2
 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/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43262.html
  To start a new topic under matplotlib - users, email [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=43264i=1
 To unsubscribe from matplotlib, click here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




 --
 please visit:
 http://www.globalcarbonatlas.org/

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

 

 --
 View this message in context: Re: Make clear figure used in the
 powerpoint 
 slides?http://matplotlib.1069221.n5.nabble.com/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43264.html
 Sent from the matplotlib - users mailing list 
 archivehttp://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.htmlat 
 Nabble.com.


 --
 Start Your Social Network Today - Download

Re: [Matplotlib-users] How can I put a white area in the middle of colorbar showing the masked data?

2014-03-02 Thread ChaoYue
Dear Eric,

This solved part of my problem. thanks a lot.
I think I will revisit this issue when I have time (not promised).
do you think this could be some feature desirable?

Cheers,

Chao


On Sat, Mar 1, 2014 at 10:39 PM, Eric Firing [via matplotlib] 
ml-node+s1069221n42952...@n5.nabble.com wrote:

 On 2014/03/01 11:03 AM, ChaoYue wrote:
  The most correct way might be to design a new colormap with white color
  exactly in the middle, however this is very tedious, especially if I
  want to try
  different colormaps. so the alternative approach would be to set the
 values
  falling in (-1,1) as being masked, so they will be the same as the axes
  background color as you mentioned (in our case it's white). My question
 is,
  how can I put this background color (which shows maksed data) in the
  colorbar,
  by avoiding design a new colormap?

 It's not the answer you want to hear, but I think the correct answer is
 that you should do this via the colormap, and not by masking the low
 values.  It doesn't have to be painful.  If, in contourf, you use a
 diverging colormap with white already in the middle
 (http://matplotlib.org/examples/color/colormaps_reference.html) and a
 norm with symmetric limits (vmin and vmax; you can let them be set
 automatically after you specify your symmetric set of contour boundaries
 appropriately) then it will be done for you.

 e.g.,

 z = 10 * np.random.randn(20, 30)
 clevs = [-10, -5, -2, -1, 1, 2, 5, 10]
 cs = plt.contourf(z, levels=clevs, cmap=plt.get_cmap('PRGn'),
extend='both')
 cbar = plt.colorbar(cs, spacing='uniform')

 Eric

 --

 Flow-based real-time traffic analytics software. Cisco certified tool.
 Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
 Customize your own dashboards, set traffic alerts and generate reports.
 Network behavioral analysis  security monitoring. All-in-one tool.

 http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=42952i=0
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://matplotlib.1069221.n5.nabble.com/How-can-I-put-a-white-area-in-the-middle-of-colorbar-showing-the-masked-data-tp42948p42952.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/How-can-I-put-a-white-area-in-the-middle-of-colorbar-showing-the-masked-data-tp42948p42956.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis  security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How can I put a white area in the middle of colorbar showing the masked data?

2014-03-01 Thread ChaoYue
Hi Eric,

thanks for answering. I updated the attached figure.
The idea is, we want to show the tree cover difference, but to make
the negative and positive values very contrastive, we would like to
assign the values falling in small range of change (in the figure, it's -1
to 1)
as blank (or gray), in order to make the remaining data constrasting
different.


The most correct way might be to design a new colormap with white color
exactly in the middle, however this is very tedious, especially if I want
to try
different colormaps. so the alternative approach would be to set the values
falling in (-1,1) as being masked, so they will be the same as the axes
background color as you mentioned (in our case it's white). My question is,
how can I put this background color (which shows maksed data) in the
colorbar,
by avoiding design a new colormap?


Then I notice in the colormap methos there is one called set_bad, I guess
this
is for this purpose, as in the case of set_over and set_under, which
will
influence the colors in the colorbar when you later call the colorbar
method.
But is it not like this?

I invented an example like below:

import numpy as np
import matplotlib as mat
import matplotlib.pyplot as plt

data = np.random.random(1).reshape(100,100) - 0.5
data_masked = np.ma.masked_inside(data,-0.05,0.05)
cmap = mat.cm.jet
cmap.set_bad('0.5')
fig,ax = plt.subplots(1,1)
lev = [-0.5,-0.4,-0.3,-0.2,-0.1,-0.05,0,0.05,0.1,0.2,0.3,0.4,0.5]
cas = ax.contourf(data_masked,levels=lev,cmap=cmap)
plt.colorbar(cas,ticks=lev)

In this example, how can I make the colors between -0.05 to 0.05 as white,
if I don't want to bother write a new colormap.

Thanks a lot for your time, I hope this case could be useful for others as I
am sure it's very widely used in geographic related sciences.


Cheers,

Chao



On Sat, Mar 1, 2014 at 9:16 PM, Eric Firing [via matplotlib] 
ml-node+s1069221n42950...@n5.nabble.com wrote:

 On 2014/03/01 9:57 AM, Chao YUE wrote:

  Dear all,
 
  In many cases in geoscience mapping we want to show the some missing
 values
  as some special color in the colorbar. like attached one.
 
  I know there is one method in matplotlib colormap called set_bad,
 official
  docs says:
 
  Set color to be used for masked values.
 
  But I don't know how to make this work when I call the colorbar method.

 It is not a matter of calling the colorbar method, but of setting up the
 colormap used on the color-mapped plot for which the colorbar is made.

 The one wrinkle to this is that if you are using contourf, the masked
 regions are not filled at all, so they take on the color of the
 background.  To give them the color you assigned to the colormap with
 set_bad, you need to assign that same color to the background, e.g.

 ax.set_axis_bgcolor(#bdb76b)

 On re-reading your message, however, I think you are asking something
 else, but it is not clear to me from your example exactly what you are
 trying to do.

 The colorbar is strictly for a range or sequence of colors, which can
 include triangle regions for the over and under values; there is no
 place on the colorbar for a bad or missing value.  Where would you
 put one?  I don't see any such region on the example colorbar you
 attached.

 Eric



  Is there anyone who have the some successful experience?
 
  Thanks a lot in advance!
 
  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
 
 

 
 
 
 --

  Flow-based real-time traffic analytics software. Cisco certified tool.
  Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
  Customize your own dashboards, set traffic alerts and generate reports.
  Network behavioral analysis  security monitoring. All-in-one tool.
 
 http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
 
 
 
  ___
  Matplotlib-users mailing list
  [hidden email] http://user/SendEmail.jtp?type=nodenode=42950i=0
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


 --

 Flow-based real-time traffic analytics software. Cisco certified tool.
 Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
 Customize your own dashboards, set traffic alerts and generate reports.
 Network behavioral analysis  security monitoring. All-in-one tool.

 http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 [hidden email] 

Re: [Matplotlib-users] colorbllind problem

2014-02-17 Thread ChaoYue
Hi Gabriele,

I'm afraid you have to put the numbers by yourself using the plt.text, as
in an example:
a = np.arange(10)
b = np.tile(a,(10,1))
c = np.tile(a[:,np.newaxis],(10)) + b
plot(c)
for i in range(10):
plt.text(5,c[i][5],str(i))


I've askd by a review to use the colorblind compatible colors when trying
to submit a paper,
and I find a website below:
http://jfly.iam.u-tokyo.ac.jp/color/

I put some RGB numbers for some colors here if you feel like to have a try:
CCC =
{

'Black':np.array([0,0,0])/255.,

'Orange':np.array([230,159,0])/255.,

'Skyblue':np.array([85,180,233])/255.,

'BluishGreen':np.array([0,158,115])/255.,

'Yellow':np.array([240,228,66])/255.,

'Blue':np.array([0,114,178])/255.,

'Vermilion':np.array([213,94,0])/255.,

'ReddishPurple':np.array([204,121,167])/255.
   }

Cheers,

Chao



On Mon, Feb 17, 2014 at 7:17 PM, Gabriele Brambilla [via matplotlib] 
ml-node+s1069221n42884...@n5.nabble.com wrote:

 Hi,
 I'm dealing with a guy that is colorblind.
 Have you got any suggestion on how could I show a plot like the one
 attached to him?
 Is there an option in pyplot that write little numbers near the curves
 instead of colors?

 thanks

 Gabriele

 --

 Managing the Performance of Cloud-Based Applications
 Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
 Read the Whitepaper.

 http://pubads.g.doubleclick.net/gampad/clk?id=121054471iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=42884i=0
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 *daltonic.png* (181K) Download 
 Attachmenthttp://matplotlib.1069221.n5.nabble.com/attachment/42884/0/daltonic.png


 --
  If you reply to this email, your message will be added to the discussion
 below:
 http://matplotlib.1069221.n5.nabble.com/colorbllind-problem-tp42884.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/colorbllind-problem-tp42884p42886.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] way to copy an axes object into different figures

2013-10-08 Thread ChaoYue
Hi Michael,

so finally how it goes? I may use something similar, do you finally make it?

cheers,

Chao



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/way-to-copy-an-axes-object-into-different-figures-tp41623p42203.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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


Re: [Matplotlib-users] Europe without coastline

2013-08-06 Thread ChaoYue
Hi,

I am using mat 1.20 and basemap 1.0.5, I tried your code and don't have the
same issue.

Chao

On Tue, Aug 6, 2013 at 9:33 AM, vwf [via matplotlib] 
ml-node+s1069221n41721...@n5.nabble.com wrote:


 Hello,

 This weekend I started using matplotlib and I think it is great.
 Beautiful graphs with very little effort.

 My data is geographical so I would like to draw on a map, North-Sea (UK
 - Netherlands). For this I installed the basemap on my Debian system
 (Stable/Wheezy). This has a strange problem. If I zoom out, all is
 there. If I start zooming in coastlines disappears. Is this my
 mistake, a problem in the packages in Debian, or something else?

 Thanks

 The resulting image on my system:
 http://img21.imageshack.us/img21/385/xoe7.png

 My system:
 Python 2.7.3 (default, Jan  2 2013, 16:53:07)
 [GCC 4.7.2] on linux2
  import matplotlib
  matplotlib.__version__
 '1.1.1rc2'

 My code:

 import numpy as np
 import matplotlib.pyplot as plt
 from mpl_toolkits.basemap import Basemap

 import matplotlib as mpl
 mpl.rcParams['font.size'] = 8.
 mpl.rcParams['font.family'] = 'Arial'
 mpl.rcParams['axes.labelsize'] = 5.
 mpl.rcParams['xtick.labelsize'] = 5.
 mpl.rcParams['ytick.labelsize'] = 5.

 #W-Europe
 x1 = -16.
 x2 = 30.
 y1 = 36.
 y2 = 62.

 m = Basemap(resolution='i',projection='merc',
 llcrnrlat=y1,urcrnrlat=y2,llcrnrlon=x1,urcrnrlon=x2,lat_ts=(x1+x2)/2)
 m.drawcountries(linewidth=0.5)
 m.drawcoastlines(linewidth=0.5)
 m.drawparallels(np.arange(y1,y2,2.),labels=[1,0,0,0],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2)

 m.drawmeridians(np.arange(x1,x2,2.),labels=[0,0,0,1],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2)


 plt.savefig('eur_101.png',dpi=100)
 plt.show()


 --

 Get your SQL database under version control now!
 Version control is standard for application code, but databases havent
 caught up. So what steps can you take to put your SQL databases under
 version control? Why should you start doing it? Read more to find out.
 http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=41721i=0
 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/Europe-without-coastline-tp41721.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Europe-without-coastline-tp41721p41722.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Change column number within legend

2013-08-04 Thread ChaoYue
could you use the bbox_to_anchor keyword to place your legend in a precise
way so that they could be alignd?
sorry ,this is the only way I could think of (But I am not a real expert in
matplotlib)

Chao

On Sun, Aug 4, 2013 at 5:45 PM, Tyrax [via matplotlib] 
ml-node+s1069221n41704...@n5.nabble.com wrote:

 Hi all,

 this is my first eMail to a mailing list, I hope I'm not messing it up. I
 posted my question already on stackoverflow, but apparently there's no
 simple solution to it:

 http://stackoverflow.com/questions/17909251/pyplot-change-ncols-within-a-legend

 In other words, I have a Figure with a many-entries-legend, but the legend
 text for most but not all of the object is very short. I'd like to use two
 or more columns for those short entries and switch back to single column
 mode when dealing with the longer legend entries.

 Two options came to my mind. One, make the legend work like a
 multicolumn-table in LaTeX or, two, having a container with multiple,
 well-aligned legends with individual properties for each one.

 I tried to solve my problem by setting up two legends. The downside is the
 need for additional aligning of the two legends. Even this is still beyond
 my skills.

 Thanks, Tyrax

 --

 Get your SQL database under version control now!
 Version control is standard for application code, but databases havent
 caught up. So what steps can you take to put your SQL databases under
 version control? Why should you start doing it? Read more to find out.
 http://pubads.g.doubleclick.net/gampad/clk?id=49501711iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=41704i=0
 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/Change-column-number-within-legend-tp41704.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Change-column-number-within-legend-tp41704p41706.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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

2013-07-27 Thread ChaoYue
Hi, thanks.

the attached is what I achieved so far. Looks quite nice.

each subplot visible now actually contains two mat.axes.Axes object (with
bottom and top spines invisible)
which is created by using the fig.add_axes, before the place occupied by
the two axes now is actually
only one single subplot ojbect, which is created by using fig,axs =
plt.subplots(2,3). something like this:

for ax in axs.flatten():
 #some way to find the position of the two new axes
 sub1 = fig.add_axes()
 sub2 = fig.add_axes()
 fig.delaxes(ax)

Now the problem is that all the original subplots have been removed,
replaced by 2X6 mat.axes.Axes,
But they don't respond to any operation in the interacitve window (like,
you can use your mouse to select
the left/righ/wspace etc)

I hope I am clear. thanks!

cheers,

Chao

On Fri, Jul 26, 2013 at 5:55 PM, Sterling Smith [via matplotlib] 
ml-node+s1069221n41615...@n5.nabble.com wrote:

 Chao,

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

 -Sterling

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

  Dear Sterling,
 
  thanks for your answer. The idea is that I would like to add a subplot
 with precise position, as in the method of fig.add_axes?
  Does fig.add_subplot support this, I tried
 fig.add_subplot(position=(0.2,0.2,0.1,0.1)) but it does not work...
 
  thanks!
 
  Chao
 
  On Thu, Jul 25, 2013 at 8:09 PM, Sterling Smith [via matplotlib]
 [hidden email] wrote:
  Chao,
 
  plt.subplots returns a figure instance.  Can you use the add_subplot
 method of that figure instance to make your new axes?  If so, then I think
 that they should respond to the new requests for left/right/bottom/wspace
 space.
 
  -Sterling
 
  On Jul 25, 2013, at 10:06AM, Chao YUE wrote:
 
   Dear all,
  
   First I make some subplots using the plt.subplots command,
   then I use mat.figure.Figure.delaxes to delete the axes, and add some
 small new ones
   in the same space by using mat.figure.Figure.add_axes, but I find
 after rendering the
   figure in the interative window, I cannot adjust the
 left/right/bottom/wspace etc in a
   interactive way, the old subplots that are generated using
 plt.subplots command will
   move, and the new ones generated using mat.figure.Figure.add_axes just
 don't
   move at all, so what should I do if I want the new ones also move?
 Because
   the interative window is really useful when you want to have figures
 quickly.
  
   thanks a lot for any hints.
  
   cheers,
  
   Chao
  
   --
  
 ***

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

  
 --

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

  See everything from the browser to the database with AppDynamics
  Get end-to-end visibility with application monitoring from AppDynamics
  Isolate bottlenecks and diagnose root cause in seconds.
  Start your free trial of AppDynamics Pro today!
 
 http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk
  ___
  Matplotlib-users mailing list
  [hidden email]
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
  If you reply to this email, your message will be added to the discussion
 below:
 
 http://matplotlib.1069221.n5.nabble.com/how-to-make-mat-figure-Figure-add-axes-generated-axes-adjustable-with-the-interactive-tool-tp41610p41611.html
  To start a new topic under matplotlib - users, email [hidden email]
  To unsubscribe from matplotlib, click here.
  NAML
 
 
 
  --
 
 ***

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

 
  View this message in context: Re: how to make mat.figure.Figure.add_axes
 generated axes

Re: [Matplotlib-users] how to make a colorbar starting with a different color?

2013-07-03 Thread ChaoYue
Thanks Ben. extendrect keyword is in mat 1.3, I didn't try this but I tried
set_under and extend='min'
with mat 1.2 and it works very nice.

cheers,

Chao

On Tue, Jul 2, 2013 at 4:14 PM, Benjamin Root-2 [via matplotlib] 
ml-node+s1069221n41364...@n5.nabble.com wrote:

 There is the set_over and set_under members of a colormap, and the
 plt.colorbar() function takes an extend='min' argument to add an extra
 color at the beginning of the colorbar. Setting extendrect=True, the
 added color will be rectangular instead of triangular.

 Hopefully that helps.

 Cheers,
 Ben Root



 On Tue, Jul 2, 2013 at 6:14 AM, Chao YUE [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41364i=0
  wrote:

 One way I could think of is to make two contingent mat.axes.Axes,
 with a smaller one setting as white backgroud, and the other bigger on
 holding the colorbar. Is there some better way?

 Chao


 On Tue, Jul 2, 2013 at 12:12 PM, Chao YUE [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41364i=1
  wrote:

 Dear all,

 Does anyone have similar experience that to make a colorbar
 starting from a different color in the colormap? for example, to
 denote the region with invalid data. I attahced a figure to show
 what I would like to have, the withe region in the colorbar in the
 attahced figure shows no data.

 thanks a lot for any help,

 best,

 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

 




 --

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

 


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

 Build for Windows Store.

 http://p.sf.net/sfu/windows-dev2dev
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=41364i=2
 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
 [hidden email] http://user/SendEmail.jtp?type=nodenode=41364i=3
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://matplotlib.1069221.n5.nabble.com/how-to-make-a-colorbar-starting-with-a-different-color-tp41362p41364.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/how-to-make-a-colorbar-starting-with-a-different-color-tp41362p41383.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
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] Is it possible to truncate axes in matplotlib?

2013-05-25 Thread ChaoYue
Is this what you want?

I change a bit of the code and put some example data there.


fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (6, 6) )

plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top = 0.95
, wspace = 0.07, hspace = 0.12)

left_ax, right_ax =
Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')

Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')

#left_ax.set_xlim(-0.05, 0.29)

#left_ax.set_xticks (np.arange (0, 0.3, 0.1))

#right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))

#right_ax.set_xlim(0.71, 1)

left_ax.plot(np.arange(10),'ro')
right_ax.plot(np.arange(10),'ro')
left_ax.set_xlim(0,10)
right_ax.set_xlim(0,10)
left_ax.set_ylim(0,15)
right_ax.set_ylim(0,40)

cheers,

Chao

On Sat, May 25, 2013 at 11:54 AM, mat [via matplotlib] 
ml-node+s1069221n4112...@n5.nabble.com wrote:

 Great!

 The code is almost finished:

 fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (11, 10) )

 plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top =
 0.95 , wspace = 0.07, hspace = 0.12)

 left_ax, right_ax =
 Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')

 Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')

 left_ax.set_xlim(-0.05, 0.29)

 left_ax.set_xticks (np.arange (0, 0.3, 0.1))

 right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))

 right_ax.set_xlim(0.71, 1)





  All what I need now is to manipulate the ylim of the truncated subplot
 (independently for the left and right y axes). plt.ylim(300, 500) only
 modifies the right yaxis of the truncated plot, not the left one. Is it
 possible to modify the left y axis of the truncated plot?






 2013/5/24 ChaoYue [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41129i=0
 

 Hi Mat,


 so you have two points in the TODO:
 #TODO:   #plot something on the left side of suplot 2 -- plt.plot(xx,yy,
 marker = 'o', color = 'k') does not work
  #change the y axis of suplot 2, on the right and on the left side

 the first one, is this what you want?
 left_ax.plot(xx,yy, marker = 'o', color = 'k')

 the second one, I don't get well, are you meaning something like:
 left_ax.set_ylim()?

 cheers,

 Chao

 On Fri, May 24, 2013 at 2:36 PM, mat [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41124i=0
  wrote:

 Hi Chao,

 Please find attached the script which includes your 3 functions, and a
 plot that I've just made. The things I can't manage to do are listed in the
 TODO section (end of the script)


 Cheers,
 Mat




 2013/5/24 ChaoYue [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41123i=0
 

  Hi, could you send an attachment to show what you've achieved so far?

 Chao

 --
  If you reply to this email, your message will be added to the
 discussion below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
  To unsubscribe from Is it possible to truncate axes in matplotlib?, click
 here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



 *truncated_plot.py* (11K) Download 
 Attachmenthttp://matplotlib.1069221.n5.nabble.com/attachment/41123/0/truncated_plot.py


 --
  If you reply to this email, your message will be added to the
 discussion below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41123.html
  To start a new topic under matplotlib - users, email [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41124i=1
 To unsubscribe from matplotlib, click here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




 --

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

 


 --
  If you reply to this email, your message will be added to the
 discussion below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41124.html
  To unsubscribe from Is it possible to truncate axes

Re: [Matplotlib-users] Is it possible to truncate axes in matplotlib?

2013-05-25 Thread ChaoYue
Hi Mat,

Just one words, the plt. functions probably normally pick the last
active axes to act on.
many of these functions are methods of axes object, you can call directly
from there.

Chao

On Sat, May 25, 2013 at 1:14 PM, mat [via matplotlib] 
ml-node+s1069221n41131...@n5.nabble.com wrote:

 Perfect!! Many thanks!


 2013/5/25 ChaoYue [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41131i=0
 

 Is this what you want?

 I change a bit of the code and put some example data there.


 fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (6, 6) )


 plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top =
 0.95 , wspace = 0.07, hspace = 0.12)

 left_ax, right_ax =
 Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')

 Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')

 #left_ax.set_xlim(-0.05, 0.29)

 #left_ax.set_xticks (np.arange (0, 0.3, 0.1))

 #right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))

 #right_ax.set_xlim(0.71, 1)

 left_ax.plot(np.arange(10),'ro')
 right_ax.plot(np.arange(10),'ro')
 left_ax.set_xlim(0,10)
 right_ax.set_xlim(0,10)
 left_ax.set_ylim(0,15)
 right_ax.set_ylim(0,40)

 cheers,

 Chao

 On Sat, May 25, 2013 at 11:54 AM, mat [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41130i=0
  wrote:

 Great!

 The code is almost finished:

 fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (11, 10) )

 plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top =
 0.95 , wspace = 0.07, hspace = 0.12)

 left_ax, right_ax =
 Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')

 Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')

 left_ax.set_xlim(-0.05, 0.29)

 left_ax.set_xticks (np.arange (0, 0.3, 0.1))

 right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))

 right_ax.set_xlim(0.71, 1)





  All what I need now is to manipulate the ylim of the truncated subplot
 (independently for the left and right y axes). plt.ylim(300, 500) only
 modifies the right yaxis of the truncated plot, not the left one. Is it
 possible to modify the left y axis of the truncated plot?






 2013/5/24 ChaoYue [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41129i=0
 

 Hi Mat,


 so you have two points in the TODO:
 #TODO:   #plot something on the left side of suplot 2 --
 plt.plot(xx,yy, marker = 'o', color = 'k') does not work
  #change the y axis of suplot 2, on the right and on the left
 side

 the first one, is this what you want?
 left_ax.plot(xx,yy, marker = 'o', color = 'k')

 the second one, I don't get well, are you meaning something like:
 left_ax.set_ylim()?

 cheers,

 Chao

 On Fri, May 24, 2013 at 2:36 PM, mat [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41124i=0
  wrote:

 Hi Chao,

 Please find attached the script which includes your 3 functions, and a
 plot that I've just made. The things I can't manage to do are listed in 
 the
 TODO section (end of the script)


 Cheers,
 Mat




 2013/5/24 ChaoYue [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41123i=0
 

  Hi, could you send an attachment to show what you've achieved so far?

 Chao

 --
  If you reply to this email, your message will be added to the
 discussion below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
  To unsubscribe from Is it possible to truncate axes in matplotlib?, 
 click
 here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



 *truncated_plot.py* (11K) Download 
 Attachmenthttp://matplotlib.1069221.n5.nabble.com/attachment/41123/0/truncated_plot.py


 --
  If you reply to this email, your message will be added to the
 discussion below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41123.html
  To start a new topic under matplotlib - users, email [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41124i=1
 To unsubscribe from matplotlib, click here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




 --

 ***
 Chao YUE
 Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
 UMR 1572

Re: [Matplotlib-users] Is it possible to truncate axes in matplotlib?

2013-05-24 Thread ChaoYue
Hi, could you send an attachment to show what you've achieved so far?

Chao



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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


Re: [Matplotlib-users] Is it possible to truncate axes in matplotlib?

2013-05-24 Thread ChaoYue
Hi Mat,

so you have two points in the TODO:
#TODO:   #plot something on the left side of suplot 2 -- plt.plot(xx,yy,
marker = 'o', color = 'k') does not work
 #change the y axis of suplot 2, on the right and on the left side

the first one, is this what you want?
left_ax.plot(xx,yy, marker = 'o', color = 'k')

the second one, I don't get well, are you meaning something like:
left_ax.set_ylim()?

cheers,

Chao

On Fri, May 24, 2013 at 2:36 PM, mat [via matplotlib] 
ml-node+s1069221n41123...@n5.nabble.com wrote:

 Hi Chao,

 Please find attached the script which includes your 3 functions, and a
 plot that I've just made. The things I can't manage to do are listed in the
 TODO section (end of the script)


 Cheers,
 Mat




 2013/5/24 ChaoYue [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41123i=0
 

 Hi, could you send an attachment to show what you've achieved so far?

 Chao

 --
  If you reply to this email, your message will be added to the
 discussion below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
  To unsubscribe from Is it possible to truncate axes in matplotlib?, click
 here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



 *truncated_plot.py* (11K) Download 
 Attachmenthttp://matplotlib.1069221.n5.nabble.com/attachment/41123/0/truncated_plot.py


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41123.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41124.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
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_may___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Making space for a long legend outside of a barchart

2013-05-23 Thread ChaoYue
Hi Martin,

I am not sure that I understand your question very well.

For a single scatter() plot, I guess I agree with you, you need to put it
in [] because
legend() function must receive iterable as far as I understand.

I don't think scatter() allows you to pass a series of group of (x,y) data
as plot().

So probably if you want to scatter more than one groups of data, you need
to:

handle_list = []
label_list = []
for (x,y) in zip(xdata_list, ydata_list):
 d = ax1.scatter(x,y)
 handle_list.append(x)
 label_list.append()

ax2.legend(handle_list,label_list,...)

This is what I could think of, perhaps others have better ways.

cheers,

Chao

On Thu, May 23, 2013 at 4:57 PM, Martin Mokrejs [via matplotlib] 
ml-node+s1069221n41114...@n5.nabble.com wrote:

 Hi Chao,
   I spent some time to figure out why I cannot replace ax1.hist() with
 ax1.scatter().
 It seems hist() returns list of 'Rectangle' (sadly if there is just one,
 it does return
 just the 'Rectangle' (not wrapped in a list) ... somewhere a trick

 a = [a, ]

 is likely needed.


 Anyway, my problem is that scatter() returns 'PathCollection' object,
 whatever that is.
 How can I grab handles to individual legend items to move them under ax2
 like in your
 hist-plot example?

 Thank you for your help,
 Martin


 ChaoYue wrote:

  Dear Martin,
 
  I worked out a similar example for your reference as I don't catch your
 example very well.
 
  fig = plt.figure()

  ax1 = fig.add_subplot(211)

  ax2 = fig.add_subplot(212)

  arrlist = [np.random.normal(size=100) for i in range(50)]

  ret = ax1.hist(arrlist,histtype='barstacked')

  reclist = [patchlist[0] for patchlist in ret[2]]

  labellist = ['data'+str(i) for i in range(50)]

  ax2.legend(reclist,labellist,loc='upper
 left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
  ax2.set_frame_on(False)

  ax2.tick_params(bottom='off',left='off',right='off',top='off')

  plt.setp(ax2.get_yticklabels(),visible=False)

  plt.setp(ax2.get_xticklabels(),visible=False)
 
 
  you're asking some object-oriented way, I personally don't think using
 pylab and set_tight_layout are the good way
  to be object-oriented as pylab is only a bounding wrapper by my
 understanding (maybe I am wrong!). legend and
  hist are all matplotlib.axes.Axes method.
 
  Also, I think it's unrealistic to ask the figure do a nice job for you
 if there are 50 legned handlers and you want to show
  them in 2 columns with a very high width/height ratio of the figure
 
  hope it could be of a bit help,
 
  cheers,
 
  Chao
 
 
  On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib]
 [hidden email] /user/SendEmail.jtp?type=nodenode=41102i=0 wrote:
 
  Hi Ben,
 
  Benjamin Root wrote:
 
  
  
  
   On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs [hidden email] 
 http://user/SendEmail.jtp?type=nodenode=41090i=0 mailto:[hidden
 email] http://user/SendEmail.jtp?type=nodenode=41090i=1 wrote:
  
   Hi,
 I am having trouble to get space allocated for a long legend
 text,
   lets say spanning 2/3 - 3/4 of the whole output. I would like
 to have
   stacked barchart as 1st subplot and the place of remaining 3
 subplots
   to be actually allocated by the legend. Alternatively, could I
 get the
   legend saved into a separate figure?
  
   Or could the space for legend text be allocated automatically
 minimizing
   output figure size? For example, the width would be 1120px
 while height
   be multiples of 840px (840 for each subplot)?
  
 Attached is a quick example. It shows also that I tried
 tight_layout()
   but wasn't successful with this either. I would be glad for
 some help,
   ideally converting the whole thing into an object-oriented
 approach.
   I am generating several figures in a row and would like to
 clear()/del()
   any previously used data ASAP.
  
  
   Thank you,
   Martin
   Am using mpl-1.2.2
  
  
   Try fig.savefig('foobar.png', bbox_inches='tight') when saving
 the
   image. It will make the figure size such that all the visible
   elements of the figure will fit into the saved output.
 tight_layout()
   is meant to make sure the elements don't overlap each other, but
 does
   nothing about making sure nothing gets clipped.
  Ah, would be nice to make this clear in the docs. So far was doing
 
 
  import pylab
  F = pylab.gcf()
  F.set_tight_layout(True)
 
  which as you say does not help the way I thought.
 
 
  Unfortunately, while
 
  fig.savefig('foobar.png', bbox_inches='tight')
 
  helped to get everything into the .png file (attached), the barchart
 itself
  should span according to the code I posted just 1/2 of the figure.
 But somehow
  it is enlarged and rescaled so that it occupies *more than* 1/2 of
 the figure

Re: [Matplotlib-users] Making space for a long legend outside of a barchart

2013-05-22 Thread ChaoYue
Hi Martin,

I don't know tight_layout quite well. Probably you could also split the
handlers of the barplot into
and 2 or 3 or 4 parts depending on the number, and then show them in
sperate axes?

then you create n+1 subplots for the whole figure?

probably this is quite stupid.

cheers,

Chao

On Wed, May 22, 2013 at 1:03 PM, Martin Mokrejs [via matplotlib] 
ml-node+s1069221n41104...@n5.nabble.com wrote:

 Hi Chao,

 ChaoYue wrote:
  Dear Martin,
 
  I worked out a similar example for your reference as I don't catch your
 example very well.

 I think you got the idea quite well.

 
  fig = plt.figure()

  ax1 = fig.add_subplot(211)

  ax2 = fig.add_subplot(212)

  arrlist = [np.random.normal(size=100) for i in range(50)]

  ret = ax1.hist(arrlist,histtype='barstacked')

  reclist = [patchlist[0] for patchlist in ret[2]]

  labellist = ['data'+str(i) for i in range(50)]

  ax2.legend(reclist,labellist,loc='upper
 left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
  ax2.set_frame_on(False)

  ax2.tick_params(bottom='off',left='off',right='off',top='off')

  plt.setp(ax2.get_yticklabels(),visible=False)

  plt.setp(ax2.get_xticklabels(),visible=False)
 

 I added plt.show() and it demonstrates my problem: the legend is not
 complete in the
 figure. That is why I think I could instead use:

 import pylab as plt
 import numpy as np

 fig = plt.figure()
 DefaultSize = tuple(fig.get_size_inches())
 fig.set_size_inches(DefaultSize[0], 4*DefaultSize[1])
 ax1 = fig.add_subplot(411)
 ax2 = fig.add_subplot(412)
 arrlist = [np.random.normal(size=100) for i in range(50)]
 ret = ax1.hist(arrlist,histtype='barstacked')
 reclist = [patchlist[0] for patchlist in ret[2]]
 labellist = ['data'+str(i) for i in range(50)]
 ax2.legend(reclist,labellist,loc='upper
 left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
 ax2.set_frame_on(False)
 ax2.tick_params(bottom='off',left='off',right='off',top='off')
 plt.setp(ax2.get_yticklabels(),visible=False)
 plt.setp(ax2.get_xticklabels(),visible=False)
 plt.show()

 But, this does not make the image 4* taller than I thought. But thank you
 for the example how to extract the legend of ax1 and place it under ax2.



 
  you're asking some object-oriented way, I personally don't think
  using pylab and set_tight_layout are the good way to be
  object-oriented as pylab is only a bounding wrapper by my
  understanding (maybe I am wrong!). legend and hist are all
  matplotlib.axes.Axes method.
 
  Also, I think it's unrealistic to ask the figure do a nice job for
  you if there are 50 legend handlers and you want to show them in 2
  columns with a very high width/height ratio of the figure

 The problem is that the data are calculated dynamically and sometimes
 I need to display data for 20 data types while sometimes for 200 data
 types (and for each I need a legend).

 I did not show that but I do calculate how many columns I could use
 legend display and pass that via pylab.legend(..., ncol= ). Of course
 at the same time I could calculate whether I will need 2 or 3 or 4
 subplots on the page (the first will be the barchart itself), the
 remaining space will be used by the long legend of subplot(211).
 I would hope that matplotlib does not mind that I actually issue any
 fig.add_subplot() foe the third or even fourth subplot at all. That
 would be just a trick to get more space for the legend. If I can live
 with just with subplot(211) and subplot(212)

 The fig.savefig('foobar.png', bbox_inches='tight') which Ben mentioned
 yesterday is nice but I want it to crop the image only vertically.
 An optional argument like:
 fig.savefig('foobar.png', bbox_inches='tight', keep_fig_width=True)
 would maybe do the job for me.


 What I still don't understand what is resizing the image in tight_layout.
 It doesn't seem to me that just the unused border space is chopped away.
 Fonts look different, ratio between x and y axes lengths seems different.
 Certainly not what I want.


  hope it could be of a bit help,

 Sure, I am still learning to use matplotlib.

 Martin

 
  cheers,
 
  Chao
 
 
  On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib]
 [hidden email] /user/SendEmail.jtp?type=nodenode=41102i=0 wrote:
 
  Hi Ben,
 
  Benjamin Root wrote:
 
  
  
  
   On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs [hidden email] 
 http://user/SendEmail.jtp?type=nodenode=41090i=0 mailto:[hidden
 email] http://user/SendEmail.jtp?type=nodenode=41090i=1 wrote:
  
   Hi,
 I am having trouble to get space allocated for a long legend
 text,
   lets say spanning 2/3 - 3/4 of the whole output. I would like
 to have
   stacked barchart as 1st subplot and the place of remaining 3
 subplots
   to be actually allocated by the legend. Alternatively, could I
 get the
   legend saved into a separate figure?
  
   Or could the space for legend text be allocated automatically

Re: [Matplotlib-users] Making space for a long legend outside of a barchart

2013-05-21 Thread ChaoYue
Dear Martin,

I worked out a similar example for your reference as I don't catch your
example very well.

fig =
plt.figure()
ax1 =
fig.add_subplot(211)
ax2 =
fig.add_subplot(212)
arrlist = [np.random.normal(size=100) for i in
range(50)]
ret =
ax1.hist(arrlist,histtype='barstacked')
reclist = [patchlist[0] for patchlist in
ret[2]]
labellist = ['data'+str(i) for i in
range(50)]
ax2.legend(reclist,labellist,loc='upper
left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
ax2.set_frame_on(False)

ax2.tick_params(bottom='off',left='off',right='off',top='off')

plt.setp(ax2.get_yticklabels(),visible=False)

plt.setp(ax2.get_xticklabels(),visible=False)


you're asking some object-oriented way, I personally don't think using
pylab and set_tight_layout are the good way
to be object-oriented as pylab is only a bounding wrapper by my
understanding (maybe I am wrong!). legend and
hist are all matplotlib.axes.Axes method.

Also, I think it's unrealistic to ask the figure do a nice job for you if
there are 50 legned handlers and you want to show
them in 2 columns with a very high width/height ratio of the figure

hope it could be of a bit help,

cheers,

Chao


On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib] 
ml-node+s1069221n41090...@n5.nabble.com wrote:

 Hi Ben,

 Benjamin Root wrote:

 
 
 
  On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=41090i=0mailto:[hidden
 email] http://user/SendEmail.jtp?type=nodenode=41090i=1 wrote:
 
  Hi,
I am having trouble to get space allocated for a long legend text,
  lets say spanning 2/3 - 3/4 of the whole output. I would like to
 have
  stacked barchart as 1st subplot and the place of remaining 3
 subplots
  to be actually allocated by the legend. Alternatively, could I get
 the
  legend saved into a separate figure?
 
  Or could the space for legend text be allocated automatically
 minimizing
  output figure size? For example, the width would be 1120px while
 height
  be multiples of 840px (840 for each subplot)?
 
Attached is a quick example. It shows also that I tried
 tight_layout()
  but wasn't successful with this either. I would be glad for some
 help,
  ideally converting the whole thing into an object-oriented approach.
  I am generating several figures in a row and would like to
 clear()/del()
  any previously used data ASAP.
 
 
  Thank you,
  Martin
  Am using mpl-1.2.2
 
 
  Try fig.savefig('foobar.png', bbox_inches='tight') when saving the
  image. It will make the figure size such that all the visible
  elements of the figure will fit into the saved output. tight_layout()
  is meant to make sure the elements don't overlap each other, but does
  nothing about making sure nothing gets clipped.
 Ah, would be nice to make this clear in the docs. So far was doing


 import pylab
 F = pylab.gcf()
 F.set_tight_layout(True)

 which as you say does not help the way I thought.


 Unfortunately, while

 fig.savefig('foobar.png', bbox_inches='tight')

 helped to get everything into the .png file (attached), the barchart
 itself
 should span according to the code I posted just 1/2 of the figure. But
 somehow
 it is enlarged and rescaled so that it occupies *more than* 1/2 of the
 figure.
 What in pylab is resizing my image? Note: the final image is 625x1075.

 Martin

 --

 AlienVault Unified Security Management (USM) platform delivers complete
 security visibility with the essential security capabilities. Easily and
 efficiently configure, manage, and operate all of your security controls
 from a single console and one unified framework. Download a free trial.
 http://p.sf.net/sfu/alienvault_d2d
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=41090i=2
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 *foobar.png* (132K) Download 
 Attachmenthttp://matplotlib.1069221.n5.nabble.com/attachment/41090/0/foobar.png


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41090.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 

Re: [Matplotlib-users] Is it possible to truncate axes in matplotlib?

2013-05-21 Thread ChaoYue
Hi Mat,

this has been asked before. see here:
http://matplotlib.1069221.n5.nabble.com/quot-zig-zag-quot-to-represent-suppressed-0-on-axis-td40849.html#a40858

cheers,

Chao

On Mon, May 20, 2013 at 8:29 PM, mat [via matplotlib] 
ml-node+s1069221n41092...@n5.nabble.com wrote:

 Dear community,

 I would like to truncate the x axis of a plot, as in the attached figure:

  Is it possible to do so ?

 Best,
 Mat

 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41103.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
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_may___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap plotting data on projection

2013-05-13 Thread ChaoYue
Dear Scott,

I am sorry for giving no reply. Thanks for your answer. I tried it and it
works fine.

best ,

Chao

On Tue, Apr 30, 2013 at 1:21 PM, Scott Sinclair-4 [via matplotlib] 
ml-node+s1069221n40977...@n5.nabble.com wrote:

 Forgot to send to the list sigh


 -- Forwarded message --
 From: Scott Sinclair [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=40977i=0

 Date: 30 April 2013 13:20
 Subject: Re: [Matplotlib-users] Basemap plotting data on projection
 To: ChaoYue [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=40977i=1



 On 29 April 2013 23:32, ChaoYue [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=40977i=2
 wrote:
  pdata = np.genfromtxt('pdata.txt')
  pdata = np.ma.masked_greater(pdata,1E20)
  lonm,latm=m.makegrid(pdata.shape[1],pdata.shape[0])

 The problem is here ^^^

 The data don't lie on an equally spaced grid in the Mercator
 projection, so it doesn't make sense to ask for the lat/lon
 coordinates of a grid that is equally spaced in this projection. You
 need to determine the *actual* lat/lon coordinates before projecting
 them onto the Mercator map and plotting...

 Something like this should work (If you can assume that the data are
 on an equally spaced grid in Equidistant Cyl projection having the
 boundaries specified):

 from mpl_toolkits.basemap import Basemap
 import matplotlib.pyplot as plt

 # Set up the Equidistant Cyl projection to determine data locations.
 pdata = np.genfromtxt('pdata.txt')
 pdata = np.ma.masked_greater(pdata, 1E20)
 ny, nx = pdata.shape

 cyl_basemap = Basemap(projection='cyl', llcrnrlat=9, urcrnrlat=54.5,
   llcrnrlon=74, urcrnrlon=142, lat_ts=20,
 resolution='l')
 lon, lat = cyl_basemap.makegrid(nx, ny)

 # Set up the Mercator projection for plotting.
 m = Basemap(projection='merc', llcrnrlat=9, urcrnrlat=54.5,\
 llcrnrlon=74, urcrnrlon=142, lat_ts=20, resolution='l')
 m.drawcountries()
 m.drawcoastlines()
 m.drawmapboundary(fill_color='white')
 m.drawrivers()

 x, y = m(lon, np.flipud(lat))
 cs = m.contourf(x, y, pdata)
 m.colorbar(cs)
 plt.show()

 Cheers,
 Scott

 --

 Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
 Get 100% visibility into your production application - at no cost.
 Code-level diagnostics for performance bottlenecks with 2% overhead
 Download for free and get started troubleshooting in minutes.
 http://p.sf.net/sfu/appdyn_d2d_ap1
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=40977i=3
 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/Basemap-plotting-data-on-projection-tp40973p40977.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Basemap-plotting-data-on-projection-tp40973p41044.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap plotting data on projection

2013-04-29 Thread ChaoYue
Hi all,

Indeed it's a bit strange, I can reproduce the problem. But when using
'cyl' projection I don't have this issue.
attahced two figures showed the difference.

the tested data is also attached.

complete code is below:

from mpl_toolkits.basemap import Basemap, cm, maskoceans
import matplotlib.pyplot as plt


# set up the Mercator projection
m = Basemap(projection='merc',llcrnrlat=9,urcrnrlat=54.5,\
llcrnrlon=74,urcrnrlon=142,lat_ts=20,resolution='l')

m.drawcountries()
m.drawcoastlines()
m.drawmapboundary(fill_color='aqua')
m.drawrivers()

pdata = np.genfromtxt('pdata.txt')
pdata = np.ma.masked_greater(pdata,1E20)
lonm,latm=m.makegrid(pdata.shape[1],pdata.shape[0])

latm=np.flipud(latm)
lonpro,latpro=m(lonm,latm)
cs = m.contourf(lonpro,latpro,pdata)
m.colorbar(cs)

cheers,

Chao

On Mon, Apr 29, 2013 at 12:53 PM, Ann [via matplotlib] 
ml-node+s1069221n40973...@n5.nabble.com wrote:

 Dear All,


 I am encountering the following problem:
 I have some data which I want to plot on a map. Unfortunately, I do not
 manage to plot the data according to the shape of the projection! What it
 appears to do is to simply plot the data on top of the projection without
 taking the actual position (latitude and longitude) into account. However,
 this is crucial for my analysis.
 Could anybody spot the mistake in my code?
 Any suggestion would be of great help!!
 THANKS



 from mpl_toolkits.basemap import Basemap, cm, maskoceans
 import matplotlib.pyplot as plt


 # set up the Mercator projection
 m = Basemap(projection='merc',llcrnrlat=9,urcrnrlat=54.5,\
 llcrnrlon=74,urcrnrlon=142,lat_ts=20,resolution='l')

 m.drawcountries()
 m.drawcoastlines()
 m.drawmapboundary(fill_color='aqua')
 m.drawrivers()


 parallels = N.arange(0.,81,10.)
 labels = [left,right,top,bottom]
 m.drawparallels(parallels,labels=[1,0,0,0])
 meridians = N.arange(10.,351.,20.)
 m.drawmeridians(meridians,labels=[0,0,0,1])


 ny=resmat.shape[0] # resmat is the matrix containing the data which I want
 o plot.
 nx=resmat.shape[1]

 #get lat/lons of ny by nx evenly space grid
 lons, lats =m.makegrid(nx, ny)


 # compute map projection coordinates
 x, y= m(lons, lats)

 maskdata = maskoceans(lons, lats, resmat, inlands= True, resolution = 'l')


 cs = m.contourf(x,y,maskdata,150,cmap=cm.GMT_no_green_r)

 plt.show()


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://matplotlib.1069221.n5.nabble.com/Basemap-plotting-data-on-projection-tp40973.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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



pdata.txt (413K) 
http://matplotlib.1069221.n5.nabble.com/attachment/40975/0/pdata.txt
cyl.jpg (540K) 
http://matplotlib.1069221.n5.nabble.com/attachment/40975/1/cyl.jpg
merc.jpg (435K) 
http://matplotlib.1069221.n5.nabble.com/attachment/40975/2/merc.jpg




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Basemap-plotting-data-on-projection-tp40973p40975.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
Try New Relic Now  We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app,  servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] basemap scatter

2013-04-12 Thread ChaoYue
I'm afraid the scatter plot does not allow afterward adjustment with size
currently (by using setp).
Probably you should redraw the scatter points with different sizes. like

for x,y,z in zip(xlist,ylist,sizelist):
 m.scatter(x,y,s=z)

if you question is to change the real 2km or 1.5km to the size on the map,
sorry I don't know as I never did this. Probably you need  consider
projection.

Chao


On Fri, Apr 12, 2013 at 4:33 PM, marz_cyclone [via matplotlib] 
ml-node+s1069221n40883...@n5.nabble.com wrote:

 Hi all,

 I'm trying to do a scatter plot within a map created by basemap.

 m = Basemap(projection='ortho',lat_0=45,lon_0=0,resolution='l')
 X,Y = m(lon,lat)
 m.scatter(X,Y,s=sizes,c=data,edgecolor='none')

 This works fine. Now I want to change the sizes of the markers so that the
 marker at point A has a size that corresponds to circle with radius of 2.5
 km, point B to 1.5 km,  and so on.

 Has anyone ever done this?

 Thanks in advance.

 Mario Mech


 --

 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
 [hidden email] http://user/SendEmail.jtp?type=nodenode=40883i=0
 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/basemap-scatter-tp40883.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/basemap-scatter-tp40883p40884.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
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 ChaoYue
Hi Kevin,

I don't check the link you provided very carefully. So I guess you already
find a solution.
otherwise I have done something similar before and have made a bit general
function to do
the job, which I think might be helpful for you.

You can check the following three functions at
https://github.com/ChaoYue/pylsce/blob/master/g.py

Calc_Newaxes_Fraction
Axes_Replace_Split_Axes
Axes_Set_Breakaxis

a working example is below:

 fig,axs = plt.subplots(nrows=2)
 bottom_ax, top_ax =
g.Axes_Replace_Split_Axes(fig,axs[0],split_fraction=[0.36,0.04,0.6],direction='v')
 g.Axes_Set_Breakaxis(bottom_ax, top_ax, 0.01,0.03,'v')
 left_ax, right_ax =
g.Axes_Replace_Split_Axes(fig,axs[1],split_fraction=[0.38,0.02,0.6],direction='h')
 g.Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')

the figure is as attached.

cheers,

chao



On Mon, Apr 8, 2013 at 9:05 PM, Kevin Hunter [via matplotlib] 
ml-node+s1069221n40857...@n5.nabble.com wrote:

 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.

 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
 [hidden email] http://user/SendEmail.jtp?type=nodenode=40857i=0
 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/zig-zag-to-represent-suppressed-0-on-axis-tp40849p40857.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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



break_axis.jpg (182K) 
http://matplotlib.1069221.n5.nabble.com/attachment/40858/0/break_axis.jpg




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/zig-zag-to-represent-suppressed-0-on-axis-tp40849p40858.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
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

Re: [Matplotlib-users] set limits not obeyed for stacked plots when set_aspect('equal') used

2013-03-20 Thread ChaoYue
Agree with Eric. I guess if you remove sharex=True, it will work.

Chao

On Wed, Mar 20, 2013 at 10:27 PM, Eric Firing [via matplotlib] 
ml-node+s1069221n40690...@n5.nabble.com wrote:

 On 2013/03/20 8:57 AM, Jonathan Slavin wrote:

  Hi all,
 
  I've run across a minor but annoying bug.  It can be demonstrated pretty
  simply:
 
  fig, ax = plt.subplots(2,1,sharex=True,figsize=(7.,7.))
  fig.subplots_adjust(hspace=0.0)
  x = 4.25*(np.arange(6.) - 2.5)/10.
  y =  0.6*x/max(x)
  ax[0].plot(x,y)
  ax[0].set_xlim(-1.2,1.2)
  ax[0].set_aspect('equal')
  ax[1].plot(x,y)
  ax[0].set_ylim(-0.6,0.6)
  ax[1].set_ylim(-0.6,0.6)
  ax[1].set_aspect('equal')
  plt.show()
 
  The problem is that the y limits on the two plots are slightly different
  from those set:

 I think the problem is that you are trying to specify too many things:
 you are specifying the box dimensions when you make the axes, then you
 are specifying xlim, and then you are specifying ylim, but then you are
 asking for a 1:1 aspect ratio.  Something has to give!  The aspect ratio
 handling is designed to provide the specified aspect ratio under a wide
 range of circumstances, including zooming and panning, and to do that,
 it has to be able to change something.  You can choose to let the box
 dimensions be changeable, or the data limits.

 If you want to fix the data limits, then you have to make the box
 adjustable.  This can cause problems with shared axes, but you can try
 it with ax[0].set_aspect('equal', adjustable='box-forced').

 Eric

  ax[1].get_ylim()
  (-0.61935483870967734, 0.61935483870967734)
  and doing a set_ylim doesn't have any effect.  This seems to be caused
  by the set_aspect('equal'), since removing it results in plots with the
  correct limits -- but aspect that is not quite equal.  It is affected by
  the figsize parameter in the call to subplots.  It seems I can get the
  correct y limits and aspect if I keep the set_aspect('equal') and fiddle
  with the figsize.  But that certainly doesn't seem to be a desirable
  behavior.  Ideally, the set_ylim (or set_xlim) would be respected as
  well as the apect ratio and extra blank space around the figure would be
  added as needed to fit the figsize.
 
  By the way, using no figsize argument to subplots results in y limits
  even smaller than the data limits.  Also, this problem does not occur
  for single (non-stacked) plots and the use of subplots_adjust also does
  not seem to affect the problem.  I'm using matplotlib 1.2.0
 
  I did notice that this issue is similar to that discussed in this
  thread:
  http://www.mail-archive.com/matplotlib-users@.../msg05783.htmlhttp://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg05783.html
 
  Regards,
  Jon
 


 --

 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_mar
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=40690i=0
 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/set-limits-not-obeyed-for-stacked-plots-when-set-aspect-equal-used-tp40689p40690.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/set-limits-not-obeyed-for-stacked-plots-when-set-aspect-equal-used-tp40689p40691.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___

Re: [Matplotlib-users] ticklabels

2013-03-14 Thread ChaoYue
it also works for me for 1.2.0
In [1]: mat.__version__
Out[1]: '1.2.0'

In [2]: plot(np.arange(5),'ro')
Out[2]: [matplotlib.lines.Line2D at 0xc88262c]

In [3]: ax = gca()

In [4]: ax.set_xticklabels('abcdefghij')
Out[4]: 
[matplotlib.text.Text at 0xbbb048c,
 matplotlib.text.Text at 0xbbb0c8c,
 matplotlib.text.Text at 0xc88780c,
 matplotlib.text.Text at 0xc887e2c,
 matplotlib.text.Text at 0xc88b4cc,
 matplotlib.text.Text at 0xc88bb4c,
 matplotlib.text.Text at 0xc8911ec,
 matplotlib.text.Text at 0xc89186c,
 matplotlib.text.Text at 0xc891eec]

In [5]: [t.get_text() for t in ax.get_xticklabels()]
Out[5]: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/ticklabels-tp40656p40663.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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


Re: [Matplotlib-users] Multiple XY plots

2013-02-20 Thread ChaoYue
Hi,

could you use a loop to solve it?

arr1list = [np.arange(10) + i for i in range(10)]
arr2list = [np.arange(10) -i for i in range(10)]

for arr1,arr2 in zip(arr1list,arr2list):
plot(arr1,arr2)

you can use a more object oriented way:

fig = plt.figure()
ax = fig.add_subplot()
for arr1,arr2 in zip(arr1list,arr2list):
ax.plot(arr1,arr2)

code not tested.

cheers,

Chao
On Thu, Feb 21, 2013 at 4:17 AM, lkz2366 [via matplotlib] 
ml-node+s1069221n40451...@n5.nabble.com wrote:

 I am confused on how to plot a variable number of XY plots on a single
 chart.  I want to superimpose XY plots on a single chart but the number of
 plots is unknown until runtime.
 For example, if I want to plot 4 plots the code would be:
 figure()
 plot(x1,y1,x2,y2,x3,y3,x4,y4)
 show()

 But the number of plots is variable and could be anywhere from 5-30.  Any
 ideas on how I can do this?
 I already have the rest of my program working. The program reads all of
 the data from all of the files in a target directory and writes the data to
 X and Y lists.
 Thanks for any help.

 --
  If you reply to this email, your message will be added to the discussion
 below:
 http://matplotlib.1069221.n5.nabble.com/Multiple-XY-plots-tp40451.html
  To start a new topic under matplotlib - users, email
 ml-node+s1069221n...@n5.nabble.com
 To unsubscribe from matplotlib, click 
 herehttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=2code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx
 .
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




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





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Multiple-XY-plots-tp40451p40453.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
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] open circles aren't showing up in the legend box

2013-01-03 Thread ChaoYue
I doubt there is a color called 'face',  according to documentation:

In [2]: setp(mat.collections.PathCollection,'edgecolor')
  edgecolor: matplotlib color arg or sequence of rgba tuples 

probably because matplotlib doesn't know how rend the color 'face'?

Chao



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/open-circles-aren-t-showing-up-in-the-legend-box-tp40136p40138.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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


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

2012-12-04 Thread ChaoYue
Hi, 

rather than the previous manual definition of the text postioins, I find a
more general/decent way:

yloc=(cbar.values-cbar.boundaries[0])/(cbar.boundaries[-1]-cbar.boundaries[0])
for l,y in zip(cbar_label,yloc):
cbar.ax.text(1,y,l,transform=cbar.ax.transAxes,ha='left',va='center')

Chao



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39941.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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


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

2012-11-16 Thread ChaoYue
I have a bit progress, but still not very well.

#to have a contourf plot
a = np.arange(100).reshape(10,10)
cbarlevel=np.arange(0,101,10)
contourf(a,levels=cbarlevel)
cbar = colorbar()
cbar.set_ticks(cbarlevel)

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

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

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

The generated figure is attached. But how can I put the labels a little bit
upward to make them parallel with the respective small rectangles in the
colorbar? http://matplotlib.1069221.n5.nabble.com/file/n39786/fig.jpg 





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39786.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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


Re: [Matplotlib-users] colormap shift

2012-11-10 Thread ChaoYue
Hi, I once was indicated a way to extract colors from exsiting colormaps:

I just answered a question on Stackoverflow and maybe you can have a look.

all code in pylab mode

a = np.arange(100).reshape(10,10)
#here is the image with white and black end
imshow(a,cmap=mat.cm.binary)
colorbar()

#we extract only the 0.2--0.7 part of original colormap and make a new one
#so that the white and black end are removed
rgba_array = mat.cm.binary(np.linspace(0,1,num=10,endpoint=True))
extract_rgba_array_255 = rgba_array[2:8,0:3]
imshow(a,cmap=mat.colors.ListedColormap(extract_rgba_array_255))
colorbar()

cheers,

Chao




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/colormap-shift-tp39660p39707.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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