Train would probably be easiest for most legs, and could be used for all.
Madrid to Seville is a direct train, about 3 hours.
Seville to Granada usually requires a change in Cordoba, but some trains are direct, also about 3 hours.
Granada to Barcelona is less straight forward. There may be buses, but train would be faster. Basically the route is Granada to Madrid, then Madrid to Barcelona. Each leg is 3 hours, maybe a bit more, but leave a decent buffer in Madrid to change trains, so plan maybe 7 hours. That is long enough that flying might be tempting, certainly look, there are direct flights by both Vueling and Iberia, takes 1 hour 30 minutes, but figure close to a half hour to get to the airport outside Granada, being there two hours early, then about a half hour to get to Barcelona center from the airport, so really, 4 1/2 hours, but still saving you 2-3 hours over the train.