[Matplotlib-users] restrictions on format for posting to matplotlib-users?

2012-04-27 Thread tanim
Hello:

Are there any restrictions or best practices for posting problems or 
issues one has with matplotlib/pyplot? I ask, because one of the data sets 
that demonstrates unexpected behavior in matplotlib is ~300k in size (I 
can reduce it if necessary).

Tanim Islam

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] probable issues with Axes3D.scatter working unusually?

2012-04-30 Thread Tanim Islam
Hello:

I believe I may have uncovered some unusual behavior wrt to Axes3D.scatter.


   - When I run the attached and self-contained problem,
   "demo_colorbar_3d.py," I am able to create a colorbar and the 3d scatter
   points are normally created.
   - However, in the attached python script "demo_data_3d.py," when I read
   a set of XYZ data from a file and place into separate XYZ arrays, I am able
   to create the appropriately limited and colored colorbar, but all the
   scatter points appear black.

The data input for "demo_data_3d.py," "data_output.txt," and png
screenshots "demo_colorbar_3d.pdf" and "demo_data_3d.pdf," are located in a
the following public Dropbox links are here:

   - demo_data_3d.pdf <http://dl.dropbox.com/u/7140790/demo_data_3d.pdf>
   - data_output.txt <http://dl.dropbox.com/u/7140790/data_output.txt>
   - demo_colorbar_3d.pdf<http://dl.dropbox.com/u/7140790/demo_colorbar_3d.pdf>


Thank you,

Tanim Islam
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] probable issues with Axes3D.scatter working unusually?

2012-04-30 Thread Tanim Islam
Apologies, but attached to this email are the 2 python scripts I have
neglected to attach to the previous email.

Tanim Islam
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] probable issues with Axes3D.scatter working unusually?

2012-04-30 Thread Tanim Islam

Yes, sorry about that. I hope this now works.

Tanim Islam

On Mon, 30 Apr 2012, Benjamin Root wrote:




On Mon, Apr 30, 2012 at 2:02 PM, Tanim Islam  wrote:
  Apologies, but attached to this email are the 2 python scripts I have 
neglected to attach to the previous email.
Tanim Islam


Tanim,

Could you try that again?  No python scripts came with that email.

Ben Root


#!/usr/bin/env python -i

import pylab, numpy, inspect
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import FuncFormatter

def scinot(x, pos=None):
if x == 0:
s = '0'
else:
xp = int(numpy.floor(numpy.log10(numpy.abs(x
mn = x/10.**xp
# Here we truncate to 2 significant digits -- may not be enough 
# in all cases
s = '$'+str('%.1f'%mn) +'\\times 10^{'+str(xp)+'}$'
return s

pylab.close()

u = numpy.random.random_sample(300)
v = numpy.random.random_sample(300)
w = numpy.random.random_sample(300)

mag = numpy.sqrt(u**2 + v**2 + w**2)

## fundamentally nontrivial things to customize a colorbar to look nice
## in pylab/matplotlib
fig = pylab.figure(figsize=(15,13.5)) # make the figure bigger
axes3d = Axes3D(fig)
patches = axes3d.scatter(u, v, w, c=mag, cmap=cm.jet,
 vmin=0.5, vmax=1.5, s=30.5)
cb = fig.colorbar(patches, shrink=0.75, aspect=20, pad=0.05,
  orientation='vertical', fraction=0.10,
  format=FuncFormatter(scinot))
#cb.ax.set_major_formatter(FuncFormatter(scinot))
pylab.show()
#!/usr/bin/env python -i

import pylab, numpy, os
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import FuncFormatter

def create_colors(vals, minval, maxval):
gradients = cm.jet(numpy.linspace(0, 1.0, 101))
normvals = (numpy.array(vals) - minval) / (maxval - minval)
rgbacolors = numpy.zeros((len(vals), 4))
for idx in range(len(vals)):
actidx = max(0, min(100, int(normvals[idx] * 100)))
rgbacolors[idx,:] = gradients[actidx]
return rgbacolors

def scinot(x, pos=None):
if x == 0:
s = '0'
else:
xp = int(numpy.floor(numpy.log10(numpy.abs(x
mn = x/10.**xp
# Here we truncate to 2 significant digits -- may not be enough 
# in all cases
s = '$'+str('%.1f'%mn) +'\\times 10^{'+str(xp)+'}$'
return s

pylab.close()

xd = []
yd = []
zd = []
vmag_d = []
for line in open(os.path.expanduser('~/temp/data_output.txt'), 'r'):
linesplit = line.strip().split()
xd.append(float(linesplit[0]))
yd.append(float(linesplit[1]))
zd.append(float(linesplit[2]))
vmag_d.append(float(linesplit[3]))

xd_min = min(xd)
xd_max = max(xd)
yd_min = min(yd)
yd_max = max(yd)
zd_min = min(zd)
zd_max = max(zd)

fig = pylab.figure(figsize=(15,13.5))
axes3d = Axes3D(fig)
scatter = axes3d.scatter(numpy.array(xd), numpy.array(yd), 
 numpy.array(zd), 
 c = numpy.array(vmag_d),
 cmap = cm.jet,
 s = 1.0)
axes3d.set_xlim3d([xd_min, xd_max])
axes3d.set_ylim3d([yd_min, yd_max])
axes3d.set_zlim3d([zd_min, zd_max])
axes3d.set_xlabel(r'$x$ (cm)')
axes3d.set_ylabel(r'$y$ (cm)')
axes3d.set_zlabel(r'$z$ (cm)')
axes3d.w_xaxis.set_major_formatter(FuncFormatter(scinot))
axes3d.w_yaxis.set_major_formatter(FuncFormatter(scinot))
axes3d.w_zaxis.set_major_formatter(FuncFormatter(scinot))
fig.colorbar(scatter, orientation='vertical', shrink=0.75, aspect=20, pad=0.05,
 fraction=0.10, format=FuncFormatter(scinot))
pylab.show()
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] probable issues with Axes3D.scatter working unusually?

2012-05-01 Thread Tanim Islam

Hello,

I find this problem on matplotlib version 1.0.1

Tanim Islam

On Tue, 1 May 2012, Benjamin Root wrote:




On Mon, Apr 30, 2012 at 4:02 PM, Tanim Islam  wrote:
  Yes, sorry about that. I hope this now works.

  Tanim Islam


I can confirm your results.  I am looking into it.  What version of
matplotlib are you using?

Ben Root


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users