Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot specified data in thick line

I have a data file that includes several years' temperature records, I read-in the data file with Pandas and now it becomes a DataFrame below:

In [86]: tso
Out[86]: 
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 28170 entries, 2005-05-20 13:28:42.239999+00:00 to 2012-12-05           13:26:49.919999+00:00
Data columns:
Day      28170  non-null values
Month    28170  non-null values
Year     28170  non-null values
Temp     28170  non-null values
dtypes: float64(1), int64(3)

then I plot them according to 'Month'and 'year'columns:

ax=tso.groupby(['Month','Year']).mean().unstack().plot(linewidth=3,legend=False)
patches,labels=ax.get_legend_handles_labels()
ax.legend(unique(tso['Year'].values),loc='best')
plt.show()

enter image description here

now I want the last year's temperatures are plotted by thick line. What should I do?Is there any solution simple? Thank you!

like image 904
wuwucat Avatar asked Jan 24 '13 23:01

wuwucat


People also ask

How do you thicken a line on a graph?

When the line is selected you should see Drawing Tools tab added at the top of the screen above the Ribbon. Click this tab. In the Shape Styles block click Shape Outline. In the dropdown, move the cursor over Weight and then across to the right to select the required line thickness.

How do you plot a thick line in Python?

If you want to make the line width of a graph plot thinner, then you can make linewidth less than 1, such as 0.5 or 0.25. If you want to make the line width of the graph plot thicker, then you can make linewidth greater than 1. This thickens the graph plot.


1 Answers

You could do something like:

ax.lines[-1].set_linewidth(8)
plt.show()
like image 154
Andy Hayden Avatar answered Nov 01 '22 09:11

Andy Hayden