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 position and
- how to add an entry with just a number instead of a symbol, like
'1 number of ...'
.
I don't need this. I just want to create easily a box where I have colored lines, colored circles/rectangles.. and colored numbers and the description next to.
Can anyone help me?
Best Answer
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.
To define numbers in the legend, I added a key
number in legend
:The example:
which gives:
The code is:
Result: