The square of opposition is a diagram that describes the logical relationship between four types of propositions. We explain how the relation-based square of opposition and the graded square of opposition, which are two variants of the classical square, can be obtained using some formal concept analysis operators.