An analogy is a comparison between two things, typically for the purpose of explanation or clarification. For example, “Life is a box of chocolates.” An analogy is saying something is like something else to make some sort of explanatory point. For example, “Life is like a box of chocolates—you never know what you're gonna get.” You can use metaphors and similes when creating an analogy.
One point to remember is that metaphors and similes are figures of speech, while an analogy is a type of argument.
hope it helps!