Plotting activity times¶
In this example, we show how activity and trip times can be plotted.
In [1]:
Copied!
import os
import pandas as pd
from pam import read
from pam.plot.stats import plot_activity_times, plot_leg_times
import os
import pandas as pd
from pam import read
from pam.plot.stats import plot_activity_times, plot_leg_times
In [2]:
Copied!
data_path = os.path.join("data", "example_data")
trips = pd.read_csv(os.path.join(data_path, "example_travel_diaries.csv"))
attributes = pd.read_csv(os.path.join(data_path, "example_attributes.csv"))
attributes = attributes.set_index("pid")
data_path = os.path.join("data", "example_data")
trips = pd.read_csv(os.path.join(data_path, "example_travel_diaries.csv"))
attributes = pd.read_csv(os.path.join(data_path, "example_attributes.csv"))
attributes = attributes.set_index("pid")
In [3]:
Copied!
population = read.load_travel_diary(trips, attributes)
population = read.load_travel_diary(trips, attributes)
Using tour based purpose parser (recommended) Adding pid->hh mapping to persons_attributes from trips. Adding home locations to persons attributes using trips attributes. Using freq of 'None' for all persons.
In [4]:
Copied!
population.random_household().plot()
population.random_household().plot()
In [5]:
Copied!
fig1 = plot_activity_times(population)
fig1 = plot_activity_times(population)
In [6]:
Copied!
fig2 = plot_leg_times(population)
fig2 = plot_leg_times(population)
In [ ]:
Copied!