Jesus wanted his disciples to learn by his example, especially in how he prayed.
The Catechism of the Catholic Church highlights the way Jesus would pray in solitude:
Jesus often draws apart to pray in solitude, on a mountain, preferably at night. He includes all men in his prayer, for he has taken on humanity in his incarnation, and he offers them to the Father when he offers himself. Jesus, the Word who has become flesh, shares by his human prayer in all that "his brethren" experience; he sympathizes with their weaknesses in order to free them. It was for this that the Father sent him. His words and works are the visible manifestation of his prayer in secret.
His disciples would often see Jesus praying alone and then ask him how to pray:
"He was praying in a certain place and when he had ceased, one of his disciples said to him, 'Lord, teach us to pray."' In seeing the Master at prayer the disciple of Christ also wants to pray. By contemplating and hearing the Son, the master of prayer, the children learn to pray to the Father.
While Jesus would also pray in the company of his disciples, he did not only pray in common with other people.
He prayed with people and by himself, setting an example for us to follow.
In order to imitate Jesus' pray life, we need to incorporate both prayer in solitude as well as prayer in community. We cannot neglect either types of prayer.
Take a moment to examine your own prayer life and how often you pray in solitude.