THERESA THOMPSON admires the portrait work of a nation's favourite, David Hockney

You know that feeling when you go to a big party full of friends you've not seen for a while? You go from one room to another and everywhere you turn there's someone else. And each time a little frisson of shared memory passes between you. Some of course look different now; it's years since you last saw them.

This is what it felt like at the David Hockney: Portraits exhibition at the National Portrait Gallery, London, the first retrospective of his portraits spanning five decades, except that these were David Hockney's family, friends, lovers and associates, not mine, and they included some of the leading cultural figures of the 20th century, such as Andy Warhol, Man Ray, Richard Hamilton, Lucien Freud, J.B.Priestley and W.H.Auden.

More than 150 works are here taking over the whole of the ground floor of the gallery - paintings, drawings, prints, sketchbooks and photocollages from 1954 to 2005 - and like a photograph album they give a personal visual diary of the life of one of the country's most critically acclaimed and popular artists.

It includes some of Hockney's most personal and powerful works, starting with his very early self-portraits and studies of his father made during his student years at Bradford School of Art. He painted, drew or photographed his mother regularly right up until she died in 1999. She was always willing to do what was asked of her and sit still, he says, unlike his father Kenneth, a well-known Bradford character, who was a fidget.

"He used to get bored and would pick up a book," writes Hockney. "I painted that book he's holding in My Parents very carefully - he was actually reading it."

His affectionate portrait of My Parents (1977) with its wonderfully pared-down quality is one of the first you see at the exhibition. It draws you into a room full of family pictures, including Portrait of My Father, painted in 1955 when Hockney was 17 and the first he ever exhibited and sold (for £10 at Leeds).

My Parents was the last in a series of almost life-size double portraits made in the late 1960s and early 1970s. Some of these are now iconic, Mr and Mrs Clark and Percy (famously the cat was called Blanche but that name didn't sound as good) an image of swinging London' voted in a 2005 BBC radio poll into the top-ten greatest paintings in Britain', Henry Geldzahler and Christopher Scott (1969), and under a clear Californian sky, the American Collectors (Fred and Marcia Weisman) (1968). This last has a satirical edge; their fabulous sculpture garden is the subject as much as the upright figures of the couple, and he included the totem pole because it reminded him of Marcia.

Friends from London, Paris, New York and Los Angeles come thick and fast in the rooms devoted to them, relaxing, sitting, sleeping or getting out of a shimmering pool, recreating a vivid sense of the sixties and seventies pop generation.

As well as the large acrylic of them with their cat, Mr and Mrs Clark are also in several smaller works: fashion designer Ossie Clark suitably laid back in Ossie Wearing a Fairisle Sweater, and fabric designer Celia Birtwell, a lifelong friend and muse of Hockney, heavily mascara-ed and seductive in Celia in a Black Slip Reclining, and looking softly beautiful in Celia in a Black Dress with White Flowers.

I loved his pen and ink sketches and drawings in coloured pencil with just enough detail. They seemed so true to life, it was as if you knew the people in them.

Knowing is key. Hockney insists on getting to know his sitters. Portraits are a way of finding out more about the people he has in front of him and their relationships. He says if he works with faces already familiar to him he doesn't have to struggle so much for a likeness.

This is why he took tea with all 12 sitters for his 12 Portraits after Ingres in a Uniform Style exhibited at the Encounters exhibition in 2000 in which artists produced new work inspired by something in the National Gallery. I remember loving the sense of irony that made Hockney choose the attendants rather than an artwork, but I didn't know then that first he'd had tea with each one so he got to know their characters.

Although seldom taking commissions, sometimes he portrayed people he didn't know well but who struck a chord. The flamboyant figure of the transvestite film star Divine is one, painted in 1978 shortly after Hockney's return to live in Los Angeles. The super hot palette used reflects his utter delight in the brilliant light and colour of southern California. It is also reminiscent of the ornamental backdrops in Matisse's work, an artist he much admires.

Hockney delights in his sources of inspiration: Picasso, his hero since student days - witness The Student-Homage to Picasso of 1973 and his 1980s cubist-inspired photography and portraiture - Matisse, Bonnard, Holbein . . . not to mention Ingres, whom he calls "a fantastic artist" with great mastery of line and colour.

Self-portraiture has come in bursts, showing off his early bleached blond and owl-glasses look followed by greyer-headed versions. In the 1980s, possibly in response to increasing isolation due to deafness and the untimely deaths of friends, he entered a period of intense self-examination and for six weeks in 1983 set himself the target of one candid self-portrait a day.

I found the directness in one 1983 self-portrait irresistible. Leaning on to a table, charcoal in hand, his eyes fix on you astutely over the top of his big round glasses. It must be what it's like when he's sketching you.

Twenty years on in more or less the same pose Hockney depicts himself holding a brush. "I'm happiest when I've got a brush in my hand," he says. "I did explore photography . . . but it always took me back to painting. Ultimately, the hand does count. A brush in hand is the best thing. It flows down your arm."

And flowing for me as I left was a stream of flashbacks of the faces and figures seen - the large-eyed vulnerability of his ageing mother, long-term partners captured forever in tender drawings and paintings, and a host of celebrities in between. But the ever-pragmatic Yorkshireman remarks: "I am an active artist. I don't look back much myself. I leave that to other people."

And so it is. You have until January 21 to do so.