Re: Matplotlib Contour Plots

2014-08-20 Thread Jamie Mitchell
On Tuesday, August 19, 2014 10:21:48 PM UTC+1, pec...@pascolo.net wrote: Jamie Mitchell jamiemitchell1...@gmail.com writes: You were right Christian I wanted a shape (2,150). Thank you Rustom and Steven your suggestion has worked. Unfortunately the data doesn't plot as I

Re: Matplotlib Contour Plots

2014-08-19 Thread Jamie Mitchell
You were right Christian I wanted a shape (2,150). Thank you Rustom and Steven your suggestion has worked. Unfortunately the data doesn't plot as I imagined. What I would like is: X-axis - hs_con_sw Y-axis - te_con_sw Z-axis - Frequency What I would like is for the Z-axis to contour the

Re: Matplotlib Contour Plots

2014-08-18 Thread Jamie Mitchell
On Friday, August 15, 2014 4:13:26 PM UTC+1, Steven D'Aprano wrote: Jamie Mitchell wrote: I created the 2D array which read as: That's not a 2D array. When the amount of data you have is too big to clearly see what it happening, replace it with something smaller. Instead

Re: Matplotlib Contour Plots

2014-08-18 Thread Jamie Mitchell
I forgot to mention that when I try: a=np.array([[hs_con_sw],[te_con_sw]]) I get a 3D shape for some reason - (2,1,150) which is not what I'm after. Thanks, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib Contour Plots

2014-08-15 Thread Jamie Mitchell
On Thursday, August 14, 2014 5:53:09 PM UTC+1, Steven D'Aprano wrote: Jamie Mitchell wrote: Hello all, I want to contour a scatter plot but I don't know how. Can anyone help me out? Certainly. Which way did you come in? :-) Sorry, I couldn't resist

Re: Matplotlib Contour Plots

2014-08-15 Thread Jamie Mitchell
On Friday, August 15, 2014 2:23:25 PM UTC+1, Steven D'Aprano wrote: Jamie Mitchell wrote: [...] I just want to get a contour plot of two numpy arrays. When I call plt.contour on my data I get input must be a 2D array You are providing a 1D array, or possibly a 3D array. So

Matplotlib Contour Plots

2014-08-14 Thread Jamie Mitchell
Hello all, I want to contour a scatter plot but I don't know how. Can anyone help me out? Cheers, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Contouring a 2D histogram

2014-06-27 Thread Jamie Mitchell
Hi all, I have plotted a 2D histogram like so: python2.7 import netCDF4 import iris import iris.palette import numpy as np import matplotlib as mpl import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt from matplotlib.colors import from_levels_and_colors

Matplotlib Colouring outline of histogram

2014-06-20 Thread Jamie Mitchell
Hi folks, Instead of colouring the entire bar of a histogram i.e. filling it, I would like to colour just the outline of the histogram. Does anyone know how to do this? Version - Python2.7 Cheers, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
Hi folks, I'm trying to plot a 2D histogram but I'm having some issues: from pylab import * import numpy as np import netCDF4 hist,xedges,yedges=np.histogram2d(x,y,bins=10) extent=[xedges[0],xedges[-1],yedges[0],yedges[-1]] imshow(hist.T,extent=extent,interpolation='nearest') colorbar() show()

