Questions tagged [legend]
a legend in a graph helps the reader determine the correspondence between line style and data values
449
questions
0
votes
1
answer
22
views
Aligning legend with figure width memoir class
I'm using the memoir class. Let's say I have a figure like this.
\begin{figure}[htbp!]
\centering
\caption{Super-cool Figure}
\label{fig:super_cool}
\includegraphics[width = 0.7\...
0
votes
1
answer
22
views
shared legend position is not changed
\documentclass{article}
% Standard package includes
\usepackage{times}
\usepackage{latexsym}
% For proper rendering and hyphenation of words containing Latin characters (including in bib files)
\...
0
votes
2
answers
44
views
Weird issue with pgfplots legend deleting curly brace
When compiling the following
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-1:1]
\...
1
vote
2
answers
36
views
Problem when using cases environment in pgfplots legend
I noticed that if I use cases from package amsmath in a pgfplots legend, the legend box does not contain the whole text. See the MWE.
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{...
0
votes
1
answer
55
views
Adding legends to diagram lines on top of a graphics
I want to display my new results on top of a figure reproduced from an old paper.
I experienced two major issues.
1.a/ If is use shifting and use
\addlegendentry{My second}
for a second time, nothing ...
0
votes
1
answer
42
views
Package PGFPLOTS legend empty entry shift to left
I made a plot with 2 y-axis on the same x-axis. One one the left, one on the right.
Thats the Code I used:
\documentclass{standalone}
\usepackage{siunitx}
\usepackage{pgfplots}
\usetikzlibrary{...
1
vote
1
answer
46
views
How to merge legends of two y-axes in pgf plot?
I want to merge the two legends of this pgf plot, so that the second legend "This is legend two" is within the first legend box.
Here is the MWE:
\documentclass[
12pt,
a4paper,
]{scrbook}
\...
1
vote
2
answers
229
views
Creating a Common Legend for Subfigures with subcaption Package in LaTeX
I'm working on a LaTeX template, the elsarticle class from Elsivier, where I have two subfigures created using the subcaption package. I came across this answer which provides a solution for having a ...
1
vote
2
answers
73
views
How to add color and legends to bar chart
I am trying to create a simple chart using the code below:
\begin{tikzpicture}
\begin{axis}[
symbolic x coords={
Integrated Circuits,
Transistors,
Capacitors,
...
0
votes
1
answer
24
views
Place the text of a legend entry underneath the corresponding line in pgfplots
I have the following code, which brings me to the figure in the first image.
Now I would like to place the text (in this example: exp(x) and x²+2x+1) of the legend entries underneath the red and blue ...
3
votes
1
answer
163
views
Rotate the symbol will cause it in legend not space rightly in 'pgfplots' in LaTeX
There is a symbol as triangle in pgfplots. As sometimes need the inverted triangle, I rotate it 180 degrees. It will work all right in the figure but not in the legend.
\documentclass{article}
\...
1
vote
1
answer
137
views
Adding additional text in a legend
I am learning Tikz/Pgfplots and I am trying to recreate the following graph
So far I have been able to come up with the following:
\begin{tikzpicture}
\begin{axis}[axis lines = center, axis ...
0
votes
1
answer
56
views
How can I change the image size in a legend on pgfplots?
I need the small picture as large as the word.But I didn't find how.
1
vote
0
answers
44
views
How Can I change the legend positon
I would like to change the position of the legend, modifying the current position by placing it below and centered between the graphic (c) and (d).
\begin{figure}
\begin{tikzpicture}
\begin{...
0
votes
1
answer
148
views
How to change color of text in legend of pie chart in overleaf
I would like to change the color of the text 7.91-6.33 in figure A's legend and the text 73169 - 60901 in figure B's legend to red.
Please any help would be really appreciated.
\begin{figure}[htbp]
\...
2
votes
1
answer
60
views
Adding legends to a pgf plot with table
I need to add a legend to each color in the plot. Like, inserting a box inside the plot that has the color and its name:
How can I do that?
MWE:
\documentclass{standalone}
\usepackage{subcaption}
\...
1
vote
1
answer
280
views
Placing legend in upper left corner of bar graph
Want to place the legend in the upper left corner of the bar graph. Following is my code
\documentclass[lettersize,journal]{IEEEtran}
\usepackage{pgfplots}
\usetikzlibrary{patterns}
\pgfplotsset{
...
3
votes
0
answers
55
views
How can I plot piece-wise function with legend using tikz? [closed]
I have a piece-wise function (actually, some points connected with a line in a region) and I want to add a legend. My problem is that if I add several \addplot segments, the \addlegendentry displays ...
0
votes
2
answers
91
views
cell color in a table -- add legend somewhere under the table to explain the meaning
\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}
\caption{a table}
\begin{tabular}{c c c c c c}
\cellcolor{blue!=10} 1 & 2 & 3 & 4 & 5 & 6 \\
...
1
vote
1
answer
135
views
In pgfplots how to set the length of the legend
I have made a graph in LaTeX using pgfplots, but when I include a system of equations into the legend, the legend length becomes too small. And I can't seem to increase the legend length.
My code:
\...
2
votes
2
answers
769
views
How to fix the caption spacing in tblr and talltblr environments from the tabularray package?
The spacing between the text and the table legend is different between the tblr and talltblr environments. In MWE this difference can be observed.
\documentclass[12pt,a4paper]{article}
\usepackage[...
1
vote
1
answer
157
views
Remove unwanted entries from Legend in pgfplot
I am trying to combine a box-plot with the actual points to show distribution. Furthermore, the marks used for the points depend on whether the treatment it represents was positive (marked x) or ...
0
votes
1
answer
286
views
Unknown error using legend entries
I'm having trouble with my tikzpicture. I have the following code:
\begin{center}
\begin{tikzpicture}[scale = 1]
\begin{axis}[
...
0
votes
2
answers
77
views
Handling with customlegend style
How can I do so the size of the customlegend box adapts to its content?
\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{...
2
votes
1
answer
495
views
pgfplots legend marker scale
The legend of my scatter plot is not picking up the sizes of the markers that I'm using. I'm being extreme here so that the difference is obvious. I'm hoping to understand how to get the sizes to be ...
1
vote
1
answer
300
views
Alignment of pgfplot inline legend in body text and caption
I would like to use pgfplots' "legend to name" feature to reference the (named) legend in the caption of the respective figure environment.
Additionally, it would be nice to be able to put ...
4
votes
1
answer
102
views
Multiple text alignments in TikZ legend entries
I am looking for a simple way to have multiple alignments in a TikZ legend.
I have the following code which produces a TikZ figure:
\documentclass[11pt,a4paper]{article}
\usepackage{pgfplots}
\...
1
vote
1
answer
61
views
Select from a set of inputs_ Legend line style_ Grid style legend
I have a \foreach loop in the following macro to create a legend box for my radar chart. First, how can I make legend to be in two columns and two rows? Second, I have used the 4th input of the \...
0
votes
1
answer
521
views
How to fix Undefined control sequence \caption@setlabelseparator with TexLive 2022?
I am trying to use again the answer from this question of mine from 2019 (Misplaced \noalign. \captionsetup ->\noalign when using \captionsetup inside memoir \legend command) with Tex Live 2022, ...
1
vote
1
answer
49
views
pgfplots, distinct legend for each groupplot
I'm trying to have distinct legends placed below each of the groupplots. I'm using the following code:
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
...
0
votes
1
answer
51
views
pgfplots - legend entries not recognised as array when passed as a defined variable through keyval
I am plotting a graph in pgfplots, and would like the legend entries to be passed as a defined variable. In the code below, the first example does this, but does not work (all entries come through on ...
2
votes
3
answers
382
views
How to get "inner" auto-positionning of a TikzPicture legend?
EDIT 2 (Feb 20): New question (hopefully clearer)
With pgfplots it's possible to obtain "inner" and "outer" figure legend (see Paul Gessler's answer) as:
I would like to achieve ...
1
vote
0
answers
19
views
Multiple Linear Regressions, Legend does not work [duplicate]
I am working on a diagram with tikz. There are two linear regressions in the diagram, but \addlegendentry does yield weird results for the second plot. Instead of the red star (which i would have ...
2
votes
1
answer
791
views
Pie chart with legend position south
I tried the legend to the south code from this question (see code below): Pie chart with joined legend position
but it unfortunately does not work.
If i change yshift to a fixed value it work. BUT ...
2
votes
1
answer
302
views
tikz pgf - Use multiple images for one legendentry
I have a plot in which I am showing experimentally obtained data and different models for the data. In order to keep the legend clean I want to summarise slightly different versions of the same model ...
2
votes
1
answer
273
views
Tikz plot: legend and markings
I need to
put a mark on the x-axis at the point of maximum to indicate x=75.
place a legend in the top left corner (above the graph to indicate "$\mu = 5$").
How can I do that with this ...
0
votes
2
answers
2k
views
How to add a legend next to a figure in latex
I created a 4-subfigures figure:
\begin{figure*}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\textwidth]{1.png}
\caption{1}
\label{fig:1}
\end{subfigure}
\hfill
\begin{subfigure}[...
0
votes
1
answer
557
views
Legend-cell alignment in pgfplots
Consider the LaTeX code
\documentclass{standalone}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[legend columns=2,
legend style={at={(0.5,1.02)},anchor=south,...
3
votes
1
answer
450
views
Legend with marks and loosely dashed
I have a problem with the visibility of the mark denoted by X in my legend, using a loosely dashed line. How I can make it more clear, e.g. by shifting the dashes a little to the right? (so that the ...
4
votes
1
answer
572
views
Splitting a graph legend into two legends
Im trying to split a single long legend into two legends. However, the way i did it just filled in the entire line. The is what im trying to achieve: (I think it would be better if those icons were ...
1
vote
3
answers
630
views
Global Legend for Different Plots
I have several axis environments that form an array of plots. Sometimes these different axes environments have the same data plotted, other times they have different data sets plotted. I would like to ...
1
vote
1
answer
630
views
Adjusting axes so graphs and legend do not overlap
I would like to add a legend to a graph, and automatically adjust the graphs so the legend won't overlap with them. The legend must stay inside the axes area. Currently it looks like this:
And I ...
0
votes
0
answers
92
views
Mathtools and PGFPlots conflict: `centercolon` and `addlegendentry` do not compile
I am using \mathtoolsset{centercolon} in a document, together with PGFPlots. I noticed that if I insert a colon in the \addlegendentry command, the document keeps compiling forever and never produces ...
1
vote
0
answers
1k
views
Change font size in legend [closed]
I have the following tikz plot figure.
I want the legend to have a smaller text.
I would prefer to just scale it by 0.5.
Is there any easy way to do that?
Thanks in advance!
\documentclass[10pt,...
1
vote
0
answers
142
views
PGFPlot, Legend line and legend text isnt on the same level [closed]
I have the following code:
\begin{tikzpicture}
\begin{axis}[legend style={at={(0.5,-0.1)},anchor=north}]
\addplot {x};
\addlegendentry{$x$}
\addplot {x^2};
\...
0
votes
0
answers
76
views
Pgfplots and Groupplot: Legend Management
I have the following MWE:
\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{pgf,pgfplots,pgfplotstable}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{colormaps}
\usepgfplotslibrary{...
0
votes
1
answer
118
views
How can I create a legend of an envelope plot?
I making envelope plots which shows the minimum median max of my values. but when i try to create a legend it doesnt pick the median which has the right color as seen in the image below:
MWE for your ...
1
vote
3
answers
623
views
PGFPlots: How do I add a legend to a plot drawn manually (not using \addplot)?
I'm making a plot using rectangles that I drew manually,
instead of using the standard plot types defined in PGFPlots.
Here is an MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{...
1
vote
0
answers
269
views
No colors in marks on pgfplots legend, using groupplots and standalone? [closed]
I'm trying to make an image with 2 groupplots, and a single legend.
Issue #1 should be evident: the legend is showing up to the right of the plots, not below them. < This has been solved using a ...
1
vote
2
answers
62
views
Automatic Report Printer: Handle long technical expressions in TOC and legend entries
I'm currently programming a automatic printer with Latex for some technical reports. The whole printer can be controlled and launched from an external programm which provides csv-files and Data which ...