在ROOT的THistPainter类中使用CONTour选项时,如何添加色阶?
When using CONTour options in ROOT's THistPainter class, how to add a colour scale?
i当前有编码来创建一个来自输入的数据集
的续图 const int NbinX = 45;
const double binXlow = 0.0;
const double binXhigh = 2.0;
const int NbinY = 45;
const double binYlow = 0.0;
const double binYhigh = 200.0;
TH2D* hist3 = new TH2D("hist", "hist", NbinX, binXlow, binXhigh, NbinY, binYlow, binYhigh);
// read in your file
ifstream fin("data.dat");
// while loop to read in file (checks the input is good )
// ( x-val y-val z-val )
double x3 =-999.0; double y3=-999.0; double z3 = -999.0;
while(fin.good()) {
fin >> x3 >> y3 >> z3;
if( !fin.good()) { break;}
// must check if good after reading and before using
hist3->Fill( x3 , y3 , z3) ;
// Note: here I just did everything in the while loop
}
TCanvas *c3 = new TCanvas("c3", "c3");
hist->Draw("CONT4")
但是,与我使用的其他颜色图不同,我使用此颜色图具有Z轴高度的颜色尺度。我需要做些什么才能获得cont情节?
要获得带有线条(而不是颜色)的轮廓图,您需要
hist->Draw("CONT1");
或
hist->Draw("CONT2");
而不是
hist->Draw("CONT4");
有关轮廓图的更多信息,请参阅此信息。
相关文章:
- 将成员变量添加到共享库中的类中,不会破坏二进制兼容性吗
- 如何在C++中从两个单独的for循环中添加两个数组
- POCO::PostgreSQL:如何将std::vector支持添加到`Binder::bind`
- 如何仅为一个函数添加延迟
- 如何防止 c++ 在从浮点型转换为双精度型(不适用于 IO)时添加额外的小数?
- 使用std::transform将一个范围的元素添加到另一个范围中
- 如何将更多文件夹添加到c++include路径
- 如何将元素添加到数组的线程安全函数?
- QT通过C++添加映射QML项目
- 如何将点击的信号和插槽添加到qt中的自定义按钮中
- 如何使用重载的相等(==)运算符向测试用例添加描述
- 为什么Mat类的两个对象可以在不重载运算符+的情况下添加
- 如何防止clang格式在流运算符调用之间添加换行符<<
- 只能向C++添加一定数量的字符
- Qt和C++:将QLineEdit添加到QTabWidget中
- 将QIcon添加到QTableView单元格
- 为什么我必须在C++中添加一个赋值符号来声明一个数组
- 为什么除非添加括号,否则构造函数上的模板替换会失败?
- 将图像添加到资源文件夹UWP C++
- Visual Studio是否不知从何而来地添加依赖项