plotting – How to know if parameters should be given to DensityPlot or to BarLegend?


Consider the following example:

DensityPlot(10^(LogTQ)*10^(LogA),{LogTQ,-2,1},{LogA,2,6},PlotLegends->BarLegend(Automatic,LabelStyle->Directive(30),LegendLabel->"Log10(Subscript(P, C))"),FrameTicksStyle->Directive(30),FrameLabel->{"Log10(Subscript(T, Q))","Log10(A)"} ,LabelStyle->Directive(30),PlotRange->All,ColorFunction->"SunsetColors")

It produces the following:

enter image description here

My question is:

Here I figured out that putting the ColorFunction as option for DensityPlot works. I also tried the following:

DensityPlot(10^(LogTQ)*10^(LogA),{LogTQ,-2,1},{LogA,2,6},PlotLegends->BarLegend("SunsetColors",LabelStyle->Directive(30),LegendLabel->"Log10(Subscript(P, C))"),FrameTicksStyle->Directive(30),FrameLabel->{"Log10(Subscript(T, Q))","Log10(A)"} ,LabelStyle->Directive(30),PlotRange->All)

And this time the color bar doesn’t has the same color.

My question is: How can I know to who I should pass the parameters about the legend ? I would like a general “conceptual” answer (but for a beginner please !). For instance if I want to choose a min/max value for my legend should I specify it to the DensityPlot or to the BarLegend ?