Matplotlib标志

显示一些matplotlib徽标。

感谢Tony Yu tsyu80@gmail.com的标志设计

Matplotlib标志示例

  1. import numpy as np
  2. import matplotlib as mpl
  3. import matplotlib.pyplot as plt
  4. import matplotlib.cm as cm
  5. mpl.rcParams['xtick.labelsize'] = 10
  6. mpl.rcParams['ytick.labelsize'] = 12
  7. mpl.rcParams['axes.edgecolor'] = 'gray'
  8. axalpha = 0.05
  9. figcolor = 'white'
  10. dpi = 80
  11. fig = plt.figure(figsize=(6, 1.1), dpi=dpi)
  12. fig.patch.set_edgecolor(figcolor)
  13. fig.patch.set_facecolor(figcolor)
  14. def add_math_background():
  15. ax = fig.add_axes([0., 0., 1., 1.])
  16. text = []
  17. text.append(
  18. (r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = "
  19. r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2}"
  20. r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 "
  21. r"\left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - "
  22. r"\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} "
  23. r"}{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20))
  24. text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} "
  25. r"= -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$",
  26. (0.35, 0.9), 20))
  27. text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$",
  28. (0.15, 0.3), 25))
  29. text.append((r"$F_G = G\frac{m_1m_2}{r^2}$",
  30. (0.85, 0.7), 30))
  31. for eq, (x, y), size in text:
  32. ax.text(x, y, eq, ha='center', va='center', color="#11557c",
  33. alpha=0.25, transform=ax.transAxes, fontsize=size)
  34. ax.set_axis_off()
  35. return ax
  36. def add_matplotlib_text(ax):
  37. ax.text(0.95, 0.5, 'matplotlib', color='#11557c', fontsize=65,
  38. ha='right', va='center', alpha=1.0, transform=ax.transAxes)
  39. def add_polar_bar():
  40. ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar')
  41. ax.patch.set_alpha(axalpha)
  42. ax.set_axisbelow(True)
  43. N = 7
  44. arc = 2. * np.pi
  45. theta = np.arange(0.0, arc, arc/N)
  46. radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8])
  47. width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
  48. bars = ax.bar(theta, radii, width=width, bottom=0.0)
  49. for r, bar in zip(radii, bars):
  50. bar.set_facecolor(cm.jet(r/10.))
  51. bar.set_alpha(0.6)
  52. ax.tick_params(labelbottom=False, labeltop=False,
  53. labelleft=False, labelright=False)
  54. ax.grid(lw=0.8, alpha=0.9, ls='-', color='0.5')
  55. ax.set_yticks(np.arange(1, 9, 2))
  56. ax.set_rmax(9)
  57. if __name__ == '__main__':
  58. main_axes = add_math_background()
  59. add_polar_bar()
  60. add_matplotlib_text(main_axes)
  61. plt.show()

下载这个示例