We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [legending]

Questions on legends, figures (usually insets) that indicate what those lines/bars/points in plots refer to, using arrangements of graphic elements and text, whether manually or using built-in functions.

Filter by
Sorted by
Tagged with
68
votes
5answers
26k views

Creating legends for plots with multiple lines?

So I have a graph with multiple lists, for e.g. data = {{1,2}, {3,4}, {3,5}, {2,3} . . .} If I then do ...
59
votes
9answers
41k views

Labeling individual curves in Mathematica

I need to create a plot for export and inclusion in a report. Is there a better way to label curves than PlotLegends? From what I've read and my personal experience,...
44
votes
7answers
11k views

Sizing cells in a GraphicsGrid/GraphicsRow

I would like to add a colour bar to a plot. I tried to use GraphicsRow for this. In a GraphicsRow, each item is given the same ...
42
votes
5answers
12k views

ListPlot with each point a different color and a legend bar

I would like to generate a ListPlot with the color for each point in the plot corresponding to a particular value (not associated with the position in the plot). I'...
34
votes
2answers
10k views

Logarithmic scale in a DensityPlot and its legend

I was recently faced with the task of creating a DensityPlot with a logarithmic colour scale, and with providing it with an appropriate legend. Since I could not find any resources to this effect on ...
34
votes
3answers
28k views

How can I save both the plot and the legend together?

In this example, how can I put the legend inside the graph? Currently, when I save the graph, only the graph is saved, not the legend. ...
33
votes
3answers
8k views

ShowLegend values

How do I get ShowLegend to put the max and min values that a plot produces. for example, when using ListDensityPlot, with ...
30
votes
2answers
771 views

Poets of the 19th century

...
29
votes
7answers
3k views

Make legend same height as plot

One common style for density plots is to have a vertical legend that is the same height as the plot itself. Some example density plots from Google Image search: How can we make DensityPlots with ...
27
votes
7answers
8k views

Using PlotLegends with Show messes up the graphics

I have already obtained the plot that I want but am having trouble legending the graph correctly. ...
21
votes
4answers
7k views

Setting the default font for PlotLegends

I'm pleased that Mathematica 9 appears to have brought us prettier legends. If I always want the legend in ...
19
votes
5answers
2k views

How can I change the thickness of tick marks in BarLegend?

Bug introduced in 10.1 or earlier and persisting through 11.0.1 or later This answer explains how to change various undocumented options for BarLegend with ...
19
votes
2answers
1k views

How can I generate a legend for a BubbleChart?

Is there a way to make a nice disk radius legend (with linear or log scale) for a BubbleChart? Something like the following example should be built in:
19
votes
2answers
24k views

Formatting legend text font

I am using this code to plot a graph, and I am trying to make the font of the legend bigger. ...
17
votes
4answers
7k views

Changing the tick labels in a BarLegend

In the following plot, the colors mean the phase, so I need to label the color bar not in integers, but in increments of $\pi$. I searched, but could not find how to change the ticks. Does anyone have ...
17
votes
3answers
6k views

How can I change the size of the plot markers

I use ListPlot in order to plot four sets of data and also insert legends in my plot. Here is the Mathematica code ...
17
votes
2answers
3k views

Changing the inter-item spacing in Legends (version 9 and up)

The legending functionality in versions 9 and higher is much easier to use than the PlotLegends package and other bespoke ways of creating legends in earlier ...
16
votes
2answers
1k views

How to raise the LegendLayout “Row” size

When using LegendLayout->"Row", with a lengthy row, I get line breaks. This would seemed logic if it was confined by another structure. But if happens even when ...
16
votes
4answers
6k views

Why are PlotLegends not combined with Plots?

I'm using PlotLegends in v9. It seems that in the documentation examples, plots and legends are combined into one graphic: Here's an example from ...
16
votes
1answer
4k views

Control BarLegend size

I want to plot a big 2D array of experiment data. I need plot axes and tick labels as well as a bar legend using BarLegend: ...
16
votes
2answers
3k views

PlotLegends -> “Expressions” not working when Plot given one function

I don't get a legend when I use the option PlotLegends -> "Expressions" when the first argument to Plot is a single function. It works OK when I give ...
15
votes
4answers
6k views

How to add a common color legend to a grid of density plots?

I have a grid of density plots, say something like: GraphicsGrid[Partition[Table[ DensityPlot[Sin[i x] Sin[y/i], {x, -4, 4}, {y, -3, 3}], {i, 1, 4}], 2]] I ...
15
votes
1answer
403 views

PlotLegends won't generate automatically more than 15 labels in v10

Update: NOT fixed in v 10.1.0 (Mar2015) While testing the examples from this recent post, i've noticed a problem in V.10 with PlotLegends when it has to ...
14
votes
5answers
2k views

Changing the order of elements in a chart legend

In a stacked BarChart or Histogram the bars are stacked from bottom to top, while the legend entries are listed from top to ...
14
votes
1answer
3k views

Straightforward way to make a multicolumn line legend?

I have a plot showing 8 curves, and I'm able to define a line legend styled in either a column or a row version. I have the following code: ...
14
votes
2answers
7k views

Too much whitespace in a GraphicsGrid containing Legended Plots

Where is all the vertical whitespace coming from, and how do I get rid of it? ...
14
votes
1answer
2k views

Number format in Legend Labels

I would like to use the usual (new and nice) BarLegend[] with something like BarLegend[{"LakeColors", 1/10000 {-2, 2}}] which ...
13
votes
3answers
993 views

In version 9 PlotLegends, how can I remove the strange edges that appear around LegendMarkers?

I'm running Mathematica version 9. I am using ListPlot to plot two sets of data. For each data set, I am using different ...
13
votes
2answers
843 views

How can I get LineLegend to pick up my plot's BaseStyle?

The new legends functionality in version 9 really simplifies creating legends, and it automatically picks up the styles of the lines. ...
13
votes
3answers
10k views

Legend of a plot: how to increase the size of the line/marker?

I'm using the following kind of code to do the legends of my plots: ...
13
votes
2answers
20k views

Plot legend inside a Show [duplicate]

Possible Duplicate: Using PlotLegends with Show messes up the graphics I have created a composite plot function: I want to add a legend to it, however ...
13
votes
3answers
951 views

Changing BarLegend border style

I want all the lines in my plot to be a consistent style, let's say thick and black for the purpose of this question. ...
13
votes
1answer
459 views

BarLegend changes in Version 10

Apparently, BarLegend in version 10 displays tick legends in scientific notation when they are smaller in magnitude than 0.01. For instance, ...
12
votes
3answers
1k views

Match colors to plot themes

How do I get the colors to match the plot theme when I use a PlotLegend that is separate to the plots? I have had a look at How to access new colour schemes in ...
12
votes
3answers
2k views

How do I change the Font in BarChart Legend?

Just wondering if anyone knows the proper Syntax to change the Text properties in the BarChart's ChartLegend. I cannot seem to figure out how to get Style[] to apply. Here is an example: ...
12
votes
2answers
675 views

Vertical (mis-)aligning of plotmarkers and legend text in V10 PlotLegends

Consider this example, taken from the docs and modified for a larger font size using Style (V10.0): ...
12
votes
3answers
2k views

Adapt ticks in plot and font in legend

Some of my 2-dimensional data are displayed with a code similar to this: ...
12
votes
1answer
352 views

ArrayPlot gives wrong plot legend, how to fix?

Bug introduced in 10.0 and fixed in 11.2.0.0 My minimal working example is the code ArrayPlot[{{1, 0.1, 0}, {0.1, 0, 0}}, PlotLegends -> Automatic] The plot ...
11
votes
3answers
1k views

Using PlotLegends with a numeric PointSize

Using PlotLegends with a PlotStyle containing (for instance) PointSize[0.02] creates a ...
11
votes
2answers
4k views

Getting a correct custom legend for contourplot?

I am having trouble making a custom range for a legend in ContourPlot since the legend doesn't "talk" to the PlotRange and ...
11
votes
4answers
396 views

BarLegend can't make spaced contours when contours number>11

According to Document of BarLegend,BarLegend will select equally spaced contours: BarLegend[cf,contours] generates a legend that identifies color ranges from the color function cf based on the ...
11
votes
1answer
213 views

Highlight line in plot

I have a plot with many functions. Some of the functions overlap. In Maple, when you plot functions with legends, you can just click on the legend and it highlights the corresponding line. Does ...
11
votes
1answer
3k views

How to position legends exactly where I want them?

I just noticed another plot legend question today and while user solutions to this, in particular code by @Jens, are IMO better than the built in solutions, exact positioning often still requires some ...
11
votes
1answer
1k views

Font size in PDF export with legended plots not working

I need to export plots as PDF with a given image and font size. Everything is working fine if there is no legend for that plot. However, if I want to export legended plots, the font size is decreased ...
10
votes
3answers
582 views

Attaching a legend to BallAndStick picture

I am looking for a way to add a legend showing the identity of various atoms (with different colours) to this picture. Any Clues? ...
10
votes
2answers
2k views

Placing a legend to partially overlap with the plot

I find myself extremely confused about how Placed works with plot legends. I want my legend to partially hang over one edge of the plot. But ...
10
votes
3answers
942 views

How to use legends from PlotLegends in LevelScheme?

I've been attempting to find efficient ways to generate graphics with legends for export, and have been working with both LevelScheme and the new (to v9) ...
9
votes
5answers
17k views

How to add PlotLegends in a Show function?

I have multiple ListPlot in a Show where i want to add PlotLegends, but adding the PlotLegend...
9
votes
2answers
558 views

Reverse GrayLevel (not same as GrayTones)

I'm trying to make a color bar with reverse GrayLevel, i.e, like bl1 below, but reversed. bl2 gets quite close, but the white end isn't quite maxed out, it looks slightly grey. I tried the trick from ...
9
votes
4answers
197 views

ChartLegends and BarChart Ignores ColorFunction

In version 11.0.1 it appears that ColorFunction is being ignored for BarChart with grouped data. With ...