Log 2 Axis


Is there a way to create a log base 2 axis?

Best regards and thanks,

I am not completely sure to understand what you are asking for. Let me assume that you want the X and Y axis with log scales. In that case simply do:


Sorry … I understand now… You want a " base 2" instead of a “base 10” axis.

There is no direct way to do that. Log axis are only base 10. You can try to draw a TGaxis using a function using ln2 but the label will not be 2^x like and also the X-Y space where the data will be plotted will not be Log as the Log10 one.

May be using a TGaxis using a function is enough for you ?

Thank you for the reply.

Yes, I would like to do base 2 instead of base 10.

I work in computer storage and there are many cases were we process a lot of data with base 2. It would be nice to have a way to handle base 2 in plots.

I noticed in the SetLogY and SetLogX documentation there was a note about interesting cases for using the supplied argument. Please consider this a request for base 2 to be one of those interesting cases :smiley:

I have found a way to get what I want using histograms and setting the bins appropriately. However, I don’t think the approach I am using is appropriate for the more general case.

Best regards,