Построение участка - Python - PullRequest
       10

Построение участка - Python

0 голосов
/ 27 октября 2018

Я пытался достичь чего-то вроде этого: Пример * +1003 *

Пока что это то, что я пробовал:

crimes.Month = pd.to_datetime(crimes.Month, format='%Y/%m')

crimes.index = pd.DatetimeIndex(crimes.Month)

import numpy as np

crimes_count_date = crimes.pivot_table('Month', aggfunc=np.size,columns='Crime type', index=crimes.index.date, fill_value=0)

crimes_count_date.index = pd.DatetimeIndex(crimes_count_date.index)

plo = crimes_count_date.rolling(365).sum().plot(figsize=(12, 30),subplots=True, layout=(-1, 3), sharex=False, sharey=False)

Примечание - по оси X я хотел бы отображать каждый год / месяц: 2017/08

Текущий вывод ниже, не показывает все месяцы / год или какие-либо строки для типов преступлений Текущий выход

1 Ответ

0 голосов
/ 27 октября 2018

Не знаю, как выглядят ваши данные.

Но у python есть хороший способ создания подзаговоров:

import matplotlib.pyplot as plt
plt.figure(figsize=(16,8)) ## setting over-all figure size (optional)
plt.subplot(2, 3, 1) 

##  this creates 6 subplots (2 rows and 3 columns)
## 1 at the end means we are in the first subplot.. then...

plt.plot(x1,y1) ## for well-selected x1 and y1
plt.subplot(232) ## the same as subplot(2, 3, 2) - you can use this when values have
                 ## one digit only; now we are in the 2nd subplot
plt.plot(x2, y2)  ## this will be plotted in the second subplot

## etc. ...

plt.subplot(236)
plt.plot(x6,y6)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...