def testScatterplot(self): flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", huefacet="Dox").plot(self.ex) flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", xscale="log", yscale="log", huefacet="Dox").plot(self.ex) flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", xscale="logicle", yscale="logicle", huefacet="Dox").plot(self.ex)
util.expand_class_attributes(DensityView) util.expand_method_parameters(DensityView, DensityView.plot) if __name__ == '__main__': import cytoflow as flow tube1 = flow.Tube(file='../../cytoflow/tests/data/Plate01/RFP_Well_A3.fcs', conditions={"Dox": 10.0}) tube2 = flow.Tube(file='../../cytoflow/tests/data/Plate01/CFP_Well_A4.fcs', conditions={"Dox": 1.0}) ex = flow.ImportOp(conditions={"Dox": "float"}, tubes=[tube1, tube2]) thresh = flow.ThresholdOp() thresh.name = "Y2-A+" thresh.channel = 'Y2-A' thresh.threshold = 200.0 ex2 = thresh.apply(ex) scatter = flow.ScatterplotView() scatter.name = "Scatter" scatter.xchannel = "FSC-A" scatter.ychannel = "SSC-A" scatter.xscale = "logicle" scatter.yscale = "logicle" scatter.huefacet = 'Dox' plt.ioff() scatter.plot(ex2) plt.show()
def setUp(self): ImportedDataTest.setUp(self) self.view = flow.ScatterplotView(xchannel = "B1-A", ychannel = "Y2-A")
def setUp(self): super().setUp() self.view = flow.ScatterplotView(xchannel="B1-A", ychannel="Y2-A")
def testScatterplot(self): import numpy as np import matplotlib.pyplot as plt flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", xscale="linear", yscale="linear", huefacet="Dox").plot(self.ex) ax = plt.gca() np.testing.assert_array_equal( ax.get_xticks(), np.array([-500., 0., 500., 1000., 1500., 2000., 2500., 3000.]), ) np.testing.assert_array_equal( ax.get_yticks(), np.array([ -10000., 0., 10000., 20000., 30000., 40000., 50000., 60000., 70000. ]), ) flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", xscale="log", yscale="log", huefacet="Dox").plot(self.ex) ax = plt.gca() np.testing.assert_array_equal( ax.get_xticks(), np.array([1.e-2, 1.e-1, 1., 1.e1, 1.e2, 1.e3, 1.e4, 1.e5]), ) np.testing.assert_array_equal( ax.get_yticks(), np.array([1.e-2, 1.e-1, 1., 1.e1, 1.e2, 1.e3, 1.e4, 1.e+05, 1.e6]), ) flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", xscale="logicle", yscale="logicle", huefacet="Dox").plot(self.ex) ax = plt.gca() np.testing.assert_array_equal( ax.get_xticks(), np.array([-100., 0., 100., 1000.]), ) np.testing.assert_array_equal( ax.get_yticks(), np.array([-100., 0., 100., 1000., 10000.]), ) # try setting default scale and _not_ setting xscale, yscale flow.set_default_scale("log") self.assertEqual(flow.get_default_scale(), "log") flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", huefacet="Dox").plot(self.ex) ax = plt.gca() np.testing.assert_array_equal( ax.get_xticks(), np.array([1.e-2, 1.e-1, 1., 1.e1, 1.e2, 1.e3, 1.e4, 1.e5]), ) np.testing.assert_array_equal( ax.get_yticks(), np.array([1.e-2, 1.e-1, 1., 1.e1, 1.e2, 1.e3, 1.e4, 1.e+05, 1.e6]), ) flow.set_default_scale("linear") # reset the default scale
util.expand_class_attributes(QuadSelection) util.expand_method_parameters(QuadSelection, QuadSelection.plot) if __name__ == '__main__': import cytoflow as flow tube1 = flow.Tube(file='../../cytoflow/tests/data/Plate01/RFP_Well_A3.fcs', conditions={"Dox": 10.0}) tube2 = flow.Tube(file='../../cytoflow/tests/data/Plate01/CFP_Well_A4.fcs', conditions={"Dox": 1.0}) ex = flow.ImportOp(conditions={"Dox": "float"}, tubes=[tube1, tube2]) r = flow.QuadOp(name="Quad", xchannel="V2-A", ychannel="Y2-A") rv = r.default_view(xscale="logicle", yscale="logicle") plt.ioff() rv.plot(ex) rv.interactive = True plt.show() print("x:{0} y:{1}".format(r.xthreshold, r.ythreshold)) ex2 = r.apply(ex) flow.ScatterplotView(xchannel="V2-A", ychannel="Y2-A", xscale="logicle", yscale="logicle", huefacet="Quad").plot(ex2) plt.show()