I would like to plot some time series of some data (x axis as time, y axis as some arbitrary data) in Python 2.7.
I need some part of the plot in another color\\thicker line\\vertical border to emphasize that this is the part of the plot that I want people to pay attention to.
I used matplotlib for the plot and I will be happy to keep working with it, but other ideas good too.
I tried this draw with matplotlib but this only tells me how to plot in general i tried this colors in matplotlib but this allowed to give different colors to different graph lines and i need to emphasize a part of the same line (a part of the dataset)
One approach would be to plot the highlighted section a second time as follows:
import matplotlib
import matplotlib.pyplot as plt
from datetime import datetime
x = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
y = [1.2, 1.5, 2.1, 5.7, 8.3, 10.5, 8.5, 7.3, 9.0, 15.3]
bold = slice(3, 6)
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.set_xlabel('Time')
ax.set_ylabel('Data')
plt.setp(ax.get_xticklabels(), size=8)
ax.plot(x, y, 'b-', linewidth=2)
ax.plot(x[bold], y[bold], 'y-', linewidth=5)
ax.scatter(x, y)
ax.scatter(x[bold], y[bold], edgecolors='y', linewidths=5)
plt.grid()
plt.show()
This would give you:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.