def some_plot(self, cmap):
     plt, fig, ax = plot.basic()
     N = 1000
     array_dg = np.random.uniform(0, 10, size=(N, 2))
     colors = np.random.uniform(-2, 2, size=(N, ))
     plt.scatter(array_dg[:, 0], array_dg[:, 1], c=colors, cmap=cmap)
     plt.colorbar()
     plt.show()
示例#2
0
 def test_visually(self):
     plt, fig, ax = plot.basic()
     plt.plot([1, 2, 4], label="test")
     plt.plot([2, 2, 3], label="test2")
     plot.h_line(1, color="red")
     plot.legend(loc="lower right", alpha=1.)
     plt.xlabel("x-axis")
     plt.ylabel("y-axis")
     self.show()
示例#3
0
 def test_subplots_visually(self):
     plt, fig, ax = plot.basic(2, 1)
     ax[0].plot([1, 2, 4], label="test")
     ax[0].set_xlabel("x_label")
     ax[0].set_ylabel("y_label")
     ax[0].set_title("ax0 title")
     ax[1].plot([1, 2, 4], label="test 2")
     ax[1].set_title("ax1 title")
     ax[1].set_xlabel("x_label")
     plt.show()
示例#4
0
    def test_bar_visually(self):
        plt, fig, ax = plot.basic()
        b1 = [
            0.0022312583236333053, 2.30072232554551e-05,
            2.0288252517587813e-05, 1.0155657023897475e-05,
            1.3928905164667381e-05, 5.789764361632152e-06,
            1.2345582129869121e-05, 1.125099009374256e-05,
            8.375211416428887e-06, 8.835039982342082e-06
        ]
        b2 = [
            0.042499270794620105, 5.264903451938897e-05, 0.0019489462821535033,
            4.024229907858245e-05, 3.077925332007259e-05,
            3.093287138100361e-05, 0.00014016427496842322,
            1.853694957102855e-05, 2.3703962751812195e-05,
            5.536745197248537e-06
        ]
        b3 = [
            0.023030640797494107, 1.5970049271846566e-05, 0.000811411992130343,
            1.2886894992963836e-05, 1.0031007849522452e-05,
            8.636313098929208e-06, 5.124210336705097e-05,
            7.615945200570969e-06, 1.2259974414554043e-05,
            5.353390492722848e-06
        ]
        b4 = [
            0.0020611468530092264, 5.413584591167569e-06,
            1.5629098646494706e-05, 5.0767580016579335e-06,
            6.593670459802336e-06, 3.9572836668542565e-06,
            7.1269968357244615e-06, 6.5854090982057785e-06,
            9.375832865607904e-06, 3.4312823489133688e-06
        ]

        plot.bar_plot((b1, {
            "label": "bar 1"
        }), (b2, {
            "label": "bar 2"
        }), (b3, {
            "label": "bar 3"
        }), (b4, {
            "label": "bar 4"
        }),
                      x_labels=["1st", "2nd", "3rd"] +
                      ["{}th".format(i + 1) for i in range(3, len(b1))])
        self.show()
示例#5
0
from bunchofutils import colormap, plot
import numpy as np

cmap = colormap.colormap_from_png("matlab.png")

plt, fig, ax = plot.basic()
N = 1000
array_dg = np.random.uniform(0, 10, size=(N, 2))
colors = np.random.uniform(-2, 2, size=(N, ))
plt.scatter(array_dg[:, 0], array_dg[:, 1], c=colors, cmap=cmap)
plt.colorbar()
plt.show()