From 6faa9695e6f70942e113f7393d28a17cb0e306b4 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Wed, 5 Oct 2022 08:42:43 +0200 Subject: [PATCH] add if clause --- pygmt/src/ternary.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pygmt/src/ternary.py b/pygmt/src/ternary.py index a4f1b8470ed..b357289fe4c 100644 --- a/pygmt/src/ternary.py +++ b/pygmt/src/ternary.py @@ -75,10 +75,11 @@ def ternary(self, data, alabel=None, blabel=None, clabel=None, **kwargs): """ kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access - alabel = str(alabel) if alabel is not None else "-" - blabel = str(blabel) if blabel is not None else "-" - clabel = str(clabel) if clabel is not None else "-" - kwargs["L"] = "/".join([alabel, blabel, clabel]) + if alabel or blabel or clabel: + alabel = str(alabel) if alabel is not None else "-" + blabel = str(blabel) if blabel is not None else "-" + clabel = str(clabel) if clabel is not None else "-" + kwargs["L"] = "/".join([alabel, blabel, clabel]) with Session() as lib: file_context = lib.virtualfile_from_data(check_kind="vector", data=data)