Re: [Matplotlib-users] One colorbar for many plot

2014-05-20 Thread Alex Goodman
I would consider using the AxesGrid toolkit [1], which makes it very easy
to have a single colorbar for multiple plots.

[1] - http://matplotlib.org/1.3.1/mpl_toolkits/axes_grid/users/overview.html

Thanks,
Alex


On Tue, May 20, 2014 at 8:04 PM, Alex Goodman wrote:

> I would consider using the AxesGrid toolkit [1], which makes it very easy
> to have a single colorbar for multiple plots.
>
> [1] -
> http://matplotlib.org/1.3.1/mpl_toolkits/axes_grid/users/overview.html
>
> Thanks,
> Alex
>
>
> On Tue, May 20, 2014 at 7:57 PM, Dyah rahayu martiningrum <
> dyahr...@gmail.com> wrote:
>
>> I am a newbie in python and I try to plot data like below :
>>
>> base_dir = 'C:/DATA2013/Day_E/'
>> nc_fnames = ['20130203.faieb3p4g.nc', 
>> '20130203.faieb3p4g.nc','20130203.faieb3p4g.nc']
>> # beams
>> ibeams = [0,1,2]
>> # Change directory
>> os.chdir(base_dir)
>> for i, fname in enumerate(nc_fnames):
>>
>># Open file
>> fd = nc.Dataset(fname, 'r')
>>
>> # Read variables
>> beam = fd.variables['beam'][:]
>> rng = fd.variables['range'][:]
>> tim = fd.variables['time'][:]
>> pwr = fd.variables['pwr'][:]
>> nfft = fd.variables['nfft'][0]
>> pn = fd.variables['pnoise'][:]
>>
>> # Close netCDF file
>> fd.close()
>>
>> # Specify beam
>> ibeam = ibeams[i]
>>
>> # Time convertion
>> tim = tim/3600.0
>>
>> #Plot
>> p_plot = pwr[ibeam]
>>
>> for it in range(len(tim)):
>> p_plot[it] = p_plot[it] - pn[ibeam][it] - 10.*np.log10(nfft)
>>
>> p_plot = p_plot.transpose()
>> #Specify subplot
>> pl.subplot(311 + i)#Contour plot
>> pl.contourf(tim, rng, p_plot)#Plot colorbar
>> pl.colorbar()
>> # Set X and Y axis lower/upper limit
>> set_xy = range(4)
>> set_xy[0] = 18.0 # x min
>> set_xy[1] = 30.0 # x max
>> set_xy[2] = 90.0 # y min
>> set_xy[3] = 170.0 # y max
>> pl.axis(set_xy)
>> # Set labels
>> pl.xlabel('time (hours)')
>> pl.ylabel('range (km)')
>>
>> pl.show()
>>
>>
>> The result looks like three panels with different colorbar for each
>> panel. How do I make only one colorbar for all panels? Thank you in advance.
>>
>>
>> --
>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>> Instantly run your Selenium tests across 300+ browser/OS combos.
>> Get unparalleled scalability from the best Selenium testing platform
>> available
>> Simple to use. Nothing to install. Get started now for free."
>> http://p.sf.net/sfu/SauceLabs
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Alex Goodman
> Graduate Research Assistant
> Department of Atmospheric Science
> Colorado State University
>



-- 
Alex Goodman
Graduate Research Assistant
Department of Atmospheric Science
Colorado State University
--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] One colorbar for many plot

2014-05-20 Thread Dyah rahayu martiningrum
I am a newbie in python and I try to plot data like below :

base_dir = 'C:/DATA2013/Day_E/'
nc_fnames = ['20130203.faieb3p4g.nc',
'20130203.faieb3p4g.nc','20130203.faieb3p4g.nc']
# beams
ibeams = [0,1,2]
# Change directory
os.chdir(base_dir)
for i, fname in enumerate(nc_fnames):

   # Open file
fd = nc.Dataset(fname, 'r')

# Read variables
beam = fd.variables['beam'][:]
rng = fd.variables['range'][:]
tim = fd.variables['time'][:]
pwr = fd.variables['pwr'][:]
nfft = fd.variables['nfft'][0]
pn = fd.variables['pnoise'][:]

# Close netCDF file
fd.close()

# Specify beam
ibeam = ibeams[i]

# Time convertion
tim = tim/3600.0

#Plot
p_plot = pwr[ibeam]

for it in range(len(tim)):
p_plot[it] = p_plot[it] - pn[ibeam][it] - 10.*np.log10(nfft)

p_plot = p_plot.transpose()
#Specify subplot
pl.subplot(311 + i)#Contour plot
pl.contourf(tim, rng, p_plot)#Plot colorbar
pl.colorbar()
# Set X and Y axis lower/upper limit
set_xy = range(4)
set_xy[0] = 18.0 # x min
set_xy[1] = 30.0 # x max
set_xy[2] = 90.0 # y min
set_xy[3] = 170.0 # y max
pl.axis(set_xy)
# Set labels
pl.xlabel('time (hours)')
pl.ylabel('range (km)')

pl.show()


The result looks like three panels with different colorbar for each panel.
How do I make only one colorbar for all panels? Thank you in advance.
--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting with a custom color-vector

2014-05-20 Thread Sappy85
Hello,

I've created a map with matplotlib-Basemap and will have an animated gif by
drawing my special points / markers one by one in the plot. That work's
fine. 
Now the markers should have a special color from a generated color-vector.
In this vector are values from (0.0-1.0) for grey values.
The data-vector is as follows: index 0,1 the lat and lon information, index
2 the gray values.
/Problem/: Passing the color vector to the plot command, cause this error:
"*raise ValueError('third arg must be a format string')*"

This is the important part of my code:


Any ideas? Regards John



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Plotting-with-a-custom-color-vector-tp43429.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Basemap from proj4 string

2014-05-20 Thread Knut-Frode Dagestad

  Hi,

Is it possible to create a Basemap instance directly from a proj4 string and 
min/max values of the x and y coordinates?

Or is there a simple and safe way to construct Basemap input arguments/values 
from a general proj.4 string?

  --
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users