Why does PyWaffle raise a UserWarning and produce an unexpected pictogram with the "icons" argument?

130 Views Asked by At

I have been trying to follow the steps described in the PyWaffle documentation to use icons instead of the default blocks. Yet even when I run a simple example that I took from Python-Charts.com:

from pywaffle import Waffle
import matplotlib.pyplot as plt

# Data
value = [12, 22, 16, 38, 12]

# Waffle chart
plt.figure(
    FigureClass = Waffle,
    rows = 10,
    columns = 10,
    values = value,
    icons = 'face-smile')

plt.show()

I get the following error and an unexpected figure:

C:\Program Files\Python311\Lib\tkinter\__init__.py:861: UserWarning: Tight layout not applied. The bottom and top margins cannot be made large enough to accommodate all axes decorations.
  func(*args)

Unexpected result.

Running the code above, I expected the following result to be produced:

Waffle Chart with icons

However, the following example, also taken from the Python-Charts website, produces the expected results:

from pywaffle import Waffle
import matplotlib.pyplot as plt

# Data
value = [12, 22, 16, 38, 12]

# Waffle chart
plt.figure(
    FigureClass = Waffle,
    rows = 10,
    columns = 10,
    values = value,
    characters = '♥')

plt.show() 

Waffle Chart with characters

The error previously described only seems to occur when introducing the icons argument, yet the project that I'm working on needs to have a specific icon of a person in the graph.

0

There are 0 best solutions below