I want to add a dot line and text to my graph.
This is my original sns.plot code.
# set figure size
plt.figure( figsize = ( 12, 5))
sns.lineplot( x = 'date',
y = 'weekpay',
data = epi_raw_occ_2018_private,
label = 'Private Workers Wage')
plt.xlabel('time')
Thanks in advance
CodePudding user response:
If it's fixed in specific value in ths x-axis. Then this should do:
plt.axvline('2020-02-01',linestyle='.')
As for the text you could add:
plt.text('2020-03-01',1100,"this is the text that will be added")
You should fix the first array to match the desired x-axis and then on the y-axis no argument so it goes aling the full chart. An alternative is using weekpay
's min()
and max()
values for the y-axis in order to make the line cover the most of it. Finally linestyle='.'
is what makes it a dotted line.