Re: [Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Benjamin Root
Sorry, it is "line_collection_2d_to_3d()".

On Thu, May 21, 2015 at 12:02 PM, Raj Kumar Manna 
wrote:

> Its giving a error,
>
> art3d.linecollection_2d_to_3d(stream.lines)
> AttributeError: 'module' object has no attribute 'linecollection_2d_to_3d'
>
>
>
> Here is my script,
>
>
> import matplotlib.pyplot as plt
> from matplotlib.patches import Circle, PathPatch
> from mpl_toolkits.mplot3d import Axes3D
> import mpl_toolkits.mplot3d.art3d as art3d
> import numpy as np
> from pylab import *
> from matplotlib.collections import LineCollection
>
>
>
> fig = plt.figure()
> ax=fig.gca(projection='3d')
>
>
> f=np.loadtxt('flow-velocity343.dat')
> dx,dz=1.0,1.0
>
> xmin,zmin,xmax,zmax=min(f[:,0]),min(f[:,2]),max(f[:,0]),max(f[:,2])
> nbinx,nbinz=int((xmax-xmin)/dx)+1,int((zmax-zmin)/dz)+1
> Ux=np.zeros([nbinz,nbinx],'d')
> Uy=np.zeros([nbinz,nbinx],'d')
> Uz=np.zeros([nbinz,nbinx],'d')
> speed=np.zeros([nbinz,nbinx],'d')
> logv=np.zeros([nbinz,nbinx],'d')
>
>
>
> for f1 in f:
> binx,binz=int((f1[0]-xmin)/dx),int((f1[2]-zmin)/dz)
> Ux[binz][binx]=f1[3]
> Uy[binz][binx]=f1[4]
> Uz[binz][binx]=f1[5]
> speed[binz][binx] = np.sqrt( Ux[binz][binx]*Ux[binz][binx] +
> Uz[binz][binx]*Uz[binz][binx] + Uy[binz][binx]*Uy[binz][binx] )
> logv[binz][binx] = log(speed[binz][binx])
> x,z=np.arange(xmin,xmax+dx,dx),np.arange(zmin,zmax+dz,dz)
> y=np.arange(0,71,1)
> X,Z=np.meshgrid(x,z)
>
> stream = ax.streamplot(X, Z, Ux, Uz, color='black', linewidth=2)
> #lines = stream.lines.get_paths()
>
> art3d.linecollection_2d_to_3d(stream.lines)
> for p in stream.arrows:
> art3d.patch_2d_to_3d(p)
>
>
>
> plt.show()
>
>
>
>
>
> Thanks
> Raj
>
>
> On Thu, May 21, 2015 at 9:19 PM, Benjamin Root  wrote:
>
>> (keeping the discussion on the mailing list)
>>
>> The object you get back have two attributes: "lines" and "arrows". This
>> is just psuedo-code, but it would look something like this:
>>
>> ```
>> stream = ax.streamplot(..)
>> art3d.linecollection_2d_to_3d(stream.lines, )
>> for p in stream.arrows:
>> art3d.patch_2d_to_3d(p, ...)
>> ```
>> Again, I have no clue if this actually would work. I haven't tried doing
>> this myself.
>>
>> Ben Root
>>
>> On Thu, May 21, 2015 at 11:39 AM, Raj Kumar Manna <
>> rajphysics@gmail.com> wrote:
>>
>>> Thanks for your quick reply.
>>>
>>> I have plotted the streamplot in 2d . I am not able to extract lines or
>>> arrow from streamplot. I am new user of matplotlib, can you please tell me
>>> the syntax to extract lines and arrows from streamplot().
>>>
>>> Thanks for you help.
>>> Raj
>>>
>>> On Thu, May 21, 2015 at 8:30 PM, Benjamin Root  wrote:
>>>
 Well, there is the new 3D quiver feature:
 http://matplotlib.org/examples/mplot3d/quiver3d_demo.html. Not quite
 streamlines, but it might do in a pinch.

 Another approach:
 There is the 2d streamplot() function that returns a specialized
 object. From the docstring:
 ```
 Returns:

 *stream_container* : StreamplotSet
 Container object with attributes

 - lines: `matplotlib.collections.LineCollection` of
 streamlines

 - arrows: collection of
 `matplotlib.patches.FancyArrowPatch`
   objects representing arrows half-way along stream
   lines.
 ```

 You might be able to get away with using the "lines" object and feeding
 it through art3d.line_collection_2d_to_3d(), kind of like how it is done
 for pathpatch objects here:
 http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html. You
 might also be able to pass the individual objects in the "arrows" list
 through art3d.patch_2d_to_3d(), but I have no clue if that would actually
 work or not.

 I hope that helps!
 Ben Root


 On Thu, May 21, 2015 at 7:45 AM, Raj Kumar Manna <
 rajphysics@gmail.com> wrote:

> Hi,
>
> I need to plot a 2d streamline in 3d view like this
> .
> As suggested by the post
> ,
> I need to extract streamlines and arrows from a 2d plot and then transform
> it to 3d data. How to transform this 2d streamline data to 3d data and 
> plot
> using mplot3d?
>
> Thanks in advance.
>
> Raj
>
>
> --
> ##
> Raj Kumar Manna
> Complex Fluid & Biological Physics Lab
> IIT Madras
>
> Ph. No. 8144637401
>
> alternate email: r...@physics.iitm.ac.in 
> 
>
>
> --
> One dashboard for servers a

Re: [Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Raj Kumar Manna
Its giving a error,

art3d.linecollection_2d_to_3d(stream.lines)
AttributeError: 'module' object has no attribute 'linecollection_2d_to_3d'



Here is my script,


import matplotlib.pyplot as plt
from matplotlib.patches import Circle, PathPatch
from mpl_toolkits.mplot3d import Axes3D
import mpl_toolkits.mplot3d.art3d as art3d
import numpy as np
from pylab import *
from matplotlib.collections import LineCollection



fig = plt.figure()
ax=fig.gca(projection='3d')


f=np.loadtxt('flow-velocity343.dat')
dx,dz=1.0,1.0

xmin,zmin,xmax,zmax=min(f[:,0]),min(f[:,2]),max(f[:,0]),max(f[:,2])
nbinx,nbinz=int((xmax-xmin)/dx)+1,int((zmax-zmin)/dz)+1
Ux=np.zeros([nbinz,nbinx],'d')
Uy=np.zeros([nbinz,nbinx],'d')
Uz=np.zeros([nbinz,nbinx],'d')
speed=np.zeros([nbinz,nbinx],'d')
logv=np.zeros([nbinz,nbinx],'d')



for f1 in f:
binx,binz=int((f1[0]-xmin)/dx),int((f1[2]-zmin)/dz)
Ux[binz][binx]=f1[3]
Uy[binz][binx]=f1[4]
Uz[binz][binx]=f1[5]
speed[binz][binx] = np.sqrt( Ux[binz][binx]*Ux[binz][binx] +
Uz[binz][binx]*Uz[binz][binx] + Uy[binz][binx]*Uy[binz][binx] )
logv[binz][binx] = log(speed[binz][binx])
x,z=np.arange(xmin,xmax+dx,dx),np.arange(zmin,zmax+dz,dz)
y=np.arange(0,71,1)
X,Z=np.meshgrid(x,z)

stream = ax.streamplot(X, Z, Ux, Uz, color='black', linewidth=2)
#lines = stream.lines.get_paths()

art3d.linecollection_2d_to_3d(stream.lines)
for p in stream.arrows:
art3d.patch_2d_to_3d(p)



plt.show()





Thanks
Raj


On Thu, May 21, 2015 at 9:19 PM, Benjamin Root  wrote:

> (keeping the discussion on the mailing list)
>
> The object you get back have two attributes: "lines" and "arrows". This is
> just psuedo-code, but it would look something like this:
>
> ```
> stream = ax.streamplot(..)
> art3d.linecollection_2d_to_3d(stream.lines, )
> for p in stream.arrows:
> art3d.patch_2d_to_3d(p, ...)
> ```
> Again, I have no clue if this actually would work. I haven't tried doing
> this myself.
>
> Ben Root
>
> On Thu, May 21, 2015 at 11:39 AM, Raj Kumar Manna <
> rajphysics@gmail.com> wrote:
>
>> Thanks for your quick reply.
>>
>> I have plotted the streamplot in 2d . I am not able to extract lines or
>> arrow from streamplot. I am new user of matplotlib, can you please tell me
>> the syntax to extract lines and arrows from streamplot().
>>
>> Thanks for you help.
>> Raj
>>
>> On Thu, May 21, 2015 at 8:30 PM, Benjamin Root  wrote:
>>
>>> Well, there is the new 3D quiver feature:
>>> http://matplotlib.org/examples/mplot3d/quiver3d_demo.html. Not quite
>>> streamlines, but it might do in a pinch.
>>>
>>> Another approach:
>>> There is the 2d streamplot() function that returns a specialized object.
>>> From the docstring:
>>> ```
>>> Returns:
>>>
>>> *stream_container* : StreamplotSet
>>> Container object with attributes
>>>
>>> - lines: `matplotlib.collections.LineCollection` of
>>> streamlines
>>>
>>> - arrows: collection of
>>> `matplotlib.patches.FancyArrowPatch`
>>>   objects representing arrows half-way along stream
>>>   lines.
>>> ```
>>>
>>> You might be able to get away with using the "lines" object and feeding
>>> it through art3d.line_collection_2d_to_3d(), kind of like how it is done
>>> for pathpatch objects here:
>>> http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html. You might
>>> also be able to pass the individual objects in the "arrows" list through
>>> art3d.patch_2d_to_3d(), but I have no clue if that would actually work or
>>> not.
>>>
>>> I hope that helps!
>>> Ben Root
>>>
>>>
>>> On Thu, May 21, 2015 at 7:45 AM, Raj Kumar Manna <
>>> rajphysics@gmail.com> wrote:
>>>
 Hi,

 I need to plot a 2d streamline in 3d view like this
 .
 As suggested by the post
 ,
 I need to extract streamlines and arrows from a 2d plot and then transform
 it to 3d data. How to transform this 2d streamline data to 3d data and plot
 using mplot3d?

 Thanks in advance.

 Raj


 --
 ##
 Raj Kumar Manna
 Complex Fluid & Biological Physics Lab
 IIT Madras

 Ph. No. 8144637401

 alternate email: r...@physics.iitm.ac.in 
 


 --
 One dashboard for servers and applications across Physical-Virtual-Cloud
 Widest out-of-the-box monitoring support with 50+ applications
 Performance metrics, stats and reports that give you Actionable Insights
 Deep dive visibility with transaction tracing using APM Insight.
 http://ad.doubleclick.net/ddm/clk/290420510;1175672

Re: [Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Benjamin Root
(keeping the discussion on the mailing list)

The object you get back have two attributes: "lines" and "arrows". This is
just psuedo-code, but it would look something like this:

```
stream = ax.streamplot(..)
art3d.linecollection_2d_to_3d(stream.lines, )
for p in stream.arrows:
art3d.patch_2d_to_3d(p, ...)
```
Again, I have no clue if this actually would work. I haven't tried doing
this myself.

Ben Root

On Thu, May 21, 2015 at 11:39 AM, Raj Kumar Manna 
wrote:

> Thanks for your quick reply.
>
> I have plotted the streamplot in 2d . I am not able to extract lines or
> arrow from streamplot. I am new user of matplotlib, can you please tell me
> the syntax to extract lines and arrows from streamplot().
>
> Thanks for you help.
> Raj
>
> On Thu, May 21, 2015 at 8:30 PM, Benjamin Root  wrote:
>
>> Well, there is the new 3D quiver feature:
>> http://matplotlib.org/examples/mplot3d/quiver3d_demo.html. Not quite
>> streamlines, but it might do in a pinch.
>>
>> Another approach:
>> There is the 2d streamplot() function that returns a specialized object.
>> From the docstring:
>> ```
>> Returns:
>>
>> *stream_container* : StreamplotSet
>> Container object with attributes
>>
>> - lines: `matplotlib.collections.LineCollection` of
>> streamlines
>>
>> - arrows: collection of
>> `matplotlib.patches.FancyArrowPatch`
>>   objects representing arrows half-way along stream
>>   lines.
>> ```
>>
>> You might be able to get away with using the "lines" object and feeding
>> it through art3d.line_collection_2d_to_3d(), kind of like how it is done
>> for pathpatch objects here:
>> http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html. You might
>> also be able to pass the individual objects in the "arrows" list through
>> art3d.patch_2d_to_3d(), but I have no clue if that would actually work or
>> not.
>>
>> I hope that helps!
>> Ben Root
>>
>>
>> On Thu, May 21, 2015 at 7:45 AM, Raj Kumar Manna <
>> rajphysics@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I need to plot a 2d streamline in 3d view like this
>>> .
>>> As suggested by the post
>>> ,
>>> I need to extract streamlines and arrows from a 2d plot and then transform
>>> it to 3d data. How to transform this 2d streamline data to 3d data and plot
>>> using mplot3d?
>>>
>>> Thanks in advance.
>>>
>>> Raj
>>>
>>>
>>> --
>>> ##
>>> Raj Kumar Manna
>>> Complex Fluid & Biological Physics Lab
>>> IIT Madras
>>>
>>> Ph. No. 8144637401
>>>
>>> alternate email: r...@physics.iitm.ac.in 
>>> 
>>>
>>>
>>> --
>>> One dashboard for servers and applications across Physical-Virtual-Cloud
>>> Widest out-of-the-box monitoring support with 50+ applications
>>> Performance metrics, stats and reports that give you Actionable Insights
>>> Deep dive visibility with transaction tracing using APM Insight.
>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>
>
> --
> ##
> Raj Kumar Manna
> Complex Fluid & Biological Physics Lab
> IIT Madras
>
> Ph. No. 8144637401
>
> alternate email: r...@physics.iitm.ac.in 
> 
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Benjamin Root
Well, there is the new 3D quiver feature:
http://matplotlib.org/examples/mplot3d/quiver3d_demo.html. Not quite
streamlines, but it might do in a pinch.

Another approach:
There is the 2d streamplot() function that returns a specialized object.
>From the docstring:
```
Returns:

*stream_container* : StreamplotSet
Container object with attributes

- lines: `matplotlib.collections.LineCollection` of
streamlines

- arrows: collection of `matplotlib.patches.FancyArrowPatch`
  objects representing arrows half-way along stream
  lines.
```

You might be able to get away with using the "lines" object and feeding it
through art3d.line_collection_2d_to_3d(), kind of like how it is done for
pathpatch objects here:
http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html. You might
also be able to pass the individual objects in the "arrows" list through
art3d.patch_2d_to_3d(), but I have no clue if that would actually work or
not.

I hope that helps!
Ben Root


On Thu, May 21, 2015 at 7:45 AM, Raj Kumar Manna 
wrote:

> Hi,
>
> I need to plot a 2d streamline in 3d view like this
> .
> As suggested by the post
> ,
> I need to extract streamlines and arrows from a 2d plot and then transform
> it to 3d data. How to transform this 2d streamline data to 3d data and plot
> using mplot3d?
>
> Thanks in advance.
>
> Raj
>
>
> --
> ##
> Raj Kumar Manna
> Complex Fluid & Biological Physics Lab
> IIT Madras
>
> Ph. No. 8144637401
>
> alternate email: r...@physics.iitm.ac.in 
> 
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Raj Kumar Manna
Hi,

I need to plot a 2d streamline in 3d view like this
.
As suggested by the post
,
I need to extract streamlines and arrows from a 2d plot and then transform
it to 3d data. How to transform this 2d streamline data to 3d data and plot
using mplot3d?

Thanks in advance.

Raj


-- 
##
Raj Kumar Manna
Complex Fluid & Biological Physics Lab
IIT Madras

Ph. No. 8144637401

alternate email: r...@physics.iitm.ac.in 

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users