コード例 #1
0
ファイル: main.py プロジェクト: mahfuz195/adas_project
def live(i, xs, ys):
    xs = xs[-10:0]
    ys = ys[-10:0]
    ax.clear()
    ax.plot(xs, ys)
    plt.xtics(ha='right')
    plt.title('Distance Measurement')
    plt.ylabel('meter')
コード例 #2
0
ファイル: pygraph.py プロジェクト: soorichu/pygraph
 def checkBox_2Changed(self):
     if self.checkBox_2.isChecked:
         xtics = arange(-30 * pi, 30 * pi, pi)
         xticlabel = []
         for xt in arange(-30, 30, 1):
             if xt == -1: xticlabel.append(r'$-\pi$')
             elif xt == 1: xticlabel.append(r'$\pi$')
             else: xticlabel.append('$' + str(xt) + r'\pi$')
         plt.xticks(xtics, xticlabel)
     else:
         xtics = arange(-100, 100, 1)
         xticlabel = []
         for xt in range(-100, 100, 1):
             xticlabel.append(xt)
         plt.xtics(xtics, xticlabel)
コード例 #3
0
def describe_year(year):
    filtereddf = df.filter(df['year'] == year).agg({
        'value': 'sum'
    }).withColumnRenamed('sum(value)', 'convictions')
    burough_list = [x[0] for x in filtereddf.toLocalIterator()]
    conviction_list = [x[1] for x in filtereddf.toLocalIterator()]

    plt.title('Crime for the year:' + year, frontsize=30)
    plt.xlable('Boroughs', fontsize=30)
    plt.ylable('Convictions', fontsize=30)

    plt.xtics(rotation=90, frontsize=30)
    plt.ytics(frontsize=30)
    plt.autoscale()

    plt.figure(figsize=(33, 10))
    plt.bar(burough_list, conviction_list)
    plt.xtic
    plt.show()
コード例 #4
0
df=pd.merge(df,df_meal,how='outer',on='meal_id')

df


# In[15]:


table = pd.pivot_table(data=df,index='category',values='num_orders',aggfunc=sum)


# In[16]:


table.plot(kind='bar')
plt.xtics(rotation=70)
plt.xlabel('food items')
plt.ylabel('quantity sold')
plt.title('faviourate food')
plt.savefig('most_popular_food.png')
plt.show()


# In[73]:


df['revenue']=df['checkout_price']*df['num_orders']
df['month']=df['week']//4
df