# Legends again and again and again

GROUPS:
 David Keith 1 Vote I'm using Mathematica to analyze the results of Monte Carlo simulations (done with another tool) and produce graphics to include in a report for a client.ListPlot and similar functions accept PlotLegends, which is a bit inflexible, but works pretty good.Histogram, like ListPlot, will plot multiple data sets. But it won't accept PlotLegends. You can use Legended on the data sets, but you need to write the code to encapsulate each dataset together with its legend inside a Legended function.PairedHistogram would be useful. But it won't accept PlotLegends, and if you use Legended the histograms and the legends are all the same color. You can't tell them apart.Oh, when will this nightmare end?  Someday it would be nice to put legends in graphics without having to generate a one-page proof of Fermat's Last Theorem as part of the notebook.
6 months ago
6 Replies
Hi David, The attached notebook is what I keep handy for easy reference to many Plot and Legend Options. There are too many to remember and they are hard to find in the documentation. They use the new version 9 syntax and are based on an example from WRI tech support (when I had it). This is my first post after just joining the Community. I wanted to paste in the resulting plots, but it didn't work. Perhaps you can tell me how.
Hope this helps you; it sure helps me!

Jack Calman

 Attachments: Plots&Legend.nb
5 months ago
 David Keith 1 Vote Thanks very much, Jack. Very useful -- I will keep the notebook around!  And in the second group -- Same plot with custom Legend -- I think you have nearly proven Fermat's conjecture.For inserting plots, you need to export them as a graphic, and then use the insert picture icon. There's also a guide to posting which floats around -- I see it nearby to these posts now.Best regards,David
 Hi David, try this d1 = RandomVariate[NormalDistribution[2, 0.5], 10^3];d2 = RandomVariate[PowerDistribution[2, 0.5], 10^3];PairedHistogram[d1, d2, ChartStyle -> {{Red, Green}}, ChartLegends -> {"d1", "d2"}]