On 2012/07/26 7:52 PM, Jeffrey Spencer wrote:
I am trying to make a plot with a colorbar that has a reduced axis over
which the colorbar is executed.
This is set via passing in a norm to contourf:
logNorm = colors.Normalize(vmax=0,vmin=-100)
surf = ax.contourf(X,Y,logZ,
Further after doing a little digging the code in
matplotlib.colorbar.Colorbar looks correct to me but doesn't work correctly.
It essentially ignores the norm value because always sets the norm to the
norm for the contour plot (eg. mappable.norm) which this is the same norm
with vmin and vmax
I am using 1.2.X and here is a minimalist example to see what happens:
Link to figure of output:
https://dl.dropbox.com/u/13534143/example.png
Example:
import numpy as np
import matplotlib as mpl
X, Y = np.meshgrid(arange(20),arange(20))
Z = np.arange(20*20)
Z = Z.reshape(20,20)
logNorm =
On 2012/07/26 9:20 PM, Jeffrey Spencer wrote:
import numpy as np
import matplotlib as mpl
X, Y = np.meshgrid(arange(20),arange(20))
Z = np.arange(20*20)
Z = Z.reshape(20,20)
logNorm = mpl.colors.Normalize(vmin=0,vmax=200)
fig = mpl.pyplot.figure(10)
ax = fig.add_subplot(111)
surf =
Hi,
I'd like to place something like a 'title' inside a legend's box. In my
specific case, I have a legend with 5 entries, arranged in 5 columns, so
they're horizontally next to each other in one row. Now what I'd like to
have is inside the legend's box a first row (above the legend entries),
On Thu, Jul 26, 2012 at 06:05:39PM +0200, Andreas Hilboll wrote:
Hi Andreas,
2012/7/26 Andreas Hilboll li...@hilboll.de:
Hi,
I would like to create a figure which only contains a legend, and no
axes
at all. I would like to manually assign the colors. I found this
here:
Hi Andreas,
2012/7/27 Andreas Hilboll li...@hilboll.de:
Hi,
I'd like to place something like a 'title' inside a legend's box. In my
specific case, I have a legend with 5 entries, arranged in 5 columns, so
they're horizontally next to each other in one row. Now what I'd like to
have is
Hi Andreas,
2012/7/27 Andreas Hilboll li...@hilboll.de:
Hi,
I'd like to place something like a 'title' inside a legend's box. In my
specific case, I have a legend with 5 entries, arranged in 5 columns, so
they're horizontally next to each other in one row. Now what I'd like to
have is
Hi Andreas,
2012/7/27 Andreas Hilboll li...@hilboll.de:
Hi Andreas,
2012/7/27 Andreas Hilboll li...@hilboll.de:
Hi,
I'd like to place something like a 'title' inside a legend's box. In my
specific case, I have a legend with 5 entries, arranged in 5 columns, so
they're horizontally next to
Hi Francesco,
I'd like to place something like a 'title' inside a legend's box. In
my
specific case, I have a legend with 5 entries, arranged in 5 columns,
so
they're horizontally next to each other in one row. Now what I'd like
to
have is inside the legend's box a first row (above the
In the example you provide, bins is returned by the hist command,
whereas in your code, bins is a number that you defined as 20. So,
change:
bins = 20
plt.hist(C, bins, ...
by:
nbins = 20
n, bins, patches = plt.hist(C, nbins, ...
As a side comment, your data loading is too complex, and fail
On 2012/07/26 10:26 PM, Jeffrey Spencer wrote:
Thanks, that is all good info to know. I change my data to log and
normalize it so the logNorm is just linear actually so specifying only
levels is fine. I'll let you know if that doesn't work properly for some
reason.
Ok, yeah I looked at
Hi David,
I tried your fix
nbins = 20
n, bins, patches = plt.hist(C, nbins, range=None, normed=False,
weights=None, cumulative=False, bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log = False, color=None, label=None)
plt.title()
plt.text(25,20,'M -21.5' '\n'
Just tried it with nbins set to 216 and I still get the error
surfcast23 wrote:
Hi David,
I tried your fix
nbins = 20
n, bins, patches = plt.hist(C, nbins, range=None, normed=False,
weights=None, cumulative=False, bottom=None, histtype='bar', align='mid',
On Fri, Jul 27, 2012 at 9:57 PM, surfcast23 surfcas...@gmail.com wrote:
y = mlab.normpdf( nbins, avg, sigma)
l = plt.plot(nbins, y, 'r--', linewidth=1)
plt.show()
You should not change bins there, as you are evaluating the gaussian
function at different values.
Also, sigma is a vector, but it
Thanks for catching that sigma was still a vector! I am no longer getting the
errors, but the best fit line is not showing up.Is there something else I am
missing ?
BTW thanks for the heads up on the np.mean and np.standard functions.
Khary
Daπid wrote:
On Fri, Jul 27, 2012 at 9:57 PM,
I guess it is showing, but you have many data points, so the gaussian
is too small down there. You have to increase its values to make both
areas fit:
plt.plot(bins, N*(bins[1]-bins[0])*y, 'r--', linewidth=1)
And you will get a nice gaussian fitting your data.
On Fri, Jul 27, 2012 at 11:12 PM,
That worked beautifully thank you!
Am I reading (bins[1]-bins[0]) correctly as taking the difference between
what is in the second and first bin?
Daπid wrote:
I guess it is showing, but you have many data points, so the gaussian
is too small down there. You have to increase its values to
On Sat, Jul 28, 2012 at 12:22 AM, surfcast23 surfcas...@gmail.com wrote:
Am I reading (bins[1]-bins[0]) correctly as taking the difference between
what is in the second and first bin?
Yes. I am multipliying the width of the bins by their total height.
Surely there are cleaner and more general
Thank you for the help!
Daπid wrote:
On Sat, Jul 28, 2012 at 12:22 AM, surfcast23 surfcas...@gmail.com wrote:
Am I reading (bins[1]-bins[0]) correctly as taking the difference
between
what is in the second and first bin?
Yes. I am multipliying the width of the bins by their total
I'm unsure about the role of numpy method arange in Matplotlib plots. All
Matplotlib examples I have seen call numpy's method arange, and pass the
result as the first arg to Matplotlib's plot method.
But the following works as expected:
--- quote ---
import matplotlib.pyplot as plt
import numpy
I figured out you can pass in the rasterized keyword to all of those to
change the rasterization in the output.
Also the docs say for pcolormesh it defaults to the backend if not set.
Therefore, in the case of a vector based it would output vectors if not set
to rasterize.
Haven't tested but
On Friday, July 27, 2012, JonBL wrote:
I'm unsure about the role of numpy method arange in Matplotlib plots. All
Matplotlib examples I have seen call numpy's method arange, and pass the
result as the first arg to Matplotlib's plot method.
But the following works as expected:
--- quote ---
23 matches
Mail list logo