[Matplotlib-users] Histogram without binning

2011-01-08 Thread OKB (not okblacke)
A straightforward question: Is there a simple way to get a 
histogram that does not bin any values together at all, but simply 
creates one bar for each distinct value in the dataset?

-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
--author unknown


--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram without binning

2011-01-08 Thread Jose Gomez-Dans
Hi,

On 8 January 2011 18:57, OKB (not okblacke)  wrote:
> Is there a simple way to get a
> histogram that does not bin any values together at all, but simply
> creates one bar for each distinct value in the dataset?

You can just use the bins keyword to plt.hist (or np.hist):
plt.hist ( x, bins=np.unique ( x ) )

Jose

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problem (bug?) with mpl_toolkits.mplot3d.Axes3D

2011-01-08 Thread Daniel Mader
Hello,

I have a problem with the 3D plotting of PolyCollections with
python-matplotlib-1.0.0 (on openSUSE 11.3 x86_64):

instead of being correctly stacked as in the example
http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html,
the plots are weirdly overlapping. The example works OK for me but I
need a PolyCollection in order to plot the results of a couple of FEM
simulations...

Code is attached which demonstrates the problem. Any help is deeply appreciated!

Thanks a million times in advance,
best regards from Salzburg, Austria,

Daniel


mpl3D.py
Description: Binary data
--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl ___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem (bug?) with mpl_toolkits.mplot3d.Axes3D

2011-01-08 Thread Benjamin Root
On Sat, Jan 8, 2011 at 4:07 PM, Daniel Mader <
[email protected]> wrote:

> Hello,
>
> I have a problem with the 3D plotting of PolyCollections with
> python-matplotlib-1.0.0 (on openSUSE 11.3 x86_64):
>
> instead of being correctly stacked as in the example
> http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html,
> the plots are weirdly overlapping. The example works OK for me but I
> need a PolyCollection in order to plot the results of a couple of FEM
> simulations...
>
> Code is attached which demonstrates the problem. Any help is deeply
> appreciated!
>
> Thanks a million times in advance,
> best regards from Salzburg, Austria,
>
> Daniel
>
>
Daniel,

The stacking problem is fairly well known (although not very well
documented).  However, this is not your bug.

I haven't exactly figure out what is wrong, but it appears that a fifth
polygon is being drawn or something that is connecting back to the (0, 0)
point.  If you redefine your polygons a bit, you will see what I mean:

vertsQuad = [ [ (0,0), (0,1), (1,1), (1,0) ],
  [ (4,1), (2,3), (2,2), (3,1)],
  [ (0,1), (2,3), (2,2), (1,1)],
  [ (3,0), (3,1), (4,1), (4,0)]]

As an additional note, your for-loop later in the code is a bit wrong:

zpos = [0, 1, 2, 3, 4]
for i in zpos :
...
zs = [zpos[i]]*len(vertsQuad)

In this case, you are using the values of zpos as both the z-location values
*and* as an index back to itself.  Try something like this:

zpos = [0, 1, 2, 3, 4]
for zval in zpos :
...
zs = [zval]*len(vertsQuad)

That way, the values in zpos can be any numerical value, in any order, and
it makes for easier reading.

I will look a little bit further for the cause of your problem, but you can
at least partly mitigate it by closing your polygon paths (this shouldn't be
necessary, but go figure...):

vertsQuad = [ [ (0,0), (0,1), (1,1), (1,0), (0,0) ],
  [ (4,1), (2,3), (2,2), (3,1), (4,1)],
  [ (0,1), (2,3), (2,2), (1,1), (0,1)],
  [ (3,0), (3,1), (4,1), (4,0), (3,0)]]

I hope this helps!
Ben Root
--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl ___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hatch can not be saved as eps

2011-01-08 Thread Jae-Joon Lee
I think this is a bug in the ghostscript (which I believe that has
been fixed recently). If you turn off antialiasing, the hatches come
out fine. Did you use "round" join-style to create this output? My
recollection is that this bug (of ghostscript) only happen when ghost
script does antialiasing for paths with "round" join style.

Regards,

-JJ


On Tue, Jan 4, 2011 at 6:23 AM, Benjamin Root  wrote:
> On Tue, Dec 28, 2010 at 8:25 PM, Jae-Joon Lee  wrote:
>>
>> Benjamin,
>> Can you post the eps file?
>>
>> With matplotlib from the svn, everything is fine in my system.
>>
>> Regards,
>>
>> -JJ
>>
>>
>
> JJ,
>
> Attached is my eps file produced from the latest svn.  I am using evince
> 2.30.3 to view it.
>
> Ben Root
>

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users