Hi,
I want to plot a palette to a TGraph, which should
show the color of some TMarker. The Labels should
be set to zero – “highestValue”. Is such a palette possible?
Thanks a lot in advance!
ps: the file is on http://christoph.kendel.de/data.txt
#include <stdio>
#include <algorithm> // for max_element
void macro()
{
FILE *input;
input = fopen( "data.txt", "r");
int x[1000], y[1000], z[1000];
float a[1000], val[1000];
int iMaxLines = 0;
for (int i=0;i<840;i++)
{
fscanf( input, "%d %d %d %f %f\n",&(x[i]),&(y[i]), &(z[i]),
&(a[i]), &(val[i]) );
iMaxLines++;
}
// calculates the Color-Scale
float highestValue = *max_element(val,val+iMaxLines);
Int_t colorsOfThePalette[50];
for(int i = 0; i<50>SetPalette(50,colorsOfThePalette);
// Plotting the TGraph with the TMarker
TGraph *gr = new TGraph(iMaxLines,x,y);
gr->Draw("AP");
Double_t *nx = gr->GetX();
Double_t *ny = gr->GetY();
for(int j=0; j<iMaxLines>SetMarkerColor(myColor);
m->Draw();
}
}
input = fopen( "data.txt", "r");
int x[1000], y[1000], z[1000];
float a[1000], val[1000];
int iMaxLines = 0;
for (int i=0;i<840;i++)
{
fscanf( input, "%d %d %d %f %f\n",&(x[i]),&(y[i]), &(z[i]),
&(a[i]), &(val[i]) );
iMaxLines++;
}
// calculates the Color-Scale
float highestValue = *max_element(val,val+iMaxLines);
Int_t colorsOfThePalette[50];
for(int i = 0; i<50>SetPalette(50,colorsOfThePalette);
// Plotting the TGraph with the TMarker
TGraph *gr = new TGraph(iMaxLines,x,y);
gr->Draw("AP");
Double_t *nx = gr->GetX();
Double_t *ny = gr->GetY();
for(int j=0; j<iMaxLines>SetMarkerColor(myColor);
m->Draw();
}
}