Пример #1
0
 def test_subplots(self):
     """test subplots generation"""
     p, _ = Plot.subplots()
     self.assertEqual(len(p), 1)
     p, _ = Plot.subplots(3)
     self.assertEqual(len(p), 3)
     p, _ = Plot.subplots(32)
     self.assertEqual(len(p), 6)
Пример #2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""demonstration of xy plot"""
import numpy as np
from pygraceplot.graceplot import Plot

p, ax = Plot.subplots(1, 1, description="sin(x) drawn by pygraceplot")
x = np.linspace(-np.pi, np.pi, 100)
y = np.sin(x)
ax.plot(x, y, symbol="none", color="blue", label="sin(x)")
p.tight_graph()
ax.set_legend(loc="upper left", charsize=2.0)
p.savefig("sin.eps")

Пример #3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Bar plot for effective cluster interaction"""
import numpy as np
from pygraceplot.graceplot import Plot

# data generation
x_two_body = np.arange(1, 24, 1)
x_three_body = np.arange(24, 34, 1)
y_two_body = np.random.randint(-2, 4, size=len(x_two_body))
y_three_body = np.random.randint(-2, 4, size=len(x_three_body))

# plot
p, ax = Plot.subplots(1,
                      1,
                      description="ECI drawn by pygraceplot",
                      background=False)
ax.set_view(xmin=0.3235, xmax=1.1, ymin=0.25, ymax=0.85)
ax.plot(x_two_body,
        y_two_body,
        ls="none",
        label="two-body",
        color="red",
        datatype="bar")
ax.plot(x_three_body,
        y_three_body,
        ls="none",
        label="three-body",
        color="green",
        datatype="bar")
ax.axhline(0.0)