When Margot Datz began painting the walls of the children’s room at the Edgartown Public Library last fall, she expected the work to take three or four months at most.

Six months later, Ms. Datz has finally added the final brushstrokes to her 65-foot-wide, floor-to-ceiling mural of marine life in four of the world’s seven seas. Along the way, the acclaimed artist and illustrator became a student and teacher as well. Diligently researching sea creatures by night, Ms. Datz has shared her discoveries with the schoolchildren and toddlers who come to the library every day.

“I would tell the kids to look up certain creatures, because their behavior was so unbelievable,” Ms. Datz said. Some students would sit by her side and draw their own sea life; she taped their artworks up alongside photos she copied from marine biology reference books such as Nudibranch & Sea Slug Identification and the Asia Pacific Reef Guide.

Adults — artists and fishermen among them — also dropped by to talk with Ms. Datz about what she was painting. Rarely has the creation of public art been such a public process.

“It was like going back to college — it changed me. It made me bigger,” Ms. Datz said of her six-month crash course in marine biology.

“One of the great qualities of an artist is this almost childlike sense of wonder,” said research librarian Nis Kildegaard. “She’s taken this project so far beyond what anybody expected.”

The colorful new mural, stretching the entire width of the children’s room, is as richly detailed and diverse as a real-world aquarium.

“It’s like a hologram: You walk up to it and see more and more,” Mr. Kildegaard said. “You really get sucked into it.”

Known for her often fanciful images and penchant for mermaids, Ms. Datz has embraced scientific accuracy without sacrificing the storytelling quality that distinguishes her paintings.

“As far as my imagination could possibly stretch in my lifetime, it couldn’t begin to touch the spectrum of diversity in the ocean,” she said. “You can’t make stuff like this up. It’s so diverse. It’s so wild.

“I was learning so much. Every day I felt as if the walls of my brain and my creativity got knocked down, and I got better.”

On the library walls, a red octopus appears to tiptoe across the sandy bottom on five tentacles, the other three curling daintily above. An undersea garden of corals blooms in a multitude of colors and shapes. Two dolphins appear to smile as they spot a crab seeking shelter in the coral bed; a giant sea clam keeps its ruffled lips tightly pursed.

Above the surface, a volcanic island smolders and sea birds skim the rippling waves as a whale breaches the surface, its flippers flung wide as if to embrace the sky.

And everywhere, there are fish and their fellow sea creatures: multihued angelfish swimming serenely, big-eyed squirrelfish clustering under a ledge, a bulky sea turtle flippering its way toward the surface.

“She didn’t have to make anything up, because the awesomeness of what the oceans contain is so amazing,” Ms. Kildegaard said.

There is just one exception: in one corner of the mural, nearby the library’s babies-and-toddlers area, Ms. Datz painted a golden-haired mer-baby modeled on her first grandchild.

“All kinds of crazy octopi”

The mural’s original theme of coral reefs was suggested by Debbie MacInnis, a diving enthusiast who was the children’s librarian in Edgartown for more than 40 years before she retired in November. After submitting a scale rendering of the painting, Ms. Datz began to research the marine life of coral reefs and discovered something she hadn’t taken into account.

“I realized that I had rendered what I would call an oceanographic cliché,” she said. “Many of the fish I selected would never have been seen in the same sea.

“This bothered me. It really did,” Ms. Datz continued. “The last thing the ocean needs is misrepresentation.”

Determined to make her painting an accurate reflection of undersea life, Ms. Datz launched into a cram session she estimates took some 120 hours of research.

“I became one of those ocean computer nerds, where at night I’d be having a cup of tea and reading about all kinds of crazy octopi,” she added with a laugh.

“I had never paid attention to sponges, and sponges are amazing,” she went on. “They’re beautiful and so diverse and support so much sea life, and they’re even discovering important medicines from some of these sponges.”

Ms. Datz wound up dividing the 65-foot expanse of walls into four of the world’s seas: the Caribbean, Pacific, Indo-Pacific and Indian oceans.

“To the best of my ability, I really tried to represent the sea life of each of those oceans in a compatible way,” she said.

“Some of the fish dwell at 55 feet and some dwell in shallow reefs, but they all would have been within the same waters.”

Why doesn’t the mural represent the marine life of the Cape and Islands, where Vineyard children live? Library director Lisa Sherman and Ms. Datz both said there was a deliberate decision to look beyond the region.

“There are lots of opportunities for kids to learn about where we live,” Ms. Sherman said. Ms. Datz added that she has already created a large-scale mural of local marine life, on a two-story-high wall in the community education room off the lobby of the Martha’s Vineyard Hospital.

Edgartown Library staff are looking ahead to high summer for a formal introduction of the mural, which was funded with private donations and grants. Mr. Kildegaard said the library also wants to work with Edgartown School teachers to connect the mural with curriculum.

“The projects that we could spin off from this are really mind-boggling,” he said.

Meanwhile, Ms. Datz is hard at work on her next project, for the Chilmark library. She describes the commission as “viewing Chilmark through the eyes of Thomas Hart Benton.”

Unlike the Edgartown mural, she will not be painting it in public: Ms. Datz is creating the work in her studio, on panels that will be installed at the library when they are finished.

Ms. Datz is also preparing for her annual solo art show at the Grange in West Tisbury on August 4 from 4 to 8 p.m. The theme for this year’s exhibition and sale is Party Animals.

Photos of the mural in progress

The new mural can be viewed any time the Edgartown Public Library is open: 10 p.m. to 5 p.m. Monday, Thursday, Friday and Saturday and 10 a.m. to 8 p.m. Tuesday and Wednesday.