a legend in a graph helps the reader determine the correspondence between line style and data values

learn more… | top users | synonyms

22
votes
1answer
3k views

How can I adjust the horizontal spacing between legend entries in PGFPlots?

I am using legend columns=-1 to make a horizontal legend. However, the distance between the individual legend entries is too small for my taste. Is there a straightforward way to increase the ...
18
votes
1answer
4k views

pgfplots: prevent single plot from being listed in legend

In order to fill the area between two complex curves I use tables and the vertcat command (see Fill between two curves in pgfplots.). Now I don't want the plotted area to appear in my legend, just ...
16
votes
1answer
5k views

Colors and legend in groupplots/barplot

In order to compare three items I use the groupplot command. For each item I have n different criteria to compare. Is it possible to set the color for each criteria itself? Meaning the first bar in ...
16
votes
1answer
3k views

pgfplots: externalization and legend referencing

There are some issues when using the pgfplots option legend to name together with externalization. When I disable externalization, everything works fine. When I enable externalization, I get an error ...
15
votes
1answer
3k views

Removing legend box (border) in pgfplots

I'm attempting to remove or 'turn off' the legend border in pgfplots, but I can't seem to figure out how to do it. I assume it will look something like this: \begin{axis}[ legend style={?}] where ...
15
votes
1answer
3k views

Add a legend title to the legend box with pgfplots?

