Rachael Dottle, for FiveThirtyEight, looked for political differences in cities and ranked them, based on precinct voting margins for the 2016 election:
To see just how politically segregated America’s urban areas are, we used each city’s 2016 election results to calculate its dissimilarity index — basically, a number that tells us how separated its Republicans and Democrats are from one another, with higher numbers indicating more segregation. This technique is most often used to measure racial segregation, but political scientists have also used it to calculate partisan segregation. (One drawback of this method: A place that votes almost uniformly for one party — Democrat-soaked San Jose, California, for example — will have a low dissimilarity score. But that doesn’t mean Republicans and Democrats live next to each other in these places; it may just mean that the larger region is politically segregated, leaving the whole city as essentially a one-party enclave.)
Unsurprisingly, political and racial segregation are related.
The Upshot asked a similar question last year using similar data and mapping scheme, but they framed it differently.