PedestrianDynamics / PedPy

Analysis of pedestrian dynamics based on trajectory files.
https://pedpy.readthedocs.io
MIT License
15 stars 9 forks source link

Filled area line width overlaps surrounding line in plot_walkable_area #341

Closed MaikFZJ closed 3 weeks ago

MaikFZJ commented 2 months ago

When specify a line_width within plot_walkable_area smaller than default 1, the filled area seems to have also a surrounding line, which stays to a size of 1: https://github.com/PedestrianDynamics/PedPy/blob/c09a0cb73e0e35900c7c968a69394f5b47dee6ac/pedpy/plotting/plotting.py#L531

This should be changed, so that the surroundline line is the outer border.

chraibi commented 2 months ago

Can you add some example code and/or a screenshot?

MaikFZJ commented 1 month ago
import pedpy as pp
import pathlib
import matplotlib.pyplot as plt
import pandas as pd

w = 0.05 # tube thickness
walkable_area = pp.WalkableArea(
    # complete area
    [
        (-8.88, -7.63),
        (8.3, -7.63),
        (8.3, 27.95),
        (-8.88, 27.95),
    ],

    obstacles=[
        [
            (-3.54, -1.13),
            (-3.57, 19.57),
            (-1.52, 19.57),
            (-1.37, 19.71),
            (-1.37, 21.09),
            (-1.52, 21.23),
            (-1.67, 21.23),
            (-1.67, 21.23-w), # way back
            (-1.52-w/2, 21.23-w),
            (-1.37-w, 21.09-w/2),
            (-1.37-w, 19.71+w/2),
            (-1.52-w/2, 19.57+w),
            (-3.57-w, 19.57+w),
            (-3.54-w, -1.13),
        ],
        [
            (3.57, -0.89),
            (3.64, 19.64),
            (1.47, 19.57),
            (1.32, 19.71),
            (1.32, 21.09),
            (1.47, 21.23),
            (1.62, 21.23),
            (1.62, 21.23-w), # way back
            (1.47+w/2, 21.23-w),
            (1.32+w, 21.09-w/2),
            (1.32+w, 19.71+w/2),
            (1.47+w/2, 19.57+w),
            (3.64+w, 19.64+w),
            (3.57+w, -0.89),
        ],
        [
            (0.67, 19.57),
            (0.82, 19.71),
            (0.82, 21.09),
            (0.67, 21.23),
            (0.38, 21.23),
            (0.23, 21.09),
            (0.23, 19.71),
            (0.38, 19.57),
        ],
        [
            (-0.42, 19.57),
            (-0.27, 19.71),
            (-0.27, 21.09),
            (-0.42, 21.23),
            (-0.72, 21.23),
            (-0.87, 21.09),
            (-0.87, 19.71),
            (-0.72, 19.57),
        ],
    ],
)

pp.plot_walkable_area(walkable_area=walkable_area, line_width=0.1).set_aspect("equal")
plt.savefig("geometry.pdf")

With line_width=0.1:

grafik

With line_width=1:

grafik

It also can be seen, that the obstacles are not closed graphically appealing:

grafik