The way that HIV and AIDS are portrayed and discussed in the media has changed so much over the past several decades. It was only in 1981 — less than 40 years ago — that the New York Times published an article that became infamously known as the “gay cancer” story.

Today, we have vastly more knowledge about HIV and AIDS, as well as effective treatments. Along the way, filmmakers have created art and documented the realities of people’s lives and experiences with HIV and AIDS. These stories have done more than touch people’s hearts. They have raised awareness and spotlighted the epidemic’s human face.

Many of these stories focus especially on the lives of gay men. Here, I take a deeper look at five movies and documentaries that get it right in depicting gay men’s experiences in the epidemic.

More than 5,000 people had died from AIDS-related complications in the United States by the time “An Early Frost” aired on November 11, 1985. Actor Rock Hudson had died the month before, after becoming the first famous person to go public about his HIV status earlier that summer. HIV had been identified as the cause of AIDS the year before. And, since its approval in early 1985, an HIV antibody test had begun to let people know who had “it” and who didn’t.

The made-for-television drama drew a bigger TV audience than Monday Night Football. It won three of the 14 Emmy Award nominations it received. But it lost half a million dollars because advertisers were leery about sponsoring a movie about HIV-AIDS.

In “An Early Frost,” Aidan Quinn — fresh off his starring role in “Desperately Seeking Susan” — portrays ambitious Chicago lawyer Michael Pierson, who is eager to make partner in his firm. He’s equally eager to hide his relationship with live-in lover Peter (D.W. Moffett).

The hacking cough we first hear as Michael sits at his mother’s grand piano worsens. Finally, he collapses during after-hours work at the law firm. He’s admitted to the hospital for the first time.

“AIDS? Are you telling me I have AIDS?” says Michael to his doctor, confused and outraged after believing he had protected himself. Like many people, he doesn’t yet understand that he may have contracted HIV years earlier.

The doctor assures Michael that it’s not a “gay” disease. “It never was,” the doctor says. “Gay men have been the first to get it in this country, but there have been others — hemophiliacs, intravenous drug users, and it doesn’t stop there.”

Beyond the big hair and broad-shouldered 1980s jackets, the portrayal of a gay man with AIDS in “An Early Frost” hits home. More than three decades later, people can still identify with his dilemma. He needs to give his suburban family two pieces of news at the same time: “I’m gay and I have AIDS.”

By exploring the impact of HIV and AIDS on an intimate, personal level, “An Early Frost” set the pace for other movies that followed.

In 1989, for example, “Longtime Companion” was the first wide-release film to focus on the experiences of people with HIV and AIDS. The movie’s name comes from the term the New York Times used in the 1980s to describe the same-sex partner of someone who died from an AIDS-related illness. The story actually begins on July 3, 1981, when the New York Times published its article about the “outbreak” of a rare cancer in the gay community.

Through a series of date-stamped scenes, we watch the devastating toll that unchecked HIV and AIDS-related illnesses have on several men and their circle of friends. The conditions and symptoms we see include loss of bladder control, seizures, pneumonia, toxoplasmosis, and dementia — among others.

The famous closing scene of “Longtime Companion” became for many of us a kind of shared prayer. Three of the characters walk together along the beach on Fire Island, remembering a time before AIDS, wondering about finding a cure. In a brief fantasy sequence, they are surrounded, like a heavenly visitation, by their dearly departed friends and loved ones — running, laughing, alive — who too quickly vanish again.

Advances in medication have made it possible to live a long, healthy life with HIV, without progression to AIDS and its related complications. But more recent films make clear the psychological wounds of living for many years with a highly stigmatized illness. For many, those wounds can feel bone-deep — and can undermine even those who have managed to survive for so long.

Interviews with four gay men — Shanti counselor Ed Wolf, political activist Paul Boneberg, HIV-positive artist Daniel Goldstein, dancer-florist Guy Clark — and heterosexual nurse Eileen Glutzer bring the HIV crisis in San Francisco to vivid, remembered life in the 2011 documentary “We Were Here.” The film premiered at the Sundance Film Festival and won several Documentary of the Year awards.

