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
70 votes
5 answers
31k 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 ...
Eiyrioü von Kauyf's user avatar
47 votes
5 answers
14k 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'...
Cassini's user avatar
  • 5,556
35 votes
3 answers
9k 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 ...
Andrew Spott's user avatar
  • 1,581
40 votes
4 answers
16k 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 ...
Emilio Pisanty's user avatar
65 votes
9 answers
50k 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,...
Tianxiang Xiong's user avatar
47 votes
8 answers
15k 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 ...
Szabolcs's user avatar
  • 234k
46 votes
4 answers
37k 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. ...
Mika Ike's user avatar
  • 3,201
13 votes
3 answers
3k 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 ...
Hugh's user avatar
  • 16.2k
28 votes
7 answers
9k 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. ...
Julia's user avatar
  • 911
33 votes
7 answers
4k 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 ...
Andrew Moylan's user avatar
14 votes
2 answers
4k views

Set the same color scale across multiple ListContourPlots?

This is probably straightforward - but how would I set the same color scale across multiple ListContourPlots? if I have values from 10 to 25 on one ...
Doug Kimzey's user avatar
  • 2,279
14 votes
5 answers
3k views

How do you plot the same function with different options over different intervals?

Here is the motivation for my question. I want to plot Sin[x] over the interval 0 to 2 π, ...
Ben Allgeier's user avatar
19 votes
2 answers
573 views

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

Update: NOT fixed in V10.0 - 12.0.0 While testing the examples from this recent post, i've noticed a problem in V.10 with PlotLegends when it has to automatically ...
SquareOne's user avatar
  • 7,565
21 votes
2 answers
2k 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 ...
P. Fonseca's user avatar
  • 6,665
20 votes
5 answers
28k 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...
JavaCake's user avatar
  • 549
15 votes
5 answers
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 ...
Simon Woods's user avatar
  • 84.8k
10 votes
1 answer
2k views

How to add own description to BarLegend?

Is there a default-option possibility to add own defined names of the contour-labels in BarLegend? I want to have a string "hot" ...
szogun's user avatar
  • 141
9 votes
1 answer
1k views

Problem with custom ticks in BarLegend in Mathematica 11.1

Bug introduced in version 11.1 and fixed in 11.3.0 I think the bar legend custom ticks are automatically sorted in Mathematica 11.1. Am I making some stupid mistake here or is it a bug? This is with ...
Sumit's user avatar
  • 15.9k
8 votes
1 answer
25k views

Specify legend position in a plot

I would like to place the legend inside the plot frame. I have been doing a search in the documentation but only found option ...
user1993416's user avatar
8 votes
4 answers
9k views

How can I label a ListDensityPlot with a color bar?

Here is an example of what is desired, only the result wouldn't be a contour plot, but a ListDensityPlot. The arguments would be a gradient and a list of numbers.
M.R.'s user avatar
  • 31.4k
5 votes
3 answers
753 views

Bar legend coloring doesn't correspond to array plot coloring in the expected way

Execute this code: ...
a06e's user avatar
  • 11.3k
5 votes
2 answers
1k views

Spanning/centering elements with Grid/GraphicsGrid when there's a non-equal number of elem. in rows

I'm trying to align elements in Grid/GraphicsGrid: Grid[{{a,b,c},{d,e}}] This makes ...
corey979's user avatar
  • 23.9k
11 votes
1 answer
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 ...
Mike Honeychurch's user avatar
11 votes
4 answers
617 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 ...
Harry's user avatar
  • 2,715
10 votes
2 answers
7k views

Legends in combined Plot and ListPlot

I have a set of data ...
dbm's user avatar
  • 1,239
22 votes
4 answers
8k 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 ...
ArgentoSapiens's user avatar
21 votes
5 answers
4k 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 ...
Praan's user avatar
  • 683
19 votes
2 answers
4k 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 ...
matrix42's user avatar
  • 6,946
13 votes
3 answers
1k 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. ...
user avatar
13 votes
2 answers
1k 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. ...
Verbeia's user avatar
  • 34.2k
11 votes
2 answers
2k views

In LineLegend, how do I force the legend entries to appear in a single column?

I want to create a single column LineLegend with at least 12 different entries. Suppose that I define lists colors and ...
Andrew's user avatar
  • 10.5k
7 votes
2 answers
2k views

Single Legend for a Table of Plots

For this toy problem ...
JohnD's user avatar
  • 3,301
6 votes
4 answers
2k views

ParametricPlot and PlotLegends don't seem to cooperate

Bug introduced in 9.0.1 -- fixed in 10.0.0? I noted that only part of the legend shows up in ParametricPlot using v9's ...
Sjoerd C. de Vries's user avatar
6 votes
2 answers
303 views

Why does Rotate in PlotMarkers behave strangely?

Bug introduced in 9.0 or earlier and persisting through 12.0 While answering Change the inner color of markers I came across a behavior that may be a bug. I would like to know if there is another ...
Mr.Wizard's user avatar
  • 271k
5 votes
1 answer
1k views

Customizing a graph (Dashing, PlotMarkers, Labeled)

There are actually several questions here but I thought they are closely related so I should not split into several posts. Here we go... I have the following list ...
Dimitris's user avatar
  • 4,794
4 votes
3 answers
336 views

Putting the text after the line legend

I want to put the line legend after the text, here is my code; ...
Mostafa Peysokhan's user avatar
3 votes
1 answer
204 views

Different distance in .jpg plot and .eps

I noticed that when I run my code to draw a plot: ...
Ziva's user avatar
  • 817
2 votes
3 answers
4k views

How to color a contour plot over a subset of colors displayed in the bar legend

This seems real easy but I can't find the answer. I have a few contour plots that I am combining and want to use only one bar legend that captures all the values. Given that I know the range of values,...
LiaChica's user avatar
  • 359
34 votes
2 answers
1k views

Poets of the 19th century

...
eldo's user avatar
  • 60.4k
23 votes
3 answers
33k 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. ...
Julia's user avatar
  • 911
21 votes
4 answers
11k 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 ...
Ceren Burcak's user avatar
17 votes
3 answers
12k 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 ...
Vaggelis_Z's user avatar
  • 8,620
17 votes
4 answers
7k 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 ...
a06e's user avatar
  • 11.3k
14 votes
1 answer
3k 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 ...
Ronny's user avatar
  • 1,141
13 votes
3 answers
12k 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: ...
Cedric H.'s user avatar
  • 696
13 votes
1 answer
565 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, ...
bbgodfrey's user avatar
  • 61.3k
13 votes
2 answers
1k 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): ...
Yves Klett's user avatar
  • 15.4k
12 votes
2 answers
7k 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 ...
JeffDror's user avatar
  • 1,880
10 votes
3 answers
1k 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) ...
brad's user avatar
  • 373
8 votes
4 answers
569 views

PlotLegend disappears if Plot is used with ColorFunction

Working some charts on V10, I discovered that PlotLegends disappears if used together with ColorFunction inside ...
Murta's user avatar
  • 26.2k