UnsupportedImageFormatError(extension)
Source¶
Bases: NumdaplotError
Raised when the path of an image does not end with .png, .svg or .pdf.
Added in version 0.1.0
Parameters:
-
extension(str)The rejected extension, such as
.jpg, or an empty text when the path has none.
Attributes:
-
extensionThe rejected extension, such as
.jpg, or an empty text when the path has none.
Examples:
import tempfile
from pathlib import Path
import numdaplot as ndp
path = Path(tempfile.mkdtemp()) / "prices.jpg"
prices = ndp.Array.from_list([12.0, 15.5])
plot = ndp.Plot.line(prices)
try:
plot.save(path)
except ndp.UnsupportedImageFormatError as error:
print(error)
# Cannot save an image as '.jpg': use .png, .svg or .pdf.