Poland wasn't actually "spared", it was merely less affected than the rest of Europe. That graphic is incorrect (or rather, incomplete), since a substantial number of both Poland and Milan's population did in fact die of the plague. Their death rates were only "low" in comparison to the rest of Europe - if it happened today, it would be horrifying to us.
Poland lost about a quarter of its population to the plague (...) Milan's death rate was less than 15%, probably the lowest in Italy save a few Alpine villages.
- Gottfried, Robert S. Black Death. New York: The Free Press, 1983.
Nonetheless, it is true that Poland did survive the Black Death relatively unscathed. In addition to Poland's relatively sparse population, a key factor is that King Casimir the Great wisely quarantined the Polish borders. By holding the plague off at the borders, the disease's impact on Poland was softened.
During Kazimierz's reign, the Black Death, a pandemic infection, swept across Europe, killing millions. But Poland established quarantines at its borders, and the plague skirted Poland almost entirely.
- Zuchora-Walske, Christine, Poland, North Mankato: ABDO Publishing, 2013.
The quarantine's effectiveness was further enhanced by Poland's relative isolation. While heavily hit regions such as the Mediterranean coast were densely interlinked with trade, the same was generally not true of Poland. When the Black Death arrived, this isolation helped insulate the Poles from the plague.
[M]uch larger areas, such as central Poland ... locations 'off the beaten trail' and not along the more popular trade routes were more likely to be on the lookout for ill travelers, 'foreigners', or perhaps not even be visited by outsiders at all. We believe that it was the exclusion of medieval traders and pilgrims that would significantly account for the lightly-affected Medieval Black Death regions
- Welford, Mark, and Brian H. Bossak. "Revisiting the Medieval Black Death of 1347–1351: Spatiotemporal Dynamics Suggestive of an Alternate Causation." Geography Compass 4.6 (2010): 561-575.
Additionally, it has often been claimed that that Poland fared better due to having fewer rats. Two popular explanations offered for this theory is that Poland had more cats, or alternatively less food for rats.
The absence of plague in Bohemia and Poland is commonly explained by the rats' avoidance of these areas due to the unavailability of food the rodents found palatable.
- Cantor, Norman F. In the Wake of the Plague: The Black Death and the World It Made. Simon and Schuster, 2001.
It is, however, more likely that the local climate was simply less conductive to the plague's spread.