Skip to content

Commit f58f3b8

Browse files
authored
Conditionally add legend for horizon line (#48)
1 parent 986a0b4 commit f58f3b8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/solarpy/plotting/multiplot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,8 @@ def multiplot(times, data, meta, horizon=None, google_api_key=None, figsize=(24,
634634
if horizon is not None:
635635
ax.plot(horizon.index, horizon, c="r", label="Horizon line")
636636
axes["sun1"].set_xticks([])
637-
axes["sun1"].legend(loc="upper right", frameon=False)
638637
axes["sun1"].set_xlabel(None)
638+
if horizon is not None:
639+
axes["sun1"].legend(loc="upper right", frameon=False)
639640

640641
return fig, axes

0 commit comments

Comments
 (0)