1

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.

  • 1
    Could it be that no version of `FontAwesome` is installed? – B Remmelzwaal Feb 28 '23 at 13:35
  • @BRemmelzwaal pip show fontawesomefree reveals that fontawesomefree-6.1.1 is installed. – RusticCitrus Feb 28 '23 at 13:40
  • pywaffle seems to sometimes have a problem setting the correct fontsize, but it is unclear what the exact circumstances are. See https://github.com/gyli/PyWaffle/issues/33 PyWaffle's maintainer can't reproduce the issue yet. – JohanC Feb 28 '23 at 16:02

0 Answers0