def test_figure_show(): """ Test that show creates the correct file name and deletes the temp dir. """ fig = Figure() fig.basemap(region="10/70/-300/800", projection="X3i/5i", frame="af") fig.show()
def test_figure_display_external(): """ Test to check that a figure can be displayed in an external window. """ fig = Figure() fig.basemap(region=[0, 3, 6, 9], projection="X1c", frame=True) fig.show(method="external")
def test_figure_show_invalid_method(): """ Test to check if an error is raised when an invalid method is passed to show. """ fig = Figure() fig.basemap(region="10/70/-300/800", projection="X3i/5i", frame="af") with pytest.raises(GMTInvalidInput): fig.show(method="test")
def test_figure_show_notebook_error_without_ipython(): """ Test to check if an error is raised when display method is 'notebook', but IPython is not installed. """ fig = Figure() fig.basemap(region=[0, 1, 2, 3], frame=True) with pytest.raises(GMTError): fig.show(method="notebook")
def test_figure_show(): "Test that show creates the correct file name and deletes the temp dir" fig = Figure() fig.basemap(region="10/70/-300/800", projection="X3i/5i", frame="af") img = fig.show(width=800) assert img.width == 800
C=True, verbose=True, L="1p/black") if mt_colorbar: fig.colorbar(position="n.95/.825+w-2c/.45c", frame='af+l"depth [km]"') # Scalebar, need to use config to set the pen thickness of the scale with config(MAP_TICK_PEN_PRIMARY=1.5): fig.basemap(region=region, projection=projection, #frame=["WSne", "gfa"], map_scale=map_scale) # Landmark text fig.text(textfiles=landmarks_fid) # Plot the whole of Alaska as an inset to give context if inset: with fig.inset(position="n0/.75+w5c/4c", margin=0): # Plot the whole of Alaska as the inset fig.coast(region=[-170, -135, 53, 72], projection="L-150/62/63/64/3.5c", land="gray", water="white", shorelines="0p,black", frame=False, resolution="h", area_thresh=100) # !!! THIS DOESNT WORK Put a box in the inset around Northern Alaska rectangle = [region[0], region[2], region[1], region[3]] fig.plot(data=rectangle, style="r+s", pen="1p,red") # Plot the plate coupling / slip rate deficit with a no-label colorbar # Save and show fig.savefig(output, transparent=bg_transparent) fig.show(method="external")