A man takes part in a rally protesting President Trump's visit to El Paso on Aug. 7. (Jose Luis Gonzalez/Reuters)

President Trump visited Dayton, Ohio, on Wednesday, meeting with medical personnel and police officers a few days after a mass shooting in the city. From there, he flew to El Paso, where a similar outreach was planned.

But these were, in other ways, significantly different visits. Trump won Montgomery County, Ohio, home of Dayton, by a narrow margin in 2016. It’s mostly white, with a small Hispanic population. The motivation behind the weekend shooting in Dayton remains murky, but it doesn’t seem to have anything to do with Trump.

The shooting in El Paso, though, was allegedly carried out by a 21-year-old man who is thought to have written an anti-immigrant screed posted online that echoes Trump’s rhetoric. The El Paso gunman apparently targeted Hispanics in particular, killing 22 people in a county that is heavily nonwhite and that Trump lost by more than 40 points three years ago. However placid his reception in Dayton, it’s unlikely that Trump would expect the same response in Texas.

Trump’s career in politics has been heavily predicated on race. His hard-line approach to immigration was central to his winning the Republican primary, and his election depended largely on support from white Americans, a demographic he won by 20 points. That relationship made us curious: What are the places that sit farthest out at the combination of support for Trump and density of nonwhite or immigrant residents?

There is, as you’d expect, a correlation between the density of the nonwhite population and the 2016 vote. The more heavily nonwhite a county, the more heavily it tended to vote against Trump. But there were a number of counties — 120 in total — in which the population was mostly nonwhite and the president got more votes than former secretary of state Hillary Clinton, a Democrat.

Fifty-nine of those counties are in Texas. That includes Hudspeth, Pecos and Deaf Smith counties, which have heavily nonwhite (and heavily Hispanic) populations but which Trump won. (In part, that’s probably a function of the density of the noncitizen populations in those counties, but we’ll come back to that.) South Dakota’s Ziebach County also backed Trump, but it cast only 368 votes for Trump.

(Philip Bump/The Washington Post)

In fact, most of those counties are pretty empty. Counties Trump won that are majority nonwhite gave him an average of 12,200 votes. Overall, counties he won gave him an average of 14,700 votes — and counties he lost gave him an average of 49,400. (That’s because he lost relatively few counties, many of which were home to big cities.)

(Philip Bump/The Washington Post)

So how did Trump support compare with the density of the immigrant population? The Census Bureau has more limited data on the foreign-born population by county, covering about 480 counties in total. Again, though, there was a link between the density of the immigrant population and opposition to Trump in 2016.

The pro-Trump counties with the largest immigrant populations were Yuma County, Ariz.; Hendry County, Fla.; and Ford County, Kan. Trump barely won Yuma County, on the border with Mexico. Ford County is really the outlier here, backing Trump by 39 points. But while 28 percent of the county is foreign-born, only 7 percent is also naturalized and, therefore, able to vote.

(Philip Bump/The Washington Post)

We can look at this data in another way that’s also interesting: How does the nonwhite population compare with the shift from 2012 to 2016?

Again, Hudspeth County stands out. It voted more heavily Republican in 2016 than it had in 2012; it is also more than three-quarters Hispanic.

(Philip Bump/The Washington Post)

Notice, though, all of those blue circles at the top of the diagram. Those are counties that voted for Clinton but by a smaller margin than they supported President Barack Obama in 2012. The most heavily nonwhite counties were also ones where the Democrats did worse than they had four years earlier.

Why? In part because of the decline in the black vote in 2016 relative to 2012.

We see a more modest version of that effect when considering the interplay of immigrant populations and the shift since 2012. One of the heavily immigrant counties that voted more heavily Republican was Queens— Trump’s birthplace in New York, though that’s probably a coincidence.

(Philip Bump/The Washington Post)

Regardless, we have our answer to the overarching question. The county that’s the most heavily nonwhite but still backed Trump — even more than it backed former Massachusetts governor Mitt Romney four years prior — is Hudspeth County. More than four-fifths nonwhite, its 900-odd voters preferred Trump by 21 points in 2016.

Hudspeth is the second westernmost county in Texas. The westernmost, sitting right beside it, is El Paso.