- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to plot arbitrary markers on a Pandas data series using Matplotlib?
To plot arbitrary markers on a Pandas data series, we can use pyplot.plot() with markers.
- Set the figure size and adjust the padding between and around the subplots.
- Make a Pandas data series with axis labels (including timeseries).
- Plot the series index using plot() method with linestyle="dotted".
- Use tick_params() method to rotate overlapping labels.
- To display the figure, use show() method.
import pandas as pd from matplotlib import pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True ts = pd.Series(np.random.randn(10), index=pd.date_range('2021-04-10', periods=10)) plt.plot(ts.index, ts, '*', ls='dotted', color='red') plt.tick_params(rotation=45) plt.show()
- How to make a 4D plot with Matplotlib using arbitrary data?
- How to create custom markers on a plot in Matplotlib
- Plot multiple time-series DataFrames into a single plot using Pandas (Matplotlib)
- How to plot CSV data using Matplotlib and Pandas in Python?
- How to plot a bar graph in Matplotlib from a Pandas series?
- How do you plot a vertical line on a time series plot in Pandas?
- How to make markers on lines smaller in Matplotlib?
- How to plot a kernel density plot of dates in Pandas using Matplotlib?
- How to plot two Pandas time series on the same plot with legends and secondary Y-axis in Matplotlib?
- How to plot events on time using Matplotlib?
- How to plot a Pandas Dataframe with Matplotlib?
- How to plot certain rows of a Pandas dataframe using Matplotlib?
- How to plot a rectangle on a datetime axis using Matplotlib?
- How to plot data against specific dates on the X-axis using Matplotlib?
- How to set same color for markers and lines in a Matplotlib plot loop?