“When I talk to young people,” Goldstein says in the film, “They say ‘What was it like?’ The only thing I can liken it to is a war zone, but most of us have never lived in a war zone. You never knew what the bomb was going to do.”

For gay community activists like Boneberg, the first director of the world’s first AIDS protest group, Mobilization Against AIDS, the war was on two fronts at once. They battled for resources to address HIV-AIDS even as they pushed back against the increased hostility toward gay men. “Guys like me,” he says, “are suddenly in this little group forced to deal with this unbelievable circumstance of a community that, in addition to being hated and under attack, is now forced alone to try to figure out how to deal with this extraordinary medical disaster.”

The Oscar-nominated documentary “How to Survive a Plague” offers a behind-the-scenes look at ACT UP-New York’s weekly meetings and major protests. It begins with the first protest, on Wall Street, in March 1987 after AZT became the first FDA-approved drug to treat HIV. It was also the most expensive drug ever to that point, costing $10,000 a year.

Perhaps the most dramatic moment of the film is activist Larry Kramer’s dressing-down of the group itself during one of its meetings. “ACT UP has been taken over by a lunatic fringe,” he says. “Nobody agrees with anything, all we can do is field a couple hundred people at a demonstration. That’s not going to make anybody pay attention. Not until we get millions out there. We can’t do that. All we do is pick at each other, and yell at each other. I say the same thing to you that I said in 1981, when there were 41 cases: Until we get our acts together, all of us, we are as good as dead.”

Those words may sound fearful, but they are also motivating. In the face of adversity and illnesses, people can show unbelievable strength. ACT UP’s second-most famous member, Peter Staley, reflects on this toward the film’s end. He says, “To be that threatened with extinction, and to not lay down, but instead to stand up and fight back the way we did it, the way we took care of ourselves and each other, the goodness that we showed, the humanity that we showed the world, is just mind-boggling, just incredible.”

That same kind of astonishing resilience appears in the gay men profiled in “Last Men Standing,” the 2016 documentary produced by the San Francisco Chronicle. The film focuses on the experiences of long-term HIV survivors in San Francisco. These are men who have been living with the virus far beyond their expected “expiration dates” predicted years ago based on the medical knowledge of the time.

Against the stunning backdrop of San Francisco, the film weaves together the observations of eight men and a woman nurse who has cared for people living with HIV at San Francisco General Hospital since the beginning of the epidemic.

Like the films of the 1980s, “Last Men Standing” reminds us that an epidemic as vast as HIV-AIDS — UNAIDS reports an estimated 76.1 million men and women have contracted HIV since the first reported cases in 1981 — still comes down to individual stories. The best stories, like those in the film, remind us all that life in general comes down to the stories we tell ourselves about what our experiences, and in some cases, suffering, “mean.”

Because “Last Men Standing” celebrates the humanity of its subjects — their concerns, fears, hope, and joy — its message is universal. Ganymede, a central figure in the documentary, offers a message of hard-earned wisdom that can benefit anyone willing to hear it.

“I don’t really want to talk about the trauma and pain I lived through,” he says, “partly because a lot of people don’t want to hear it, partly because it’s so painful. It’s important that the story live on but we don’t have to suffer through the story. We want to release that trauma and move on to living life. So while I want that story to not be forgotten, I don’t want it to be the story that runs our life. The story of the resilience, of the joy, of the happiness of surviving, of thriving, of learning what’s important and precious in life — that’s what I want to live on.”

Longtime health and medical journalist John-Manuel Andriote is the author of Victory Deferred: How AIDS Changed Gay Life in America. His most recent book is Stonewall Strong: Gay Men’s Heroic Fight for Resilience, Good Health, and a Strong Community. Andriote writes the “Stonewall Strong” blog on resilience for Psychology Today.