Contents
How to add a legend to a graph?
The first thing I would do is to define some styles for the various types, this makes it much easier to change things (you change the style, instead of changing every node): To generate the legend, you can for example use a \\matrix, with one ode in each row, and a label for the node to generate the legend text:
How to use pgfplots-style legend in tikzpicture?
Here is a solution based on Using a pgfplots-style legend in a plain-old tikzpicture. There are two examples: in the first one, the descriptions in the legend are centered, while in the second one, the descriptions are left aligned.
How to declare a tikzpicture environment in a document?
First, you declare a tikzpicture environment, before this you must include the line \sepackage {tikz} in the preamble of your document. In this example two lines and one point are drawn.
What do you need to know about the TikZ package?
TikZ package 1 Introduction. First, you declare a tikzpicture environment, before this you must include the line \sepackage {tikz} in the preamble of your document. 2 Basic elements: points, lines and paths. 3 Basic geometric shapes: Circles, ellipses and polygons. 4 Diagrams. 5 Reference Guide. 6 Further reading.
Where to put the legend in TeX LaTeX?
The current bounding box node is a node that at any point encompasses the entire diagram, so the north east anchor is the top right of the diagram, as it is at that point. I put the legend in the top right, because there is more room there. Thanks for contributing an answer to TeX – LaTeX Stack Exchange! Please be sure to answer the question.
Can you create a legend in a PGF matrix?
To my knowledge, this is impossible by means of a PGF \\matrix — and these kind of legends are a PGF \\matrix. As considered in your question, the remaining option would be to \\label every plot and generate a legend manually using ef to each plot, for example using
How to draw a straight line in TikZ?
One of the simplest and most commonly used commands in TikZ is the [&draw&] command. To draw a straight line we use this command, then we enter a starting co-ordinate, followed by two dashes before the ending co-ordinate. We then finish the statement by closing it with a semicolon. [&draw&] (0,0) — (4,0);