SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(8)
2
(4)
3
(2)
4
(9)
5
(7)
6
(3)
7
(6)
8
(5)
9
(2)
10
(7)
11
(3)
12
(9)
13
(2)
14
(1)
15
(2)
16
(2)
17
(5)
18
(5)
19
(8)
20
(3)
21
(1)
22
(6)
23
(3)
24
(3)
25
(2)
26
(16)
27
(1)
28
(1)
29
(2)
30
(5)




Showing 5 results of 5

From: Francesco M. <fra...@gm...> - 2013年04月08日 21:00:58
Il giorno 08/apr/2013 21:05, "Kevin Hunter Kesling" <kmh...@nc...> ha
scritto:
>
> At 4:20pm -0400 2013年4月07日, Francesco Montesano wrote:
>>
>> Il giorno 07/apr/2013 21:03, Kevin Hunter Kesling ha scritto:
>>
>>> On the other hand, I'm still such a noob at Matplotlib ... is there
>>> a way to have one of the subplots take up more than its default 50%
>>> allotment?
>>
>>
>> you can give a look at the last two plots in this example
>> http://matplotlib.org/examples/pylab_examples/demo_tight_layout.html or
use
>> plot.axes providing the rectangle that you want
>
>
> That is closer to what I want, but still not there. I was finally able
to find something that fit the bill to 95% of what I want:
>
>
http://matplotlib.1069221.n5.nabble.com/Proposal-for-Broken-Axes-td38050.html
>
> The first post by 'klukas' does exactly what I asked for. It's a zig-zag
on the Y-axis to show that what is graphed is not continuous, and unlike
the various "official" examples, the zig-zag placement is user-specifiable,
as opposed to exactly halfway between the top and bottom.
>
> The only thing I have yet to figure out how to do is to simultaneously
have a zig-zag on the X axis as well -- an artifact of how these zig-zags
must be created via multiple axes on the same figure, rather than as built
in to the axis artist.
>
> For googleability:
>
> The above linked graph code enables for matplotlib:
>
> - suppressed zeros on the Y-axis of an XY plot
> - showing suppressed data on the Y-axis
> - lightning bolt symbol on the Y-axis
> - zig-zag on the Y-axis
> - a "broken" Y-axis
>
> Thanks for your pointers, Francesco, as they helped me to fine-tune my
Google search terms. And thank you, Klukas, whoever you are.
>
I'm half that you found the solution for your problem and to have been
useful just providing links. This has been one of the easiest answer I have
ever given :)
And mostly thanks for sharing your findings.
cheers and good night,
Fra
> Cheers,
>
> Kevin
From: ChaoYue <cha...@gm...> - 2013年04月08日 20:55:43
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-...@n5...> wrote:
> At 4:20pm -0400 2013年4月07日, 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=node&node=40857&i=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-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=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.
From: Kevin H. K. <kmh...@nc...> - 2013年04月08日 19:05:12
At 4:20pm -0400 2013年4月07日, 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
From: Eric F. <ef...@ha...> - 2013年04月08日 17:38:42
On 2013年04月08日 4:13 AM, epi wrote:
> Hi All,
>
> i'm new to basemap, truing to learn how to plot vector from a netcdf file
>
> the variables in my file are :
>
> - time
> - Significant_height_of_combined_wind_waves_and_swell_surface
> - u-component_of_wind_surface
> - v-component_of_wind_surface
>
> this is my code, the pcolormesh is fine
>
> ####
>
> import netCDF4
> import datetime as dt
>
> import numpy as np
> import numpy.ma as ma
> from datetime import date, datetime, timedelta
>
> from mpl_toolkits.basemap import Basemap
>
>
>
> url='http://geoport.whoi.edu/thredds/dodsC/fmrc/NCEP/ww3/cfsr/4m/best'
> #url = 'http://geoport.whoi.edu/thredds/dodsC/fmrc/NCEP/ww3/cfsr/10m/best'
> nc = netCDF4.Dataset(url)
> #nc.variables.keys()
>
>
> time_var = nc.variables[str('time')]
> wave_var = nc.variables['Significant_height_of_combined_wind_waves_and_swell_surface']
> date = datetime(1991,11,1,12)
> istart = netCDF4.date2index(date,time_var,select='nearest')
> lat = nc.variables['lat'][:]
> lon = nc.variables['lon'][:]
> uin = nc.variables['u-component_of_wind_surface'][istart,:,:]
> vin = nc.variables['v-component_of_wind_surface'][istart,:,:]
> var = wave_var[istart,:,:]
> wave = ma.masked_where(np.isnan(var),var)
>
>
> m = Basemap(llcrnrlon=-71.5,llcrnrlat=39.5,urcrnrlon=-63.0,urcrnrlat=46.0,\
> lat_0=20.,lon_0=-60.,lat_ts=20.)
>
>
> lons, lats = np.meshgrid(lon,lat)
> x, y = m(lons, lats)
>
>
> m.pcolormesh(lon[:], lat[:], wave, vmin=0, vmax=3);
> m.quiver(x, y, uin, vin);
Try something like this:
m.quiver(x[::5,::5], y[::5,::5], uin[::5,::5], vin[::5,::5], scale=200);
You can use the scale and the scale_units kwargs to control the arrow 
lengths. Quiver plots don't work visually when there are too many 
arrows, so given the scale of your plot, you need to subsample the wind 
vectors as illustrated.
Eric
>
>
> ####
>
> .. but the vector plot in overlay doesn't render what i'm looking for .. obviously my fault in the code
> thank you for your precious help!
>
>
> ------------------------------------------------------------------------------
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: epi <mas...@gm...> - 2013年04月08日 14:13:30
Hi All,
i'm new to basemap, truing to learn how to plot vector from a netcdf file
the variables in my file are :
- time
- Significant_height_of_combined_wind_waves_and_swell_surface
- u-component_of_wind_surface
- v-component_of_wind_surface
this is my code, the pcolormesh is fine 
####
import netCDF4
import datetime as dt
import numpy as np
import numpy.ma as ma
from datetime import date, datetime, timedelta
 
from mpl_toolkits.basemap import Basemap
url='http://geoport.whoi.edu/thredds/dodsC/fmrc/NCEP/ww3/cfsr/4m/best'
#url = 'http://geoport.whoi.edu/thredds/dodsC/fmrc/NCEP/ww3/cfsr/10m/best'
nc = netCDF4.Dataset(url)
#nc.variables.keys()
time_var = nc.variables[str('time')]
wave_var = nc.variables['Significant_height_of_combined_wind_waves_and_swell_surface']
date = datetime(1991,11,1,12)
istart = netCDF4.date2index(date,time_var,select='nearest')
lat = nc.variables['lat'][:]
lon = nc.variables['lon'][:]
uin = nc.variables['u-component_of_wind_surface'][istart,:,:]
vin = nc.variables['v-component_of_wind_surface'][istart,:,:]
var = wave_var[istart,:,:]
wave = ma.masked_where(np.isnan(var),var)
m = Basemap(llcrnrlon=-71.5,llcrnrlat=39.5,urcrnrlon=-63.0,urcrnrlat=46.0,\
 lat_0=20.,lon_0=-60.,lat_ts=20.)
lons, lats = np.meshgrid(lon,lat)
x, y = m(lons, lats)
m.pcolormesh(lon[:], lat[:], wave, vmin=0, vmax=3);
m.quiver(x, y, uin, vin);
####
.. but the vector plot in overlay doesn't render what i'm looking for .. obviously my fault in the code
thank you for your precious help!

Showing 5 results of 5

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /