| 1 |
# -*- coding: utf-8 -*- |
| 2 |
""" |
| 3 |
Copyright (C) 2021 MeteoSwiss, |
| 4 |
originally written by F.P.A. Vogt; [email protected] |
| 5 |
|
| 6 |
This file may be distributed and/or modified under the conditions |
| 7 |
of the BSD-3-Clause License. |
| 8 |
The terms of this license are available at: |
| 9 |
|
| 10 |
https://opensource.org/licenses/BSD-3-Clause |
| 11 |
|
| 12 |
SPDX-License-Identifier: BSD-3-Clause |
| 13 |
|
| 14 |
Module content: minimal working example of the metsymb LaTeX package |
| 15 |
with matplotlib figures. |
| 16 |
""" |
| 17 |
|
| 18 |
# Import matplotlib |
| 19 |
from matplotlib import pyplot as plt |
| 20 |
|
| 21 |
# Set the proper rcparams elements |
| 22 |
plt.style.use('./metsymb_mwe.mplstyle') |
| 23 |
|
| 24 |
# Create a basic figure with some demo text in the center. |
| 25 |
plt.close(1) |
| 26 |
plt.figure(1, figsize=(4, 0.5)) |
| 27 |
plt.text(0.5, 0.5, |
| 28 |
r'\LARGE Hello World: \threeoktas \nimbostratus \chIX', |
| 29 |
ha='center') |
| 30 |
plt.axis('off') |
| 31 |
|
| 32 |
# Export to different format and display on-screen. |
| 33 |
plt.savefig('metsymb_mwe.pdf') |
| 34 |
plt.savefig('metsymb_mwe.png') |
| 35 |
#plt.show() |