matplotlib

How to add labels to a boxplot figure (pylab)

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 06:26:01
问题 This is a pretty basic question I'm sure but I cannot seem to find the right code. There is my code for the boxplot I am creating. I would like to label the axes and have a title. from pylab import * import numpy raw_data = list(numpy.genfromtxt(filename, delimiter=',')) print raw_data figure() boxplot(raw_data,1) savefig('testfigure.pdf') I have tried pylab.xlabel('x') and plt.xlable('x') but those do not work...? Do they not work for boxplots or have I just got it wrong about those lines

How to add labels to a boxplot figure (pylab)

只谈情不闲聊 提交于 2021-01-27 06:25:29
问题 This is a pretty basic question I'm sure but I cannot seem to find the right code. There is my code for the boxplot I am creating. I would like to label the axes and have a title. from pylab import * import numpy raw_data = list(numpy.genfromtxt(filename, delimiter=',')) print raw_data figure() boxplot(raw_data,1) savefig('testfigure.pdf') I have tried pylab.xlabel('x') and plt.xlable('x') but those do not work...? Do they not work for boxplots or have I just got it wrong about those lines

python matplotlib plot hist2d with normalised masked numpy array

混江龙づ霸主 提交于 2021-01-27 06:21:06
问题 I want to plot 2d histogram using matplotlib.pyplot.hist2d. As input I have masked numpy.ma arrays. That as such works fine like this: hist2d (arr1,arr2,cmin=1) However if I want to normalise the arrays, so I get values always between 0 and 1, using the normed=True keyword like this hist2d (arr1,arr2,cmin=1, normed=True) I get errors .../numpy/ma/core.py:3791: UserWarning: Warning: converting a masked element to nan. warnings.warn("Warning: converting a masked element to nan.") .../matplotlib

Add seaborn.palplot axes to existing figure for visualisation of different color palettes

徘徊边缘 提交于 2021-01-27 06:09:40
问题 Adding seaborn figures to subplots is usually done by passing 'ax' when creating the figure. For instance: sns.kdeplot(x, y, cmap=cmap, shade=True, cut=5, ax=ax) This method, however, doesn't apply to seaborn.palplot, which visualizes seaborn color palettes. My goal is to create a figure of different color palettes for scalable color comparison and presentation. This image roughly shows the figure I'm trying to create [source]. A possibly related answer describes a method of creating a

Add seaborn.palplot axes to existing figure for visualisation of different color palettes

≡放荡痞女 提交于 2021-01-27 06:09:30
问题 Adding seaborn figures to subplots is usually done by passing 'ax' when creating the figure. For instance: sns.kdeplot(x, y, cmap=cmap, shade=True, cut=5, ax=ax) This method, however, doesn't apply to seaborn.palplot, which visualizes seaborn color palettes. My goal is to create a figure of different color palettes for scalable color comparison and presentation. This image roughly shows the figure I'm trying to create [source]. A possibly related answer describes a method of creating a

Matplotlib - Contour plot with single value

≡放荡痞女 提交于 2021-01-27 06:00:56
问题 I want to make a contour plot of some data, but it is possible that all values in the field at the same value. This causes an error in matplotlib, which makes sense since there really isn't a contour to be created. For example, if you run the code below, you will get an error, but delete the second definition of zi and it runs as expected. How can I make a "contour" plot for some data if it is a uniform field? I want it to look just like the regular contour plot (to have a box filled with

Matplotlib - Contour plot with single value

筅森魡賤 提交于 2021-01-27 05:59:10
问题 I want to make a contour plot of some data, but it is possible that all values in the field at the same value. This causes an error in matplotlib, which makes sense since there really isn't a contour to be created. For example, if you run the code below, you will get an error, but delete the second definition of zi and it runs as expected. How can I make a "contour" plot for some data if it is a uniform field? I want it to look just like the regular contour plot (to have a box filled with

why does my convolution routine differ from numpy & scipy's?

淺唱寂寞╮ 提交于 2021-01-27 05:58:43
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)

why does my convolution routine differ from numpy & scipy's?

痞子三分冷 提交于 2021-01-27 05:58:34
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)

why does my convolution routine differ from numpy & scipy's?

喜你入骨 提交于 2021-01-27 05:57:23
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)