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

learn more… | top users | synonyms

20
votes
1answer
5k 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 ...
2
votes
1answer
40 views

Tikz pictures disappears when adding legend

\begin{center} \begin{tikzpicture}[>=stealth,trim axis left, trim axis right] \begin{axis}[legend style={at={(axis cs:40,20)},anchor=south west, draw=none}, xmin=0,xmax=4, ymin=0,ymax=2, ...
0
votes
0answers
20 views

Colorbrewer with legend outside graph and which Colorbrewer?

I am using Colorbrewer with PGFplots and I want the legend to be outside of the graph. The LaTeX environment is Texlive 2014. Here is a MWE: \documentclass{article} \usepackage{pgfplots} ...
4
votes
1answer
32 views

PGFplots: decorating plot but not legend

Using PGFplots, I would like to apply a decoration to a plot but not to the corresponding legend entry. Is there a way to do this? Here is an example: I'd like the legend image to be just the line, ...
2
votes
1answer
39 views

Use single plot marker in manual “group” legend entries

I have an axis which contains several plots. These plots can be divided into two groups, of which each has a common plot marker. The plots are styled using a combined cycle list. I would then like ...
5
votes
2answers
340 views

pgfplot legend on top of grid but below graphs in axis as well as groupplot

Is there a way to specify the order of layers of elements in a pgfplots-axis? In my certain case I'd like to have the legend on top of the grid, but below the actual graphs: I know for this ...
1
vote
2answers
72 views

How can I set a legend outside subfigures?

I'm making a figure with three subfigures inside of it. I'd then like to create a legend on the top left of the figure. Currently I've created the legend in the third subfigure but it would be ideal ...
0
votes
0answers
13 views

bringing legend in next line

how do i bring the legend in the next line. I am facing a problem with very long legend strings. How can bring some string in the next line. Ex:- plot "datafile" using 1:4 with linespoints lw 3 pt 6 ...
26
votes
1answer
7k 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 ...
2
votes
0answers
14 views

skip a plot in the legend entry legend [duplicate]

I'd like to legend only certain curves but \addlegendentry add an entry for each curve, in sequence. \documentclass{article} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} ...
2
votes
1answer
121 views

I have 3 data series and 2 different y-axis. How can I add, outside the graph, the legend for each of three series?

Does someone know how can i change the position of my legend to right-side of my graph? I try many things but i can't. Please give me some help! Here is my code! \resizebox{\textwidth}{!}{ ...
2
votes
1answer
740 views

Adding a legend next to subfigures of pgfplots

I have an error bar chart, where I would like to add a legend. Using this type of code, I am facing problems to add any kind of legend. Please consider my current code: ...
5
votes
1answer
69 views

Color cycle and forget plot

I use cycle list name=exotic as coloring for my plots. I am looking for a way, either to use a number referring to a color (index from the exotic list), or a way to get the color of a labelled plot. ...
3
votes
2answers
43 views

pgfplot bar graph legend and y labeling

I would like to ask how to get my results. My code: \begin{tikzpicture} \begin{axis}[ybar stacked, legend style={cells={anchor=west},at={(1.75,0.89)}}, area legend, %legend ...
2
votes
1answer
31 views

how to set and position legend in a plot with pgfplots?

I want to put a legend in this two plot: i have this code: \begin{figure}[!ht] \resizebox{\textwidth}{!}{ \begin{tikzpicture} \begin{axis}[xmin=0, xmax=90,axis y line*=left,ymin=8.62,ymax=8.69, ...
0
votes
1answer
42 views

PGFPLOT bar graph possition legend and different notation

I would like to ask you about the bar graph and possition legend. \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} [ xbar, ...
1
vote
1answer
103 views

Fill square mark in legend?

I'm using the following code to generate a simple graph, and I want to have the legend show a filled in gray square to represent the shaded area on the graph. Everything still leads to a white square ...
1
vote
0answers
39 views

Position of text on graph using matlab2tikz (underflow issue)

The matlab pcakage matlab2tikz converts plots automatically to Tikz files, which can be later called in the main Tex document very easily. Here's my problem: the piece of tikz below draws a circle ...
2
votes
0answers
47 views

PGFPlots - Legend box aligning with axis [duplicate]

I am trying to increase the size of the legend such that it exactly fits to size of the plot. But even after having a look at the PGF manual I could not figure out how I can realise my plan. ...
4
votes
1answer
55 views

justify legend enteries in pgfplots

I wanted to know how I can go about left aligning the legend enteries in my pgfplot. This is the effect I would like to have: Here is my code: \documentclass[tikz]{standalone} ...
5
votes
1answer
71 views

Move position of y-axis label and legend in pgfplots

I would like to move one of the y-labels to the second group of plots on the right and legend more to the center of the plots as shown here: Here is the code: \documentclass[11pt]{book} ...
3
votes
1answer
125 views

pgfplots legend with two ordinates (lines and bar chart)

In the legend, I would like to have a line for the red and orange lines (as it is the case), and ybar legend style for the rest. I just can't figure out the easiest/best/any way to do it. MWE: ...
5
votes
1answer
967 views

Create legend tikzpicture without pgfplots

I already tried to create a legend with pgfplots but it seems that conflicts with tikz-uml library (another tikzpicture that I have in the same file) so I want to know how can I create a legend with ...
1
vote
0answers
56 views

Adding vspace between x-axis label and legend generated with legend to name feature [closed]

I recently started working with pgfplots and now I am trying to generate two horizontally aligned plots using the same data. So I wanted to use one single, centered legend for both plots. It is all ...
1
vote
1answer
42 views

Using the tikzexternal.sty package together with legend to name feature

I am using the following TeX code (minimal example), which compiles fine, when running pdflatex then run make -f filename.makefile and repeat the procedure a second time to also include the referenced ...
1
vote
0answers
35 views

The location of figure in PNAS template mess up caption and legend

I am modifying this PNAS template (http://www.latextemplates.com/template/pnas) for my journal. I have been puzzled by the position of figure and its effects on caption position and legend indentation ...
2
votes
1answer
40 views

Remove marker from legend in pgfplot

In my code below, there is a marker in the legend. I just have two plots without any markers. How to remove these markers and just have the line be shown in the legend entry? Here is my code: ...
6
votes
1answer
192 views

Add break node to plot in pgfplots

I was able to 'break' the vertical axis using pgfplots, but some issues came along with it: Most importantly, I can't find how to add the 'break sign' (the two parallel lines) to my plot as well, ...
1
vote
1answer
166 views

change color of line in legend image (tikz pgfplot)

I want to change the color of the line in the legend image, because the line color in my plot is different to the mark color. \begin{figure}[h!] \begin{tikzpicture} \begin{axis}[legend pos=south ...
3
votes
1answer
121 views

More visible legend entries for only filled pgfplots bar chart

How can I get more visible legend images next to the textual legend entries A, B, C? The default for only filled bar charts seems to consist only of a hair thin vertical line, which makes it quite ...
1
vote
0answers
56 views

pgfplot - keep legends widthin \linewidth when the are set outside

I'm using pgfplots, but i want to have my legends next to the plot. This is easy by setting legend style and anchor. But i also want the plot to be as big as possible. So if my labels are to long, ...
4
votes
1answer
524 views

Multi-line legend entry in pgfplots

In some of my plots the curve description in the legend is too long, making the legend going over the plot, even if the legend is placed as far away as possible. Therefore I want to have multiple ...
3
votes
1answer
67 views

Pgfplot Legend Type

I need a legend type given below. I want to write parameter values just once. How can i get this type legend. code example \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} ...
5
votes
1answer
108 views

Move common legend to top right of plots in pgfplots

in my code below, I wanted some help to move my common legend to the top right of the plots like this: Can you assist me with this? Thanks. Here is my code: \documentclass[11pt]{book} ...
0
votes
1answer
27 views

Common Legend in pgfplot - having problems compiling

I am trying to get a common legend for the six plots that I have. I tried to implement the code found here, but could not get my program to compile. I tried to get the legend at the bottom of the ...
1
vote
1answer
143 views

PGFPlot : Relative positioning of legend according to axis

I am trying to move the legend of a PGFPlot above the top right corner, but using relative positioning like at={(current axis.above of north east)} in stead of manually giving a position like at={(1, ...
3
votes
1answer
196 views

tikz legend in caption and colorbrewer

Related to the question tikz legend in caption I want to use the colorbrewer library (just unzip the archive in the working directory). However, it seems that they cannot be used together. ...
1
vote
0answers
1k views

Cannot align legend's text in plots using tikzpicture package [closed]

I'm trying to align the text (text + $math$) within the legend in my pgfplot. Despite I put the "legend cell align=left", the text still is centred. Any guess? \documentclass[]{article} ...
1
vote
1answer
171 views

Change mark size in legend entry

I want the marks in the legend to be bigger than in the plot. But I'm facing the problem that if I use mark options in legend style, then I can't use it again in addplot. At the moment I get the ...
4
votes
1answer
463 views

Pgfplots legend style marker size

I have the following plot: \begin{tikzpicture} \begin{axis}[ xlabel={\tiny X}, ylabel={\tiny Y}, xmin=0, xmax=5, ymin=0, ymax=18, minor x tick num=4, minor y tick num=4, ytick={0, 2, ...
3
votes
1answer
69 views

Show line to the right of text in plot

By default, tikz shows the text in a legend to the right of the line as shown in the picture below. \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} ...
6
votes
3answers
202 views

How to reposition the legend?

Right now, it looks like this: I don't like that the box intersects the function graph. How could you reposition it? And I cannot see the label for the y-axis. Where has it gone? Could you also ...
2
votes
1answer
51 views

How to put a Legend under a figure?

In my document I got a figure with a lot of symbols in it like this: I want to add a legend to it, explaining all the symbols used. How do I achieve this? \begin{figure} \centering ...
5
votes
1answer
111 views

Split line in `legend` with `pgfplots`

In the following plot, how can I split the red line of the caption into a red line and a blue dashed line (so that the total length of the red-blue segment is that of the green one)? MWE: ...
3
votes
1answer
86 views

pgfplots legend disappearing with externalization

I have an issue with a combination of a special legend I am doing in a pgfplot, and with using tikz externalization. See the MWE below. The legend will not appear if I use externalization, but if I ...
7
votes
1answer
383 views

How to increase legend lines lengths in PGFplots

I want to know how I can make PGFplots to draw longer segments in the legend. I looked at couple of previously asked questions and none seemed to work for me. In this question: "adjust the legend ...
0
votes
1answer
279 views

How to only show legend in pgf plot?

I have created with matlab2tikz a standalone picture, saved in myfile.tikz Here is the code: % This file was created by matlab2tikz v0.5.0 running on MATLAB 8.4. %Copyright (c) 2008--2014, Nico ...
2
votes
0answers
23 views

Colorbar for lineplot using pgfplots [duplicate]

I am doing a lineplot with pgfplots. However, instead of the usual legend, I would prefer a colorbar, as I am basically trying to visualize a transition, and for that I chose colors in a gradient like ...
3
votes
1answer
2k views

Resize font in legend below \tiny

I have small graph in my presentation (I have to). To adjust the size of the legend, I have to use very small legend. But \tiny is not enought. Here is a MWE : \documentclass{beamer} ...
1
vote
1answer
47 views

clear me the doubt in positioning legend option

\begin{tikzpicture} \begin{axis}[ axis lines=middle, samples=100, ymax=5,legend pos=north east ] \addplot[cyan,domain=0.001:8] {abs(log10(x))}; \addplot[red!70!black,domain=-2:4] ...