Closed mattdm closed 3 years ago
I'm making 50×20 grids, so each block is 0.1%. I've found that with some data, the top right corner ends up empty. Here's a real-world example:
#!/usr/bin/python3 import matplotlib as m m.use("Agg") import matplotlib.pyplot as plt import matplotlib.dates as dates from pywaffle import Waffle m.style.use('seaborn-whitegrid') m.rcParams['font.size'] = 12 fig = plt.figure( FigureClass=Waffle, rows=20, columns=50, values={'32': 192,'33': 76,'34':59}, figsize=[16, 9], ) fig.savefig('test.png',dpi=300) plt.close()
This results in:
... with an empty square in the top right -- a total of 999 squares instead of 1000.
I assume this is because all values are getting rounded down.
You are right, the numbers are rounded.
Two options here:
Ah, perfect. rounding_rule='ceil' is perfect for my purposes. Thanks!
rounding_rule='ceil'
Result, for completeness:
I'm making 50×20 grids, so each block is 0.1%. I've found that with some data, the top right corner ends up empty. Here's a real-world example:
This results in:
... with an empty square in the top right -- a total of 999 squares instead of 1000.
I assume this is because all values are getting rounded down.