Hello,
what I would like to do with the astroImage class is something similar to what the hist class can do. I understand that the AstroImage class and hist class are different, but it would be be good to have for instance the possibility to have a log z axis, and at the same time the coordinate system facilities which AstroImage has. For instance it seems to me that AstroImage does not allow any log z axis. To give you an example of what I would like to do with AstroImage I copy and paste here a short code which I wrote to plot a fits file with the hist class. Thanks a lot !
Sabrina
#include “Riostream.h”
#include “TROOT.h”
#include “TPaletteAxis.h”
#include “TVirtualPad.h”
#include “TStyle.h”
#include “TMath.h”
#include “TView.h”
#include “TH1.h”
#include “TGaxis.h”
image_pion_decay_conv()
{
// read a FITS image, convert it into a
// ROOT histogram and display it
const Int_t NRGBs = 5;
const Int_t NCont = 255;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
TFFloatImg * img =TFReadImage(“cosmicInjectorCONT10000yrGamma2PSFCTA.fits”,"", (UInt_t)1);
UInt_t begin[2] = {0,0};
UInt_t end[2] = {149,149};
img->MakeSubSection(begin, end);
TH2D *hist = img->MakeHisto();
int iold,jold;
TH2D *hist2 = new
TH2D(“hist2”,“pion_decay_conv”,150,340.06667,350,150,-5,4.93333);
for (int j=1; j<=hist->GetNbinsY(); j++) {
for (int i=1; i<=hist->GetNbinsX(); i++) {
hist2->SetBinContent(i,j,hist->GetBinContent(i,j));
}
}
TCanvas * win = new TCanvas();
win->SetLogz(1);
// gStyle->SetPalette(0);
double zMin(1.e-9), zMax(1.e-2);
hist2->GetZaxis()->SetRangeUser(zMin, zMax);
hist2->SetXTitle(“Galactic Longitude (deg)”);
hist2->SetYTitle(“Galactic Latitude (deg)”);
hist2->SetStats(0);
hist2->SetContour(99);
hist2->Draw(“colz”);
hist2->Write();
f1->Close();
TPaletteAxis palette = (TPaletteAxis)hist2->GetListOfFunctions()->FindObject(“palette”);
palette->SetLabelColor(0);
palette->SetLineColor(0);
palette->SetX1NDC(0.83);
palette->SetX2NDC(0.86);
palette->SetY1NDC(0.33);
palette->SetY2NDC(0.83);
palette->SetTitleSize(0.035);
palette->SetLabelSize(0.035);
palette->SetTitleOffset(1.5);
palette->SetTitle(“Gamma Spectrum”);
}
[quote=“Valeriy Onuchin”]Check how it is done here
root.cern.ch/root/html/src/TASPa … tml#aAwNfE
you can create a new palette or modify existent
Regards. Valeriy[/quote][/quote]