# Create Legend

![](/files/-MihikO74mt8Bz4nH67v)

![](/files/-MihikOAt-5QlQI96_sS) - [\[source code\]](https://github.com/ladybug-tools/ladybug-grasshopper/blob/master/ladybug_grasshopper/src//LB%20Create%20Legend.py)

Create a custom legend for any set of data or range. Creating a legend with this component allows for a bit more flexibility than what can be achieved by working with the legends automatically output from different studies.

### Inputs

* **values \[Required]**

A list of numerical values or data collections that the legend refers to. This can also be the minimum and maximum numerical values of the data. The legend's maximum and minimum values will be set by the max and min of the data set.

* **base\_plane**

An optional plane or point to set the location of the legend. (Default: Rhino origin - (0, 0, 0))

* **title**

A text string representing a legend title. Legends are usually titled with the units of the data.

* **legend\_par**

Optional legend parameters from the "LB Legend Parameters" component.

* **leg\_par2d**

Optional 2D LegendParameters from the "LB Legend Parameters 2D" component, which will be used to customize a legend in the plane of the screen so that it functions like a head-up display (HUD). If unspecified, the VisualizationSet will be rendered with 3D legends in the Rhino scene much like the other native Ladybug Tools components.

* **viewport**

Text for the name of the Rhino viewport to which the 2D legend will be rendered. This input only has an effect when leg\_par2d\_ are connected. Multiple viewports can be connected to have the legend display in several viewports. If unspecified, the legend is rendered in all viewports. Acceptable inputs include: Perspective Top Bottom Left Right Front Back any view name that has been saved within the Rhino file

### Outputs

* **mesh**

A colored mesh for the legend colors.

* **title\_obj**

A text object for the legend title.

* **label\_objs**

An array of text objects for the label text.

* **label\_text**

An array of text strings for the label text.

* **colors**

An array of colors that align with the input \_values. This can be used to color geometry that aligns with the values.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ladybug.tools/ladybug-primer/components/4_extra/create_legend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
