[Matplotlib-users] Query about streamplot

vincent.adrien at gmail.com vincent.adrien at gmail.com
Wed Apr 17 03:57:20 EDT 2019


Kumar,

FWIW, based on the [streamplot
example](https://matplotlib.org/gallery/images_contours_and_fields/plot_streamplot.html)
in the gallery, the following snippet seems to be working just fine
(with Matplotlib 3.0.1) “even though” the amount of X and Y coordinate
values is (Nx, Ny) = (100, 50).

```python
import numpy as np
import matplotlib.pyplot as plt

# Dummy data
w = 3
Nx, Ny = 100, 50
Y, X = np.mgrid[-w:w:50j, -w:w:100j]
U = -1 - X**2 + Y
V = 1 + X - Y**2

fig, ax = plt.subplots()

ax.streamplot(X, Y, U, V)
ax.set_title(f"{Nx/Ny:g}× more points along X than Y")
```

Best,
Adrien

Le 17/04/2019 à 08:14, Adrien VINCENT a écrit :
> Hi Kumar,
> 
> Could provided a snippet with a (standalone) minimal working example of what you have tried ?
> 
> AFAICT, looking at https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.streamplot.html it does not look like X and Y arrays of coordinates have to be of equal length (but the velocity arrays U and V should have relevant dimensions relative to X and Y).
> 
> Best regards,
> Adrien
> 
> 
> 
> On April 16, 2019 11:05:01 PM GMT+02:00, Dhirendra Kumar <dhirendra.cub at gmail.com> wrote:
>> Hii Folks
>>
>> I have an array with dimension (plev: 7, lat: 81). I was trying to draw
>> streamline plot for Omega and V wind [Hadley cell].  I am facing some
>> error
>> with* plt.streamplot* as it says that both the dimension should be of
>> equal
>> size (i.e. N * N ). Is there any other way to create a streamline plot
>> for
>> the data having unequal values along both the dimensions?
>>
>> I seek help of the community in this regard.
>>
>> I hope I framed my question correctly.  Please let me know if I need to
>> clarify more details.
>>
>> Thank you
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamplot_example_for_kumar.png
Type: image/png
Size: 86118 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20190417/d65f57ae/attachment-0001.png>


More information about the Matplotlib-users mailing list