The abline function in R can be used to add a straight line to a plot. Unfortunately this function doesn’t exist in…
Matplotlib in Python
-
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Modify a Matplotlib Histogram Color (With Examples)
by Tutor AspireYou can use the following basic syntax to modify the color of a histogram in Matplotlib: plt.hist(data, color = “lightblue”, ec=”red”) where:…
- Matplotlib in PythonPython TutorialSoftware Tutorials
Display an Image as Grayscale in Matplotlib (With Example)
by Tutor AspireYou can use the cmap argument in Matplotlib to easily display images on a grayscale. The following example shows how to use…
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Use fig.add_subplot in Matplotlib
by Tutor AspireYou can use the following basic syntax to create subplots in Matplotlib: import matplotlib.pyplot as plt #define figure fig = plt.figure() #add…
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Reverse Axes in Matplotlib (With Examples)
by Tutor AspireYou can use the following basic syntax to reverse the x-axis and y-axis in Matplotlib: plt.gca().invert_xaxis() plt.gca().invert_yaxis() The following example shows how…
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Set Axis Ticks in Matplotlib (With Examples)
by Tutor AspireYou can use the following basic syntax to set the axis ticks in a Matplotlib plot: #set x-axis ticks (step size=2) plt.xticks(np.arange(min(x),…
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Add Title to Subplots in Matplotlib (With Examples)
by Tutor AspireYou can use the following basic syntax to add a title to a subplot in Matplotlib: ax[0, 1].set_title(‘Subplot Title’) The following examples…
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Use “%matplotlib inline” (With Examples)
by Tutor AspireYou can use the following code to display and store Matplotlib plots within a Python Jupyter notebook: %matplotlib inline Here’s how this…
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Create a Matplotlib Plot with Two Y Axes
by Tutor AspireThe easiest way to create a Matplotlib plot with two y axes is to use the twinx() function. The following example shows…
- Matplotlib in PythonPython TutorialSoftware Tutorials
How to Change Order of Items in Matplotlib Legend
by Tutor AspireYou can use the following chunk of code to change the order of items in a Matplotlib legend: #get handles and labels…