Before setting up the attributes of a palette, the code below was used to get the Axis of the palette,
TPaletteAxis* palette=(TPaletteAxis*)h2->FindObject(“palette”);
but it failed, from the output comment, it showed palette was a nullptr.
but from result file, there is a palette member in TH2D class pointer “h2”, it is shown below: