По центру has more narrow meaning.
В центре can be used always when something is in the middle or center: в центре города, в центре Земли, в центре комнаты, в центре треугольника.
По центру us used when you visually describe something appearing in the middle, and assess the perfectness of centering.
Example:
Картина висит в центре стены, но не совсем по центру.
The drawing is hanging at the middle of the wall, but not perfectly in the center.
It is somewhat shifted, maybe. Or tilted...
In other words, по центру means perfectly visually in the center.
If you say "я живу в центре города", this means "I live in the central part of the city". If you say "я живу по центру города", this means something like your apartment can be seen from all sides of the city, on some kind of crossing of view directions, at equal distance from the corners, or sorts. Like in "снайпер выбрал позицию по центру города".