Example #1
0
 def quiver(self,**kwargs):
     """ graphics.quiver() as a property """
     graphics.quiver(self._obj,**kwargs)
Example #2
0
 def streamplot(self, **kwargs):
     """ graphics.quiver(streamlines=True) """
     graphics.quiver(self._obj, streamlines=True,**kwargs)
Example #3
0
def main():

    data_selectbox = st.sidebar.selectbox('Which dataset?',
                                          ('Demo', 'Jet', 'Canopy'))

    streamlines = st.sidebar.checkbox('Streamlines?', value=False)

    colorbar = st.sidebar.checkbox('Color bar?', value=False)

    average = st.sidebar.checkbox('Average?', value=False)

    st.subheader('Create data set')
    """
    `data = io.create_sample_dataset()`

    """

    st.subheader('Present data as Pandas DataFrame')
    """
    `data.to_dataframe()`
    """

    data = load_data(data_selectbox)
    st.write(data.to_dataframe())

    st.subheader('Plot some vector fields using matpotlib quiver')
    """
    ` graphics.quiver(data.isel(t=0)`
    """

    # progress_bar = st.progress(0)
    # status_text = st.empty()
    # chart = st.line_chart(np.random.randn(10, 2))

    # for i in range(len(data)):
    #     # Update progress bar.
    #     progress_bar.progress(i)

    #     new_rows = np.random.randn(10, 2)

    #     # Update status text.
    #     status_text.text(
    #         'The latest random number is: %s' % new_rows[-1, 1])

    #     # Append data to the chart.
    #     # chart.add_rows(new_rows)
    #     graphics.quiver(data.isel(t=i))
    #     st.pyplot()

    #     # Pretend we're doing some computation that takes time.
    #     time.sleep(1)

    # status_text.text('Done!')
    # st.balloons()

    # fig, ax = plt.subplots()
    if average:
        fig, ax = graphics.quiver(data.piv.average,
                                  streamlines=streamlines,
                                  colbar=colorbar,
                                  colbar_orient='vertical')
    else:
        t = st.selectbox('Frame number', range(len(data.t)))
        fig, ax = graphics.quiver(data.isel(t=t),
                                  streamlines=streamlines,
                                  colbar=colorbar,
                                  colbar_orient='vertical')

    the_plot = st.pyplot(plt)
Example #4
0
 def quiver(self, **kwargs):
     """ graphics.quiver() as a property """
     fig, ax = graphics.quiver(self._obj, **kwargs)
     return fig, ax
Example #5
0
def test_quiver():
    graphics.quiver(_d)
tmp=r.values
#plt.quiver(x,y,u,v)
    #print(tmp)
x,y,u,v = tmp[:,0],tmp[:,1],tmp[:,2],tmp[:,3] #(each col as a list)
#print(x)
   
rows = np.unique(y).shape[0]
cols = np.unique(x).shape[0]
x1 = x.reshape(rows,cols)
y1 = y.reshape(rows,cols)
u1 = u.reshape(rows,cols)
v1 = v.reshape(rows,cols)

d = io.from_arrays(x1,y1,u1,v1,np.ones_like(u1))
fig,axes=plt.subplots(figsize=(28,20))
graphics.quiver(d.isel(t=0),nthArr=3, arrScale=10) #arrScale scales arrows

d.piv.vec2scal(property='curl')
fig, ax = plt.subplots(figsize=(56,40))
graphics.contour_plot(d)

from scipy.ndimage.filters import gaussian_filter

d.piv.vorticity()
tmp2 =  gaussian_filter(d.isel(t=0)['w'],0.7)

fig, ax = plt.subplots(figsize=(8,6))

levels = np.linspace(np.min(tmp),np.max(tmp), 10)
#c = ax.contourf(r.x,r.y,tmp, levels=levels,
                 #cmap = plt.get_cmap('RdYlBu'))
Example #7
0
def test_quiver():
    graphics.quiver(_d)
    _d.piv.quiver()