Dear Stata users,
I want to obtain a similar graph, that is commonly used to analyse trends in difference-in-differences.
Array
I am using the following code:
xtset municipality year
xtreg voting time2##newspapers controls, fe vce(cluster municipality)
margins time2#newspapers
marginsplot, xdimension(time2)

time is a variable that takes values between -24 and 23, but when I use it after xtreg, Stata replies "time: factor variables may not contain negative values". So I did: gen time2=time+25.
When I run the above code, I obtain after xtreg:

note: 44.time2 omitted because of collinearity
note: 46.time2 omitted because of collinearity
note: 47.time2 omitted because of collinearity
note: 48.time2 omitted because of collinearity
note: 1.newspapers omitted because of collinearity
note: 10b.time2#0b.newspapers identifies no observations in the sample
note: 11.time2#0b.newspapers identifies no observations in the sample
note: 11.time2#1.newspapers omitted because of collinearity
note: 12.time2#0b.newspapers identifies no observations in the sample
note: 12.time2#1.newspapers omitted because of collinearity
note: 13.time2#0b.newspapers identifies no observations in the sample
note: 13.time2#1.newspapers omitted because of collinearity
note: 14.time2#0b.newspapers identifies no observations in the sample
note: 14.time2#1.newspapers omitted because of collinearity
note: 15.time2#0b.newspapers identifies no observations in the sample
note: 15.time2#1.newspapers omitted because of collinearity
note: 16.time2#0b.newspapers identifies no observations in the sample
note: 16.time2#1.newspapers omitted because of collinearity
note: 17.time2#0b.newspapers identifies no observations in the sample
note: 17.time2#1.newspapers omitted because of collinearity
note: 18.time2#0b.newspapers identifies no observations in the sample
note: 18.time2#1.newspapers omitted because of collinearity
note: 19.time2#0b.newspapers identifies no observations in the sample
note: 19.time2#1.newspapers omitted because of collinearity
note: 20.time2#0b.newspapers identifies no observations in the sample
note: 20.time2#1.newspapers omitted because of collinearity
note: 21.time2#0b.newspapers identifies no observations in the sample
note: 21.time2#1.newspapers omitted because of collinearity
note: 22.time2#0b.newspapers identifies no observations in the sample
note: 22.time2#1.newspapers omitted because of collinearity
note: 23.time2#0b.newspapers identifies no observations in the sample
note: 23.time2#1.newspapers omitted because of collinearity
note: 24.time2#0b.newspapers identifies no observations in the sample
note: 24.time2#1.newspapers omitted because of collinearity
note: 25.time2#1.newspapers omitted because of collinearity
note: 26.time2#0b.newspapers identifies no observations in the sample
note: 26.time2#1.newspapers omitted because of collinearity
note: 27.time2#0b.newspapers identifies no observations in the sample
note: 27.time2#1.newspapers omitted because of collinearity
note: 28.time2#0b.newspapers identifies no observations in the sample
note: 28.time2#1.newspapers omitted because of collinearity
note: 29.time2#0b.newspapers identifies no observations in the sample
note: 29.time2#1.newspapers omitted because of collinearity

For this reason, I obtain an empty graph. Could anyone explain me what I am doing wrong?

Here is an example of my data:
input long municipality float(year newspapers time)
1 1995 0 0
1 2002 0 0
1 2007 0 0
1 2012 0 0
1 2017 0 0
2 1995 1 0
2 2002 1 7
2 2007 1 12
2 2017 1 22
3 1995 0 0
3 2002 0 0
3 2007 0 0
3 2012 0 0
3 2017 0 0
4 1995 1 -13
4 2002 1 -6
4 2012 1 4
4 2017 1 9