New answers tagged


The reason for this is that Mathematica use default options for plotting and labeling your graphics. On the case of plotting legends, by default Mathematica tries to print expressions in TraditionalForm. All this options can be customized. You can use StandardForm as follows: Plot[\[EscapeKey]ee \[EscapeKey], {x, -5, 5}, PlotLegends -> {StandardForm["\[...


dt = Range[3, 8]; SwatchLegend[ColorData["Rainbow"] /@ Rescale[dt], dt, LegendLabel -> Style["Happiness Score", 16], LegendLayout -> {"Row", 1}, LegendMarkers -> "Bubble", LegendMarkerSize -> 5 dt] Change the second argument from dt to Rescale[dt, MinMax@dt, {.02, .05}] to change the labels:


If you use the option ChartLegends in GeoBubbleChart and PlotLegends in GeoRegionValuePlot and combine the two plots with Show the legends are automatically combined: SeedRandom[7777] thirtycountries = RandomEntity["Country", 30]; population = DeleteMissing[# -> #[ "Population"] & /@ thirtycountries]; minmax1 = QuantityMagnitude@MinMax[population[[...


SeedRandom[1] fiftycountries = RandomSample[EntityList["Country"], 50]; selected = RandomSample[fiftycountries, 30]; data = # -> #[ "Population"] & /@ selected; others = Complement[fiftycountries, selected]; Easiest way to show the two plots together is to use the graphics primitives produced by GeoBubbleChart as Epilog in GeoRegionValuePlot: gbc = ...


Bob Hanlon in his comment to your question gives what I think is the way to go to solve your problem. I would like to make the further point that even if you use Placed to move the plot legends so that they look like they are outside the plot, they will still be part of plot when it is selected for copying or saving as an image.


I typically do something like this: Plot[ Exp[-t/10] Sin[\[Pi] t],{t, 0,10}, Frame->True, PlotLegends->Placed[ LineLegend[ {"Your labels"}, LegendLayout->{"Column",1}, LegendMarkerSize-&...


BarChart[Tooltip[#2, {##}] & @@@ data, Axes -> True] You can also use BarChart[Tooltip[Last @ #, #] & /@ data, Axes -> True] same picture Alternatively, you can set the option value for the option ChartLabels to Placed[data, Tooltip]: BarChart[data[[All, 2]], Axes -> True, ChartLabels -> Placed[data, Tooltip]] same picture


Recommend that you look at using Manipulate ClearAll["Global`*"] Manipulate[ Plot[ Evaluate@ Table[ Tooltip[ (-1 + a - a d)/((1 + b) (-1 + d)), Row[{"a = ", a}]], {a, -3, 3, 0.5}], {d, 0, 0.99}, Frame -> True, FrameLabel -> {Style["d", 12, Italic], None}, PlotLegends -> Range[-3, 3, 0.5], PlotLabel -> Simplify@ ...


Update: To make colors corresponding to a given value the same across legends with the same color function use a second argument that specifies the range of values: ClearAll[legendF2] legendF2[values_, range_, zerocolor_: White, cf_: "M10DefaultDensityGradient"] := SwatchLegend[Prepend[ColorData[cf] /@ Rescale[Rest@values, range], zerocolor], values, ...


Clear["Global`*"] SeedRandom[1234] data = RandomVariate[BinormalDistribution[.5], 100]; peak = MaxValue[PDF[SmoothKernelDistribution[data], {x, y}], {x, y}]; Legended[ SmoothDensityHistogram[data, Automatic, "PDF", ColorFunction -> "DarkRainbow"], BarLegend[{"DarkRainbow", {0, peak}}]]


Update: A slightly more direct approach to construct the bar legend using "PDFValues" property of data distribution object returned by SmoothKernelDistribution: Legended[SmoothDensityHistogram[data, Automatic, "PDF"], BarLegend[{"M10DefaultDensityGradient", {0, Max @ skd["PDFValues"]}}]] Original answer: A workaround: (1) Use the pdf of the ...

Top 50 recent answers are included