> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Plots or drawings: which to use

> When to plot a series and when to draw an object, and what to use in place of each plot form the compiler refuses.

Use a **plot** for a series with a value on every bar that you want drawn as a line, histogram or area: an average, an oscillator.
A plot call stands at the top level and its look (width, style, title) is fixed for the run. Use a **drawing** for everything else:
marks on some bars, text built from data, levels or zones that follow data, anything created in a condition or a loop.

| You want | Refused form | Use |
| - | - | - |
| a plot on some bars only | `plot` inside `if` | `plot(cond ? value : na)`, or a drawing |
| text from data on a mark | `plotshape(..., text=str.tostring(x))` | `label.new` |
| a level that moves with data | `hline(close)` | `plot(value)` for a line on every bar; `line.new` for a segment |
| a zone between two prices | `fill` of series | `box.new`, or `fill` of two `plot`s |
| a title or width from data | non-const `title`, computed `linewidth` | a label; or one plot per case |
| a different shape or size by bar | `shape=` or `size=` from a condition | one `plotshape` per case |

## The refused forms

The messages for most rows are on other pages: a plot in a condition on [Plotting](https://gocharting.com/docs/scripting/chart-output/plotting.md), a title from
data on [const, input, simple and series](https://gocharting.com/docs/scripting/language/qualifiers.md), a computed `hline` price and a fill of a plot with a level on
[Fills and levels](https://gocharting.com/docs/scripting/chart-output/fills-and-levels.md). A mark whose shape or size depends on the data:

```lipi-invalid theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Size by bar")
plotshape(close > open, size=close > open ? size.small : size.large)
```

The compiler says: Cannot call `plotshape` with argument `size`=`close>open?size.small:size.large`. An argument of `series size` type was used but a `input size` is expected.

## What to use instead

Text from data, and a zone, as drawings. Both may sit inside a condition:

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Breakout labels and zone", overlay=true)
top = talib.highest(high, 20)
bottom = talib.lowest(low, 20)
if close > top[1] {
    label.new(bar_index, low, "Breakout " + str.tostring(close), style=label.style_label_up, color=color.green, textcolor=color.white)
}
if barstate.islast {
    box.new(bar_index - 20, top, bar_index, bottom, border_color=color.gray, bgcolor=color.new(color.gray, 0.9))
}
```

A drawing is not a series: it has no value on each bar, cannot be read back by other code as a series and counts against the
limits on [Lines, labels, boxes and polylines](https://gocharting.com/docs/scripting/chart-output/drawings.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.