Hidden beneath a painting of the enigmatic Tudor polymath John Dee performing an experiment for Elizabeth I is a dark and slightly terrifying secret, research has discovered.

X-ray imaging of the stately Victorian artwork has revealed that Dee was originally surrounded by human skulls before the ghoulish image was painted over, probably because it was too odd for the buyer. But curators of an exhibition opening on Monday believe it sums up the conundrum of Dee: should we remember him as brilliant pioneering scientist, or as an occultist who thought he could talk to angels?

The question arises at the Royal College of Physicians (RCP) headquarters in London, where remarkable books from Dee’s personal collection go on public display for the first time.

Dee, known in his day as “the Queen’s conjuror”, was one of the most extraordinary Elizabethans, a Renaissance polymath who has fascinated people for centuries. He may have been the inspiration for Shakespeare’s Prospero in The Tempest, and more recently he has intrigued artists such as Derek Jarman, who had him as a central character in his 1978 film Jubilee, and Damon Albarn, who wrote the 2011 opera Dr Dee.

The exhibition’s curator Katie Birkwood said: “He is one of Tudor England’s most interesting and enigmatic figures and we are exploring that without coming down with a view on whether he is a scholar, courtier or magician. He is all of those and more.”

Detail of skulls discovered in Glindoni’s painting of John Dee. Photograph: National Gallery, London/Wellcome Library

The discoveries in the painting by Henry Gillard Glindoni could be a metaphor for the whole show, said Birkwood. It imagines a scene with Elizabeth visiting Dee’s house in Mortlake. To her left are her chief adviser William Cecil and her favoured courtier Sir Walter Raleigh. Seated behind Dee is his medium, or scryer, Edward Kelley, who is wearing a long skullcap to conceal the fact that his ears had been cut off, probably a punishment for a youthful crime.

Dee is performing some sort of experiment. “It looks like the sort of dramatic thing chemistry teachers do at the end of term,” said Birkwood.

The x-ray imaging commissioned for the exhibition reveals that Dee was originally standing in a circle of human skulls. Why Glindoni painted them out is unknown, but Birkwood said it was easy to imagine it was on the instructions of the probably unnerved person who commissioned it.

“Glindoni had to to make it look like what we now see, which is august and serious, from what it was, which was occult and spooky. That epitomises the two different impressions of Dee which people have and the fight between them.”

The RCP is putting on display examples of Dee’s books, part of a collection of more than 100 it has owned since the 17th century. They reveal some fascinating insights into Dee’s mind and what may be the first written example of British sarcasm.

Dee got into many scrapes in his life and in 1555 was placed under house arrest for casting royal horoscopes without permission. He writes in the back of one book that he is in the Fulham house of “his singular friend” the bishop of London, Edmund Bonner. Was he really a friend of his persecutor, a man known as “Bloody Bonner” for his ruthless treatment of heretics?

Birkwood said it was impossible to know. “Bonner was a horrible man, but they were both learned men and maybe they did get on. The tantalising thing is we can’t know.”

Elsewhere are examples of codes Dee invented. He used one to record the daily weather in August 1548 when he was studying at Louvain near Brussels; his symbol for windy looks like a modern hashtag.

“It is not a very difficult code to break,” Birkwood said. “I’m very used to his handwriting.”

Dee’s library of 4,000 volumes was one of the biggest and most remarkable in Europe and he seems to have read everything, diligently digesting and questioning all of it.

Dee clearly became frustrated that an account of the Trojan War by Dictys Cretensis omitted the best bit of the story. In one margin he wrote: “Nihil hic de equo Troiano,” which might be roughly translated today as “where’s the horse?”.

The books arrived in the RCP’s collection in slightly murky circumstances, in that they were originally stolen, although Birkwood stressed: “We are an innocent party.”

The story goes that Dee went travelling in the 1580s and left his brother-in-law in charge of his house. Either through negligence or malice, the brother-in-law allowed in people who then left with their pockets full. Dee returned after six years to find half his library gone.

One man called Nicholas Saunder stole a good number and it is these, a century later, that ended up in the RCP collection.

Dee is probably best known for his mysticism and his belief that he could talk to angels, and the exhibition includes loans such as Dee’s crystal ball and an obsidian magical mirror.

There are many who feel he should be known for better reasons, and it is a measure of Dee’s remarkable life that the exhibition is attracting interest from a strikingly diverse number of publications. Organisers expect articles in Pagan Dawn and the Catholic Herald, Nature and Fortean Times.

• Scholar, courtier, magician: the lost library of John Dee, a free exhibition at the Royal College of Physicians, runs 18 January-29 July.