From the wannabe mom in “Maggie’s Plan” to the wide-eyed veterinary assistant in “Wiener-Dog,” the past couple of years have presented Greta Gerwig with “such a diverse group of women I’ve been able to play,” the actress said.

Her two latest performances may seem to mirror extremely different women: the punk photographer Abbie in “20th Century Women,” and first lady Jacqueline Kennedy’s lifetime friend and White House personal assistant Nancy Tuckerman in “Jackie” (now in theaters). Yet for Gerwig, “as different as Abbie and Nancy Tuckerman are on the surface, they do share one common thread: a steadfastness of character and deep loyalty, which was intriguing to think about.”

In “20th Century Women” (opening Friday), Annette Bening is a single mother and boardinghouse landlord in Santa Barbara, California, in 1979. She decides to enlist the help of her tenants — Gerwig’s offbeat photographer and laid-back handyman William (played by Billy Crudup) — and her son’s best pal (Elle Fanning) to help her raise her son Jamie, played by Chicago native Lucas Jade Zumann.

As Gerwig explained the premise in a phone interview, “it kind of made sense, since Annette’s Dorothea Fields character is both a woman of her time and a woman ahead of her time. Dorothea was very much shaped by growing up in the Depression and her experiences during World War II. She had a child late in life, was raising him alone, plus had boarders in her home. That was especially unusual in Santa Barbara, which has a real streak of conservatism.

“I think a lot of people think of California as being hippie-dippy, but California has a very strong tradition of a very conservative mindset in many areas. That’s less showy than the hippie-dippy stuff in places like Santa Barbara, San Diego, Riverside and Sacramento — it’s often underplayed, but it’s there!”

Gerwig did a lot of research about the late ’70s and delved deeply into all aspects of creating the character of Abbie. What struck her about that era was that “everything in the 20th Century started to move so quickly. … Within a generation you could go from the first people who ever heard rock ‘n’ roll to the first people who ever heard punk music. That is a really swift jump. Especially in the last few decades of the century, every generation was experiencing this newest thing that the generation before it hadn’t experienced. Which hadn’t really happened until the 20th Century.

“Prior to that, people’s lives pretty much looked like their parents’ lives. Suddenly your life as a young person looked very different from what your parent’s life looked as a young person.”

Her character battles cancer, a subject Gerwig hadn’t realized was seldom discussed back then. “I didn’t realize it,” she said, “because I grew up in the ’90s — the era of very public breast cancer survivors, pink ribbons being worn and people shaving their heads to be in solidarity with women fighting cancer.

“When I learned that cancer in the 1970s was something you kept secret, I realized how psychologically that would have been such a different and very solitary, lonely experience. That was key to me finding the character and figure out what she was going through.”

Since her character of Abbie is a passionate photographer, “20th Century Women” director Mike Mills set Gerwig up with photography lessons in New York, where she learned how to use — and be completely comfortable with —  cameras from that period.

“This German woman taught me how to use [the cameras] and how to know everything about them. She taught me how to develop film and how to different things with it, to make it look a certain way. She made me take the camera completely apart, so I could understand how it all worked. I learned how to load the film without really looking at the camera, because if you’re a really good photographer, it’s like an automatic action.”

Gerwig laughed as she thought back on how her character was never seen without her camera. “It was all about making the camera an extension of who I was as that character. Naturally, everyone has that sense now, because everyone carries their cell phone around 24/7 — and that, of course, is a camera! But, in the ’70s, it was different. It was this separate piece of machinery that everyone did not carry around with them constantly like we do today.”