Some of my 2-dimensional data are displayed with a code similar to this:
Needs["PlotLegends`"]
sampleData =
Transpose[{RandomVariate[NormalDistribution[0, 3*10^-6], 20000],
RandomVariate [NormalDistribution[0, 3*10^-6], 20000]}];
binning = {{-1*10^-5, 1*10^-5, 1*10^-7}, {-1*10^-5, 1*10^-5,1*10^-7}};
(*binning of my sampleData*)
maxBinnedData=Max[HistogramList[sampleData,binning][[2]]];
(*seachring for the maximum of the binned data*)
ShowLegend[DensityHistogram[sampleData,binning,LabelingFunction->None,
PerformanceGoal->"Speed",
ColorFunction->(If[1-#1===0,White,ColorData["Rainbow"][#1]]&),
ColorFunctionScaling->True,PlotRange->{{-1*10^-5, 1*10^-5},{-1*10^-5, 1*10^-5}},
FrameLabel->{"x", "y"},
LabelStyle->Directive[Black,FontSize->12,FontFamily->"Arial"],ImageSize->{500,500}],{(If[1-#1===0,White,ColorData["Rainbow"][1-#1]]&),11,
ToString[maxBinnedData],ToString[0],LegendTextOffset->{-2, 0},
LegendPosition->{1.1,-0.4},LegendShadow->None,
LegendLabel->Style["Counts",Black,FontSize->12,FontFamily->"Arial"]}]
The output is quite nice for my taste (see figure).
Yet, I want to improve two things, but all my attempts have been unsuccessfully so far.
First: How can I manage that the ticks are all in scientific form (e.g. $1.0\times10^{-5}$ instead of 0.00001)? Somehow I was not able to adapt the tricks of e.g. this post to my problem. I could do it perhaps by hand, but the scale is often different (e.g. from $-2.4 \times 10^{-5}$ to $4.0 \times 10^{-6}$) so that this will be unhandy.
Second: As perhaps can be seen, I try to use for all names and numbers the FontSize->12 and the FontFamily->“Arial”. That works fine except for the numbers in my legend (0 and 20). How do I have to change the font setting there? I tried things like Style[ToString[maxBinnedData], Black, FontSize -> 12, FontFamily -> "Arial"] instead of ToString[maxBinnedData] but nothing worked.
I would be happy if some people here could give me some hints!




ShowLegend[Show[hist, FrameTicks -> s1],{rest of my code}], I have even the legend again. Now I hope that somebody can help me with the second question. By the way, although it is not really important for me, how could I get rid of the dot at 0.? – partial81 Jun 11 '12 at 15:57