|
||||||||
Adjusting Space around the Plot with Dummy Categories - Python Automation and Machine Learning for ICs - - An Online Book: Python Automation and Machine Learning for ICs by Yougui Liao - |
||||||||
Python Automation and Machine Learning for ICs http://www.globalsino.com/ICs/ | ||||||||
Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix | ||||||||
================================================================================= Adjusting space around the plot with dummy categories. Code: Output: Matplotlib treats string categories as discrete entities and assigns integer indices to each unique category so that adjusting space around the plot isn't as straightforward as modifying numeric limits. Instead, we need padding and margins to create the effect of spacing, as shown above, because we can't numerically offset string labels as we would with numbers. The dummy categories, df.loc[-1] and df.loc[len(df)], are used to insert empty string categories at the beginning and end of the DataFrame. This technique manipulates the plot to display additional space around the string categories. ===========================================
|
||||||||
================================================================================= | ||||||||
|
||||||||