[Matplotlib-users] setting the default markerfacecolor
Hi, i am farily new to matplotlib so my question might be fairly basic. I would like to be able to set certain default values at the beginning of my script. The way i did this with the other values is via changing the value stored in rcparams. So something like: import matplotlib.pyplot as mpl mpl.rcParams['lines.markersize'] = 20 But i would like to set the markerfacecolor in such a way but it is not included in rcParams. I would really like to avoid setting it in each individual plot call. Is there a way to change the default at the start of the script? thanks matt -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] setting the default markerfacecolor
Hi Paul, thanks for the response. Emmhh, i am not sure what's going on since what you are saying matches what's listed at http://matplotlib.sourceforge.net/users/customizing.html. The problem is that when i try it I get a key error, correspondingly, when i print rcParams i cannot find axes.color_cycle key: So printing rcParams gives: print mpl.rcParams {'figure.subplot.right': 0.90002, 'mathtext.cal': 'cursive', 'font.fantasy': ['Comic Sans MS', 'Chicago', 'Charcoal', 'ImpactWestern', 'fantasy'], 'xtick.minor.pad': 4, 'tk.pythoninspect': False, 'image.aspect': 'equal', 'font.cursive': ['Apple Chancery', 'Textile', 'Zapf Chancery', 'Sand', 'cursive'], 'figure.subplot.hspace': 0.20001, 'xtick.direction': 'out', 'axes.facecolor': 'w', 'mathtext.fontset': 'cm', 'ytick.direction': 'out', 'svg.image_inline': True, 'lines.markersize': 10.0, 'figure.dpi': 80, 'text.usetex': True, 'text.fontangle': 'normal', 'patch.edgecolor': 'k', 'legend.labelspacing': 0.5, 'ps.useafm': False, 'mathtext.bf': 'serif:bold', 'lines.solid_joinstyle': 'round', 'font.monospace': ['Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed', 'Terminal', 'monospace'], 'xtick.minor.size': 2, 'axes.formatter.limits': [-7, 7], 'figure.subplot.wspace': 0.20001, 'savefig.edgecolor': 'w', 'text.fontvariant': 'normal', 'image.cmap': 'jet', 'axes.edgecolor': 'k', 'tk.window_focus': False, 'image.origin': 'upper', 'text.fontsize': 'medium', 'font.serif': ['Bitstream Vera Serif', 'DejaVu Serif', 'New Century Schoolbook', 'Century Schoolbook L', 'Utopia', 'ITC Bookman', 'Bookman', 'Nimbus Roman No9 L', 'Times New Roman', 'Times', 'Palatino', 'Charter', 'serif'], 'savefig.facecolor': 'w', 'maskedarray': 'obsolete', 'ytick.minor.size': 2, 'numerix': 'obsolete', 'font.stretch': 'normal', 'text.dvipnghack': None, 'ytick.color': 'k', 'lines.linestyle': '-', 'xtick.color': 'k', 'xtick.major.pad': 4, 'text.fontweight': 'normal', 'patch.facecolor': 'b', 'figure.figsize': [8.0, 6.0], 'axes.linewidth': 1.0, 'legend.handletextpad': 0.80004, 'mathtext.fallback_to_cm': True, 'lines.linewidth': 1.0, 'savefig.dpi': 100, 'verbose.fileo': 'sys.stdout', 'svg.image_noscale': False, 'docstring.hardcopy': False, 'font.size': 24.0, 'ps.fonttype': 3, 'path.simplify': True, 'polaraxes.grid': True, 'toolbar': 'toolbar2', 'pdf.compression': 6, 'grid.linewidth': 0.5, 'figure.autolayout': False, 'figure.facecolor': '0.75', 'ps.usedistiller': False, 'legend.isaxes': True, 'figure.edgecolor': 'w', 'mathtext.tt': 'monospace', 'contour.negative_linestyle': 'dashed', 'image.interpolation': 'bilinear', 'lines.markeredgewidth': 1.5, 'axes3d.grid': True, 'lines.marker': 'None', 'legend.shadow': False, 'axes.titlesize': 24.0, 'backend': 'TkAgg', 'xtick.major.size': 4, 'legend.fontsize': 24.0, 'lines.solid_capstyle': 'projecting', 'mathtext.it': 'serif:italic', 'font.variant': 'normal', 'xtick.labelsize': 'medium', 'axes.unicode_minus': True, 'ps.distiller.res': 6000, 'pdf.fonttype': 3, 'patch.linewidth': 1.0, 'pdf.inheritcolor': False, 'lines.dash_capstyle': 'butt', 'lines.color': 'b', 'text.latex.preview': False, 'figure.subplot.top': 0.90002, 'pdf.use14corefonts': False, 'legend.markerscale': 1.0,
[Matplotlib-users] it is possible to use basemap to create regular spaced lat/lon grids?
Hi, i want to interpolate irregular spaced satellite data onto a regular spaced grid. The regular spaced grid should have cell sizes of 1km^2. Is it possible to use basemap to create such a grid. It looked like it includes some facilities like that, but i am not sure if they are meant to be used by end user or more like internal fcns (the makegrid fcn for example). Any advice would be appreciated. thanks matt -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] it is possible to use basemap to create regular spaced lat/lon grids?
Hi Aman, thanks for your code. I am testing it right now, but i think this might what i need. Not sure if you know this: what is the difference between: 1) scipy.interpolate.griddata 2) matplotlib.mlab.griddata For 2) you have specify the interpolation method and i think the calling convention is different. Is one a wrapper for the other? thanks matt On 9/6/2011 12:36 PM, Aman Thakral wrote: > Hi Matt, > > Something like this?: > > def create_map(ax, llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat): > m = > Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=(urcrnrlon+llcrnrlon)/2,lat_0=(urcrnrlat+llcrnrlat)/2) > m.drawcoastlines() > m.drawmapboundary() > m.drawstates(linewidth=3) > m.fillcontinents(color='lightgrey',lake_color='white') > m.drawcountries(linewidth=3) > return m > > > def plotMapData(ax,data): > > lats = [] > lons = [] > val = [] > > for k,v in data.iteritems(): > lats.append(float(k[0])) > lons.append(float(k[1])) > val.append(float(v)) > > value = np.array(val) > lat = np.array(lats) > lon = np.array(lons) > > llcrnlon = lon.min()-0.5 > llcrnlat = lat.min()-0.5 > urcrnlon = lon.max()+0.5 > urcrnlat = lat.max()+0.5 > > xi = np.linspace(llcrnlon,urcrnlon,1000) > yi = np.linspace(llcrnlat,urcrnlat,1000) > zi = griddata(lon,lat,value,xi,yi) > > cmap = cm.jet > m = create_map(ax,llcrnlon,llcrnlat,urcrnlon,urcrnlat) > cs = ax.contour(xi,yi,zi,15,linewidth=0.5,cmap=cmap,alpha=0.5) > ax.contourf(xi,yi,zi,15,cmap=cmap,zorder=1000,alpha=0.5) > > colorscale = cm.ScalarMappable() > colorscale.set_array(value) > colorscale.set_cmap(cmap) > > colors = colorscale.to_rgba(value) > ax.scatter(lon,lat,c=colors,zorder=1000,cmap=cmap,s=10) > colorbar(colorscale, shrink=0.50, ax=ax,extend='both') > > > On Tue, Sep 6, 2011 at 1:28 PM, Matt Funk <mailto:matze...@gmail.com>> wrote: > > Hi, > i want to interpolate irregular spaced satellite data onto a regular > spaced grid. The regular spaced grid should have cell sizes of > 1km^2. Is > it possible to use basemap to create such a grid. It looked like it > includes some facilities like that, but i am not sure if they are > meant > to be used by end user or more like internal fcns (the makegrid > fcn for > example). > > Any advice would be appreciated. > > thanks > matt > > > -- > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Matt Funk Research Associate Plant and Environmental Scienc. Dept. New Mexico State University -- Malware Security Report: Protecting Your Business, Customers, and the Bottom Line. Protect your business and customers by understanding the threat from malware and how it can impact your online business. http://www.accelacomm.com/jaw/sfnl/114/51427462/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] it is possible to use basemap to create regular spaced lat/lon grids?
Hi, sorry that it has taken me so long to reply. Anyway, i could be wrong, but i don't think that the code: xi = np.linspace(llcrnlon,urcrnlon,1000) yi = np.linspace(llcrnlat,urcrnlat,1000) will produce a grid which gives the lat/lon coordinates with 1km spacing. The reason being is that the distance between 2 lons (say -117.731659 and -91.303642) is different depending on where you are in terms of the latitude (i.e. the extreme examples are of course the north pole vs the equator). So the above gives a regular grid in terms of degrees but not in terms of distance. Anyway, but the example was still helpful in terms of getting me started with the griddata issue. In my experience the mlab.griddate fcn did not work as well as the scipy.griddata (but that could be a user error as well ... ). Not sure why though. It might be the size of my source data and the destination grid. I had to upgrade to the 64-bit python to be able to access enough memory. thanks matt On 9/6/2011 12:36 PM, Aman Thakral wrote: > Hi Matt, > > Something like this?: > > def create_map(ax, llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat): > m = > Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=(urcrnrlon+llcrnrlon)/2,lat_0=(urcrnrlat+llcrnrlat)/2) > m.drawcoastlines() > m.drawmapboundary() > m.drawstates(linewidth=3) > m.fillcontinents(color='lightgrey',lake_color='white') > m.drawcountries(linewidth=3) > return m > > > def plotMapData(ax,data): > > lats = [] > lons = [] > val = [] > > for k,v in data.iteritems(): > lats.append(float(k[0])) > lons.append(float(k[1])) > val.append(float(v)) > > value = np.array(val) > lat = np.array(lats) > lon = np.array(lons) > > llcrnlon = lon.min()-0.5 > llcrnlat = lat.min()-0.5 > urcrnlon = lon.max()+0.5 > urcrnlat = lat.max()+0.5 > > xi = np.linspace(llcrnlon,urcrnlon,1000) > yi = np.linspace(llcrnlat,urcrnlat,1000) > zi = griddata(lon,lat,value,xi,yi) > > cmap = cm.jet > m = create_map(ax,llcrnlon,llcrnlat,urcrnlon,urcrnlat) > cs = ax.contour(xi,yi,zi,15,linewidth=0.5,cmap=cmap,alpha=0.5) > ax.contourf(xi,yi,zi,15,cmap=cmap,zorder=1000,alpha=0.5) > > colorscale = cm.ScalarMappable() > colorscale.set_array(value) > colorscale.set_cmap(cmap) > > colors = colorscale.to_rgba(value) > ax.scatter(lon,lat,c=colors,zorder=1000,cmap=cmap,s=10) > colorbar(colorscale, shrink=0.50, ax=ax,extend='both') > > > On Tue, Sep 6, 2011 at 1:28 PM, Matt Funk <mailto:matze...@gmail.com>> wrote: > > Hi, > i want to interpolate irregular spaced satellite data onto a regular > spaced grid. The regular spaced grid should have cell sizes of > 1km^2. Is > it possible to use basemap to create such a grid. It looked like it > includes some facilities like that, but i am not sure if they are > meant > to be used by end user or more like internal fcns (the makegrid > fcn for > example). > > Any advice would be appreciated. > > thanks > matt > > > -- > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Matt Funk Research Associate Plant and Environmental Scienc. Dept. New Mexico State University -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] it is possible to use basemap to create regular spaced lat/lon grids?
On 9/9/2011 6:42 AM, Scott Sinclair wrote: > On 8 September 2011 19:20, Matt Funk wrote: >> Hi, >> sorry that it has taken me so long to reply. Anyway, i could be wrong, but i >> don't think that the code: >> xi = np.linspace(llcrnlon,urcrnlon,1000) >> yi = np.linspace(llcrnlat,urcrnlat,1000) >> >> will produce a grid which gives the lat/lon coordinates with 1km spacing. >> The reason being is that the distance between 2 lons (say -117.731659 and >> -91.303642) is different depending on where you are in terms of the latitude >> (i.e. the extreme examples are of course the north pole vs the equator). So >> the above gives a regular grid in terms of degrees but not in terms of >> distance. > Yes, that's correct. You'll need to project your original data > locations into a cartesian co-ordinate system before interpolating > their values onto a regular grid in that co-ordinate system using > griddata et al. > > You might like to use pyproj (included with the basemap toolkit) to > help you project from lat/lon to your chosen co-ordinate system.. I have been using gdal for many of my geographic needs. Is there an advantage/disadvantage using pyproj vs capabilities found in gdal (from what i understand both are based on PROJ.4)? Can you comment on this? Also, i was thinking of projecting things to UTM for interpolation purposes. Is there any apparent reason this is a bad idea vs a different projected coordinate system? matt > > Cheers, > Scott > > -- > Why Cloud-Based Security and Archiving Make Sense > Osterman Research conducted this study that outlines how and why cloud > computing security and archiving is rapidly being adopted across the IT > space for its ease of implementation, lower cost, and increased > reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Matt Funk Research Associate Plant and Environmental Scienc. Dept. New Mexico State University -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users