Exemple #1
0
def test_axes_without_shift():
    """Test whether axes are not shifted when origin is in plot range."""
    G = GraphScene(
        x_min=-1, x_max=2, x_axis_label="", y_min=-2, y_max=5, y_axis_label=""
    )
    G.setup_axes()
    assert all(np.isclose(G.graph_origin, G.x_axis.n2p(0)))
    assert all(np.isclose(G.graph_origin, G.y_axis.n2p(0)))
Exemple #2
0
def test_axes_with_y_shift():
    """Test whether y-axis is shifted when 0 is not in plot range of y-axis."""
    G = GraphScene(
        x_min=-1, x_max=2, x_axis_label="", y_min=1, y_max=5, y_axis_label=""
    )
    G.setup_axes()
    assert all(np.isclose(G.graph_origin, G.x_axis.n2p(0)))
    assert all(np.isclose(G.graph_origin, G.y_axis.n2p(1)))
Exemple #3
0
def test_axes_with_xy_shift():
    """Test whether both axes are shifted when origin is not in plot range."""
    G = GraphScene(
        x_min=1, x_max=5, x_axis_label="", y_min=-5, y_max=-1, y_axis_label=""
    )
    G.setup_axes()
    assert all(np.isclose(G.graph_origin, G.x_axis.n2p(1)))
    assert all(np.isclose(G.graph_origin, G.y_axis.n2p(-5)))
Exemple #4
0
 def __init__(self, **kwargs):
     GraphScene.__init__(self,
                         x_min=0,
                         x_max=12,
                         y_min=-2,
                         y_max=2,
                         graph_origin=np.array((-5.0, 0.0, 0.0)),
                         axes_color=nq_textcolors["white"],
                         x_labeled_nums=range(0, 12, 2),
                         **kwargs)