You don't need to mention anything! It is implict in the presetation of a labelled graph that the number of A is being compared with the number of B.
Don't state the obvious I assume this is for writing an essay or something. If you have a graph which is properly labelled you don't need to say "This graph compares A and B" Anybody who looks at the graph can see that. Instead add value: Don't say, "This graph compares the number of hats sold and the number of belts sold." Say, "Sales of hats increased faster than belts post-pandemic, this was mostly led by trends among young men."
My example tells the reader something that they might not notice or be able to work out from the graph alone. Here is a typical example of what not to do

The paragraph "This graph compares consumer expenditures in three American Cities from 2007 to 2010", is completely redundant and should be cut out. I know it is a graph, I know it compares consumer expenditure, because the vertical axis is labelled "yearly household spending". I know it compares three American cities because the labelled "San Fransico", "Cleveland" and "Houston". I know it is from 2007 to 2010 because of the horizontal axis.