Python Automation and Machine Learning for EM and ICs

An Online Book, Second Edition by Dr. Yougui Liao (2019)

Python Automation and Machine Learning for EM and ICs - An Online Book

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

plt Plot Functions

 

Function Description
plt.imshow() Displays an image in a figure.
plt.plot() Plots data on a 2D graph (e.g., lines, dots).
plt.scatter() Creates a scatter plot.
plt.axis() Controls the appearance of the axes, including turning them off (e.g., plt.axis('off')).
plt.xlabel(), plt.ylabel() Sets labels for the x and y axes, respectively.
plt.title() Sets the title of the plot.
plt.grid() Shows or hides the grid lines in the plot.
plt.legend() Displays the legend for a plot, useful for labeled data points or lines.
plt.tight_layout() Adjusts the layout of the figure to make it fit better, removing excess padding.
plt.margins() Sets the margins for the axes (e.g., plt.margins(0) removes all margins).
plt.savefig() Saves the current figure to a file (e.g., PNG, PDF).
plt.show() Displays the plot or image in a window or GUI.
plt.gca() Gets the current axes (useful for fine-tuning plot parameters).
plt.axis('off')
plt.tight_layout(pad=0)
plt.margins(0)
plt.gca().set_position([0, 0, 1, 1])
Hide the axes and remove the extra white space around the image so it fits tightly (making the image smaller)