# Controlling the size of Histogram in PlotLegends -> Histogram

I stumbled across this in the Mathematica documentation and thought it was pretty nifty except that the Histogram that appears as the plot legend is too small so the numbers on the histogram overwrite each other. How do you control the size of the histogram and it's annotation? I tried using LegendSize->2 and LegendSize->{2,2} but these failed. I also tried Needs["PlotLegends"] to no avail.

counties = EntityValue[Entity["AdministrativeDivision", {_,"Texas" | "NewMexico" | "Arizona" | "Nevada" | "California", "UnitedStates"}], "Entities"];
vals = EntityValue[counties, "PerCapitaIncome"];
pci = GeoRegionValuePlot[Thread[counties -> vals], PlotLegends -> Histogram]

• The above code fails for me on V13.0. Anyone else having this problem? Mar 7 at 2:07

In response to the Comment by @JEP, an alternative is to extract the two graphics and the caption from the original quantity, pci, in the Question

p1 = pci[[1]]
p2 = pci[[2, 1, 1, 1]]
caption = pci[[2, 1, 1, 2]]


and then combine them as desired. For instance,

Grid[{{Show[p1, ImageSize -> 360], Show[p2, ImageSize -> 250]}, {SpanFromAbove, caption}}]


Rather than making the Histogram larger, I suggest you measure vals in terms of $1000. Replace your last line by pci = GeoRegionValuePlot[Thread[counties -> Quantity[QuantityMagnitude[vals/1000], IndependentUnit["$K per year"]]], PlotLegends -> Histogram]


Dividing vals by 1000 expresses quantities in units of $1000. IndependentUnit["$K per year"] provides the label on the Histogram axis.

• This is a good work-around for the specific example at hand but my question was really one of principle. How do you control the size of the histogram?
– JEP
Jan 19, 2015 at 2:05
• @JEP, one approach is the method shown in my second answer. There probably are others. Jan 19, 2015 at 16:51

You can interactively resize the histogram Graphics with the drag handles:

Or programmatically, using the part spec as in bbgodfrey's second answer:

MapAt[Show[#, ImageSize -> 350] &, pci, {2, 1, 1, 1}]
`