At 74 years of age, you could say that John Byrne, Scotland's most prolific portrait painter - not to mention one of its most talented playwrights - is somewhat overdue the retrospective now at the Scottish National Portrait Gallery.

I could be imagining it, but I swear I detected a note of rebuke in one of the numerous self-portraits hanging in the gallery.

Aptly titled Sitting Ducks - the artist's own appellation - this is an exhibition, as one might expect from an artist who has spent five decades painting self-portraits in myriad styles, in which the eyes of Byrne are upon you, sometimes disconcertingly so. Here, in large scale, a bobble-hatted portrait from the mid-1970s of the artist as a young man, palette in hand; here again, a diminutive fish-eye cameo of the painter, decades on. In between these reiterations of that familiar face, now bearded, now clean-shaven, come the faces of others. Family, friends, strangers and celebrities, Byrne paints on all scales, from portraits of his own sleeping children to a wild pastel of their mother, Byrne's former partner, the actress Tilda Swinton. Round a corner, his wife, Jeanine, gazes out from a lattice of flowers; on a wall, a towering and young Billy Connolly works an old denim pair of flares. In a few glass cases are a guitar painted with a portrait of its owner - the singer and long-time friend Gerry Rafferty - and a letter from the Surrealist Rene Magritte, in reply to a letter written by a young Byrne.

Seeming to stand apart, the larger-than-life early work American Boy, who poses with his rather nippy-looking cat, opens the exhibition, but this too is a portrait, contends curator Julie Lawson. "John insisted that we have this, and he was right," she says, admitting that she was initially sceptical of Byrne's desire to include the flag-bearing "boy". "It is a portrait. There's a lot of John in there."

If in every painter's work there is something of the artist him/herself, it is doubly true of Byrne. There too, is the technical facility, the artistic flair and the dark wit - so familiar from his stage plays - that has ensured Byrne's continuing acclaim.

John Byrne was born in 1940 and brought up on the now-bulldozed Ferguslie Park estate in Paisley. He wrote of his early apprenticeship in the AF Stoddart carpet factory in the Renfrewshire town in his hit theatrical trilogy The Slab Boys, after returning to work at the factory as a designer following stints at Glasgow School of Art and Edinburgh College of Art.

Of his artistic influences, Henri Rousseau, the self-taught Frenchman who inspired Picasso and the post-Impressionists with his luscious and dark depictions of jungle scenes, looms large, not least in the aforementioned prickly cat.

Indeed, Byrne's early success took direct inspiration from Rousseau when he alighted on the idea of selling his art to a London gallery as a self-taught or "primitive" painter. "Patrick" (Byrne's middle name) soon became a sensation; however Byrne - by then exhibiting successfully as himself - withdrew from exhibiting publicly in 1975 and did not do so again until the early 1990s. Writing filled the gap, from Tutti Frutti to his more recent reworking of Chekhov's Uncle Vanya - Uncle Varick - but Byrne never stopped painting.

If Byrne's portraits have remained his stock in trade, there is now, perhaps, a whiff of something else in the air. Just a few minutes' walk down the hill from the Portrait Gallery, Bourne Fine Art, who have been exhibiting Byrne's work since the early 2000s, have organised a show of new work, entitled Dead End, to coincide with the retrospective. Although there are a few self-portraits, including the wittily titled Big Selfie, the other works in the exhibition mark something of a departure for the artist.

"It's completely impossible with John," says Emily Walsh, director of Bourne Fine Art, who says she has given up trying to plan with the artist what any given exhibition will encompass. "He will not be drawn on what he's going to do. He always says, 'It depends what my imagination comes up with.' You can never predict what's going to come out of the studio." What they have, says Walsh, and what they expected to have, is simply the product of Byrne's imagination, given free rein in his "minute" Edinburgh studio over the last few months.

The pictures themselves, which range from Teddy Boy tableaux to fantastical night-time scenes, embrace a narrative ethos that Byrne had long dismissed and link, in many ways, back to that striking American Boy. "He's coming round to narrative work," says Walsh. "But of course he won't explain what it's all about."

Byrne only painted his first landscape two years ago, and the Bourne show includes a number of moonlit scenes replete with hunters being hunted, the tables disconcertingly turned. "If this is not Rousseau's jungle," Walsh says, referring to the leafy fantasies of Byrne's "hero", "it is the Scottish jungle, full of beasties and wild-eyed creatures. But like Rousseau's tigers, they only approximate to those creatures."

The "Underwood Lane" Teddy Boys are, she says, easier to get a handle on, as Byrne has referenced his Teddy Boy past a number of times in his work over the past 50 years. But there are hints of a familiar autobiographical iconography in the more fantastical works, too, "if you know what you're looking for".

"But these, of course, are not things that he will say himself," adds Walsh, smiling. "All he says is, 'What comes out of my head, comes out…'" And long may that continue.

John Byrne: Sitting Ducks, Scottish National Portrait Gallery, Edinburgh (0131 624 6200 , www.nationalgalleries.org) until October 19; John Byrne: Dead End, Bourne Fine Art, Edinburgh (0131 557 4050, www.bournefineart.com) July 3-September 1