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.

173 questions
Filter by
Sorted by
Tagged with
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 ...
• 1,735
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'...
• 5,556
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 ...
• 1,581
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 ...
• 10.2k
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,...
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 ...
• 234k
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. ...
• 3,201
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 ...
• 16.2k
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. ...
• 911
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 ...
• 4,260
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 ...
• 2,279
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 π, ...
• 367
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 ...
• 7,565
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 ...
• 6,665
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...
• 549
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 ...
• 84.8k
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" ...
• 141
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 ...
• 15.9k
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 ...
• 589
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.
• 31.4k
753 views

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

Execute this code: ...
• 11.3k
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 ...
• 23.9k
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 ...
• 37.5k
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 ...
• 2,715
7k views

Legends in combined Plot and ListPlot

I have a set of data ...
• 1,239
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 ...
• 7,770
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 ...
• 683
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 ...
• 6,946
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. ...
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. ...
• 34.2k
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 ...
• 10.5k
2k views

Single Legend for a Table of Plots

For this toy problem ...
• 3,301
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 ...
• 65.7k
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 ...
• 271k
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 ...
• 4,794
336 views

Putting the text after the line legend

I want to put the line legend after the text, here is my code; ...
204 views

Different distance in .jpg plot and .eps

I noticed that when I run my code to draw a plot: ...
• 817
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,...
• 359
1k views

...
• 60.4k
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. ...
• 911
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 ...
• 311
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 ...
• 8,620
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 ...
• 11.3k
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 ...
• 1,141
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: ...
• 696
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, ...
• 61.3k
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): ...
• 15.4k
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 ...
• 1,880
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) ...
• 373