I am using the awesome pgfplots package to draw some plots. I usually use \addlegendentry and get a nice default legend box. There are some options for legend box placement and layout (e.g. number of ...
14
votes
1answer
9k views

pgfplots: Legends in multiple y-axis plot overlapping

I am trying to add a legend for two plots on two different y-axes, however they are overlapping each other and each one is being written in its own box. I would like for both of them to share a single ...
13
votes
2answers
3k views

Using a pgfplots-style legend in a plain-old tikzpicture

I am using a plain-old tikzpicture to produce a pie-chart-like plot. Now, all other plots in my paper are handled using pgfplots (which doesn't do pie charts) and have their legend typeset by ...
13
votes
1answer
9k views

pgfplots: alignment and size of math in legend

The legend entries created by a more complex math formula as in this example are overlapping and the alignment to the lines is wrong. \documentclass[]{scrbook} \usepackage{pgfplots} ...
11
votes
1answer
7k views

Legend in tikzpicture

I am looking for a way to create a legend in a regular tikzpicture. I found this Using a pgfplots-style legend in a plain-old tikzpicture but I don't know how to put the legend at the wanted ...
10
votes
2answers
1k views

pgfplotstable: How to access column name?

I have used \pgfplotstableset to assign column names in the preamble. However, I don't know how to access them. \documentclass{article} \usepackage{amsmath} \usepackage{pgfplots, pgfplotstable, ...
9
votes
2answers
836 views

pgfplots: legendentrys are wrong

I'm using pgfplots to plot a lot of data as you can see below. For some of the plots I'v specified a legendentry, but the marks for these plots are not shown in the legend. does anyone know where the ...
9
votes
1answer
742 views

How to make the legend box transparent in pgfplots?

The legend box is covering parts of the graph (even though I removed the borders). How do I make the legend box transparent?
9
votes
2answers
628 views

How to add legend to contour plots?

The following does not work: \documentclass{standalone} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[view={0}{90},legend entries={foo,bar}] % 'legend entries' causes ...
9
votes
1answer
2k views

Pgfplots axis, option to remove (or ignore) legends

Is there an option in pgfplots at the axis level or a setting of legend style option, that would effectively ignore the subsequent legend entries in the plot? \documentclass{article} ...
8
votes
1answer
12k views

Customize legend position in PGFplots axis environment

I am trying to customize the position of the legend in the axis environment of PGFplots. A simple way to do this is by using something like legend pos=south west|south east|north west|north east ...
8
votes
2answers
619 views

Comma in legend in pgfplots

The following code with the comma in the legend entry fails to compile. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
8
votes
1answer
234 views

pgfplots: problem in the legend using custom marks

With the help of \pgfdeclareplotmark I defined a custom mark for a plot and it worked as expected; however, in the legend, the mark appears with a vertical shift. What is causing this problem and how ...
8
votes
1answer
289 views

Is it possible to combine cases with pgfplots legend?

I would like to print a function and add a legend which makes use of cases. The current code is: \documentclass{article} \usepackage[pdftex,active,tightpage]{preview} \setlength\PreviewBorder{2mm} ...
8
votes
1answer
226 views

Translator doesn't work in external pgfplot legend

I would like to have my pgfplot legend automatically translated wrt the language used in my article. Thus, I use to use the translator package, which a very easy and pleasant solution. It works like a ...
8
votes
1answer
188 views

legend looks strange for joint line and bar plot in pgfplots

I am trying to draw both a line plot and a bar plot in the same plot. However, the legend for the line plot looks wrong. Question: How do I make the legend look like the legend for a regular line ...
8
votes
1answer
605 views

dashed line in pgfplots legend results in incomplete marks

When defining the pgfplots legend entries myself, I have a problem when using dashed lines in combination with marks. The mark is also dashed (or dotted, etc.), just as the accompanying line is. Is ...
8
votes
1answer
348 views

legend placement with bounding box restrictions and externalization in pgfplots

I find it useful to add \pgfplotsset{/tikz/every picture/.append style={trim axis left,trim axis right}} to my preamble for bounding box restrictions. But then when I use the legend to name feature ...
8
votes
1answer
252 views

Split tikz tree level in two parts

I would like to rebuild this graphic for my bachelorthesis. The problem that i ran into was, that i don't know how to split the graph in the second level, like shown in the picture above. I was ...
7
votes
2answers
183 views

Linear and non-linear functions inside \addplot to get a unique legend

I have functions which have two intervals, a linear and non-linear. I want to have these inside the command \addplot in pgfplots, to get only one legend. I tried it with them in a separated write, but ...
7
votes
1answer
10k views

Put legend (pgfplots) below the plot

I have a pgfplot where the legend is right to the plot. I create the plot as follows: \begin{axis}[ scale only axis, xmode=log, ymode=log, width=7cm, legend cell align=left, ...
7
votes
2answers
3k views

How to modify the image of an legend entry

I have the following code \documentclass[tikz,convert={size=640}]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ legend entries={simulation sample 1, ...
7
votes
1answer
121 views

pgfplots and hyperref clash for complicated figure in book class

When using the book class, pgfplots, hyperref, and section labeling according to "How to reset chapter and section counter with \part", I get the following error ! You can't use `the character -' ...
7
votes
1answer
291 views

Problem of superimpose and how to change legend symbol

Given the plot as follows I have two problems: a and b are superimposed on each other, how should I make this clear on the graph? How could I change legend c to other icons like star? (It looks a ...
7
votes
1answer
180 views

Despite using the 'no markers' option, I still get plotmarks in my legend. Why?

Nice to finally post a question myself after finding solutions to my problems on numerous occasions within these forums. I hope someone can be of help (and that this hasn't been asked already). The ...
7
votes
1answer
489 views

How to fill the mark in pgfplot legend

I would like to create a graph using pgfplots. I don't like the legend symbol used for ybars and decided to go with a line legend entry and squares instead. How can I fill these marks, so that they ...
7
votes
1answer
3k views

Putting LaTeX table legend in a “x\y” style [duplicate]

Possible Duplicate: Tables of numbers Is it possible to put a "x\y" style legend in one cell (maybe be made up of several cells) of a table? It would be great to make the 'x' slightly lower ...
7
votes
1answer
4k views

Legend in caption

It may be a bit difficult sometimes to deal with the legend of a figure in a LaTeX document. Depending on the context, you may have to place the legend over the existing curves because of a lack of ...
7
votes
1answer
750 views

Custom legend for intensity plot

I created an intensity-plot (x and y axes are positions, the color of the point gives the intensity) in an external program (igor pro) and included the "bare" plot via the \addplot graphics command ...
6
votes
2answers
5k views

tikz legend in caption

I have adapted a piece of code that I found on the Q&A forum multiple legends in pgfplots as follows in order to include the legend of a drawing directly into the caption: EDIT 1 ...
6
votes
1answer
245 views

Strange interaction between `addlegendentry` and `y filter` in pgfplot

From this answer How to scale existing coordinates data in pgfplots? I am using y filter to process data, all fine until I decide to put a legend entry in the plot. I cannot seem to simultaneously use ...
6
votes
1answer
4k views

pgfplots scale legend position when below xlabel

When using matlab2tikz to generate a .tikz from Matlab where the legend location is set to 'SouthOutside' (below the ylabel of figure), the position of the legend will cover the ylabel unless the ...
6
votes
1answer
542 views

Legend referencing in caption *and* externalization

I am trying to make a reference to a plot inside a figure's caption while using the externalize library. The issue of plot reference using externalization has already been raised in this question. I ...
6
votes
1answer
137 views

plot legend : increase its area

So my question in general is what is the method to change the precise area of the rectangle used in pgf plots? Yes, to make it larger ... MWE: a typical bar chart ...
6
votes
2answers
562 views

Problems using \addlegendentry in a loop with pgfplots

I have some spectra to plot, which I exported from the Siemens Xray toolbox, which works nicely with pgfplots. Since these are multiple files that look the same I think I can do it with a for loop, ...
6
votes
1answer
250 views

pgfplots - How can I achieve an xbar plot with bars adding up to 100% on both ends?

edit I don't need a solution anymore, I decided to not use the "negative" bars on the right side but I am leaving (and not deleting) this question in case someone else is looking for this in the ...
6
votes
1answer
3k views

Pgfplots: put plot legend on the outside margin?

I use classsicthesis style for my PhD. Since this style is somehow geared towards using the outside margin for additional notes and stuff, I thought I could also place the legends of my plots there. I ...
6
votes
1answer
311 views

legend problem in highlighting a data plot

I followed the tips on highlighting in data plots at http://www.howtotex.com/tips-tricks/highlighting-in-tikz-plots/ The highlighting does not work well with \addlegendentry. A MWE is shown below. ...
5
votes
1answer
3k views

Two columns in legend in pgfplots

I know how to create a legend in a pgfplots plot. See Legend in tikzpicture and Using a pgfplots-style legend in a plain-old tikzpicture. But I do not know how I can create a legend with two ...
5
votes
1answer
975 views

Manually add legend symbols in text (without \label and \ref)

I would like to add legend symbols from pgfplots in my text. I am aware of the possibility to use the \label and \ref commands but my setup is complicated and I fear that making it work will more time ...
5
votes
1answer
2k views

pgfplots particular legend

\usepackage{pgfplots} \pgfplotsset{width=10cm} \begin{figure} \centering \begin{tikzpicture} \makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother \pgfplotsset{axis line ...
5
votes
2answers
250 views

Color legend in Y axis

I have the following multiple y-axis plot that results in the image on the top image. However, I want to add a sort of legend in each of the Y axis, similar to what I manually drew in the bottom ...
5
votes
2answers
303 views

Legend position control within rotated polar axis

How can I shift (control) the position of the legend within rotated polar axis environment? (e.g. shift into the south-east corner?) \documentclass{article} \usepackage{pgfplots} ...
5
votes
2answers
2k views

pgfplot column chart legend shape

I have the following code in Latex using gpfplot. The legend in the generated graph always looks like the image attached. There are two boxes instead of one for each entry. Why this is happening? How ...
5
votes
1answer
848 views

How can I adjust the column width of legend in PGFplots?

I would like to adjust the width of the legend lines (images) in PGFplots. Since legend is a TikZ matrix, I can adjust the separation between lines, space between text and lines by changing the matrix ...