Setting can be used in many ways. No only can it be used to provide a background for a story, but it can also be used to influence a theme. Take, for example, Chapters 17-22 of To Kill a Mockingbird. The setting of these chapters is the courthouse in Maycomb, Alabama. A theme in this passage is that justice does not always prevail, even when it’s expected to most.
In a courtroom, one would always expect the truth to be told and for the right decisions to be made. However, Mayella & Bob Ewell both lie on the stand. In addition, Atticus clearly proves Tom Robinson ‘ s innocence. You expect Tom to be let go because the case seems clear cut, especially because of the setting. However, he is convicted of raping Mayella Ewell. This turn of events adds to the situational irony and shows how the setting can support a theme.
Hope that helps you!