Re: Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 10:25:44 AM UTC+1, Peter Otten wrote: Jamie Mitchell wrote: Hi folks, I'm trying to plot a 2D histogram but I'm having some issues: from pylab import * import numpy as np import netCDF4 hist,xedges,yedges=np.histogram2d(x,y,bins=10

Re: Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 12:00:15 PM UTC+1, Peter Otten wrote: Jamie Mitchell wrote: I have changed my x and y data to float64 types but I am still getting the same error message? Please double-check by adding assert x.dtype == np.float64 assert y.dtype == np.float64

Re: Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 9:46:29 AM UTC+1, Jamie Mitchell wrote: Hi folks, I'm trying to plot a 2D histogram but I'm having some issues: from pylab import * import numpy as np import netCDF4 hist,xedges,yedges=np.histogram2d(x,y,bins=10) extent=[xedges[0],xedges[-1],yedges[0

Re: Matplotlib Colouring outline of histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 2:47:03 PM UTC+1, Jason Swails wrote: On Fri, Jun 20, 2014 at 4:10 AM, Jamie Mitchell jamiemit...@gmail.com wrote: Hi folks, Instead of colouring the entire bar of a histogram i.e. filling it, I would like to colour just the outline of the histogram. Does

Re: Matplotlib Colouring outline of histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 9:10:58 AM UTC+1, Jamie Mitchell wrote: Hi folks, Instead of colouring the entire bar of a histogram i.e. filling it, I would like to colour just the outline of the histogram. Does anyone know how to do this? Version - Python2.7 Cheers, Jamie

Re: Matplotlib - specifying bin widths

2014-06-06 Thread Jamie Mitchell
On Thursday, June 5, 2014 4:54:16 PM UTC+1, Jamie Mitchell wrote: Hello all! Instead of setting the number of bins I want to set the bin width. I would like my bins to go from 1.7 to 2.4 in steps of 0.05. How do I say this in the code? Cheers, Jamie That's

Overlaying a boxplot onto a time series figure

2014-06-06 Thread Jamie Mitchell
Hi there, I would like to overlay some boxplots onto a time series. I have tried pylab.hold(True) in between the two plots in my code but this hasn't worked. The problem is that the x-axes of the boxplots and the time series are not the same. Code for time series: python2.7 import netCDF4

Matplotlib - specifying bin widths

2014-06-05 Thread Jamie Mitchell
Hello all! Instead of setting the number of bins I want to set the bin width. I would like my bins to go from 1.7 to 2.4 in steps of 0.05. How do I say this in the code? Cheers, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Re: Adding R squared value to scatter plot

2014-06-05 Thread Jamie Mitchell
On Wednesday, May 21, 2014 1:30:16 PM UTC+1, Jason Swails wrote: On Wed, May 21, 2014 at 7:59 AM, Jamie Mitchell jamiemit...@gmail.com wrote: I have made a plot using the following code: python2.7 import netCDF4 import matplotlib.pyplot as plt import numpy as np

Adding R squared value to scatter plot

2014-05-21 Thread Jamie Mitchell
I have made a plot using the following code: python2.7 import netCDF4 import matplotlib.pyplot as plt import numpy as np swh_Q0_con_sw=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swest_annavg1D.nc','r') hs_Q0_con_sw=swh_Q0_con_sw.variables['hs'][:]

Saving a file as netCDF4 in Python

2014-05-08 Thread Jamie Mitchell
Dear all, Apologies as this sounds like a very simple question but I can't find an answer anywhere. I have loaded a netCDF4 file into python as follows: swh=netCDF4.Dataset('path/to/netCDFfile,'r') I then isolate the variables I wish to plot: hs=swh.variables['hs']

len() of unsized object - ks test

2014-04-25 Thread Jamie Mitchell
Hello all, I am trying to perform a Kolmogorov-Smirnov test in Python but I'm having a few difficulties. # My files are netCDF so I import them as follows: control=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swest_concatannavg_1D.nc','r') # The string is

Re: len() of unsized object - ks test

2014-04-25 Thread Jamie Mitchell
On Friday, April 25, 2014 3:07:54 PM UTC+1, Jamie Mitchell wrote: Hello all, I am trying to perform a Kolmogorov-Smirnov test in Python but I'm having a few difficulties. # My files are netCDF so I import them as follows: control=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh

Line of best fit

2014-03-31 Thread Jamie Mitchell
I am new to python so apologies for the ignorance with this question. How would I apply a line of best fit to a plot? My data are netCDF4 data files and this is essentially what I have done so far: swh1=netCDF4.Dataset('filename','r') hs1=swh1.variables['hs']

Memory error

2014-03-24 Thread Jamie Mitchell
Hello all, I'm afraid I am new to all this so bear with me... I am looking to find the statistical significance between two large netCDF data sets. Firstly I've loaded the two files into python: swh=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/averages/swh_control_concat.nc',

Re: Memory error

2014-03-24 Thread Jamie Mitchell
On Monday, March 24, 2014 11:32:31 AM UTC, Jamie Mitchell wrote: Hello all, I'm afraid I am new to all this so bear with me... I am looking to find the statistical significance between two large netCDF data sets. Firstly I've loaded the two files into python: swh