Skip to content

Commit

Permalink
visualize number of rejection per time bin
Browse files Browse the repository at this point in the history
  • Loading branch information
tschlenther committed Sep 28, 2023
1 parent f4ad924 commit 77bec68
Showing 1 changed file with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ public void configure(Header header, Layout layout) {
viz.center = data.context().getCenter();
viz.zoom = data.context().mapZoomLevel;
})
//TODO group rejections per time bin. better put it into the plot with wait stats over daty time.
// .el(Line.class, (viz, data) -> {
// viz.dataset = data.output("ITERS/it." + lastIteration + "/*rejections_" + drtConfigGroup.mode + ".csv");
// viz.x = "time";
// })
;

// This plot is not absolutely necesarry given the hex plots
Expand All @@ -163,12 +158,13 @@ public void configure(Header header, Layout layout) {
viz.title = "Final Demand and Wait Stats over day time";
viz.description = "Number of rides (customers) is displayed in bars, wait statistics in lines";

Plotly.DataSet dataset = viz.addDataset(data.output("*_waitStats_" + drtConfigGroup.mode + ".csv"));
Plotly.DataSet waitStats = viz.addDataset(data.output("*_waitStats_" + drtConfigGroup.mode + ".csv"));
Plotly.DataSet rejections = viz.addDataset(data.output("*drt_rejections_perTimeBin_" + drtConfigGroup.mode + ".csv"));

viz.layout = tech.tablesaw.plotly.components.Layout.builder()
.xAxis(Axis.builder().title("Time Bin").build())
.yAxis(Axis.builder().title("Wait Time [s]").build())
.yAxis2(Axis.builder().title("Nr of Rides")
.yAxis2(Axis.builder().title("Nr of Rides/Rejections")
.side(Axis.Side.right)
.overlaying(ScatterTrace.YAxis.Y)
.build())
Expand All @@ -179,7 +175,7 @@ public void configure(Header header, Layout layout) {
.mode(ScatterTrace.Mode.LINE)
.name("Average")
.build(),
dataset.mapping()
waitStats.mapping()
.x("timebin")
.y("average_wait")
);
Expand All @@ -188,7 +184,7 @@ public void configure(Header header, Layout layout) {
.mode(ScatterTrace.Mode.LINE)
.name("P5")
.build(),
dataset.mapping()
waitStats.mapping()
.x("timebin")
.y("p_5")
);
Expand All @@ -197,7 +193,7 @@ public void configure(Header header, Layout layout) {
.mode(ScatterTrace.Mode.LINE)
.name("P95")
.build(),
dataset.mapping()
waitStats.mapping()
.x("timebin")
.y("p_95")
);
Expand All @@ -207,11 +203,21 @@ public void configure(Header header, Layout layout) {
.yAxis(ScatterTrace.YAxis.Y2.toString())
.name("Rides")
.build(),
dataset.mapping()
waitStats.mapping()
.x("timebin")
.y("legs")
);

viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT)
.opacity(0.3)
.yAxis(ScatterTrace.YAxis.Y2.toString())
.name("Rejections")
.build(),
rejections.mapping()
.x("timebin")
.y("rejections")
);

})
.el(Area.class, (viz, data) -> {
viz.title = "Vehicle occupancy"; //actually, without title the area plot won't work
Expand Down Expand Up @@ -248,7 +254,7 @@ public void configure(Header header, Layout layout) {
dataset.mapping()
.x("iteration")
.y("rejections")
.color(Plotly.ColorScheme.RdBu)
// .color(Plotly.ColorScheme.RdBu)
);

viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT)
Expand All @@ -257,7 +263,7 @@ public void configure(Header header, Layout layout) {
dataset.mapping()
.x("iteration")
.y("rides")
.color(Plotly.ColorScheme.RdBu)
// .color(Plotly.ColorScheme.RdBu)
);

})
Expand Down Expand Up @@ -294,7 +300,7 @@ public void configure(Header header, Layout layout) {
dataset.mapping()
.x("iteration")
.y("inVehicleTravelTime_mean")
.color(Plotly.ColorScheme.RdBu)
// .color(Plotly.ColorScheme.RdBu)
);

viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT)
Expand All @@ -304,7 +310,7 @@ public void configure(Header header, Layout layout) {
dataset.mapping()
.x("iteration")
.y("wait_average")
.color(Plotly.ColorScheme.RdBu)
// .color(Plotly.ColorScheme.RdBu)
);
})
.el(Line.class, (viz, data) -> {
Expand Down

0 comments on commit 77bec68

Please sign in to comment.