Python mpl_toolkits.axes_grid1.host_subplot() Examples

The following are 3 code examples of mpl_toolkits.axes_grid1.host_subplot(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module mpl_toolkits.axes_grid1 , or try the search function .
Example #1
Source File: test_legend.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def test_parasite(self):
        from mpl_toolkits.axes_grid1 import host_subplot

        host = host_subplot(111)
        par = host.twinx()

        p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
        p2, = par.plot([0, 1, 2], [0, 3, 2], label="Temperature")

        with mock.patch('matplotlib.legend.Legend') as Legend:
            leg = plt.legend()
        Legend.assert_called_with(host, [p1, p2],
                ['Density', 'Temperature']) 
Example #2
Source File: test_legend.py    From coffeegrindsize with MIT License 4 votes vote down vote up
def test_parasite(self):
        from mpl_toolkits.axes_grid1 import host_subplot

        host = host_subplot(111)
        par = host.twinx()

        p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
        p2, = par.plot([0, 1, 2], [0, 3, 2], label="Temperature")

        with mock.patch('matplotlib.legend.Legend') as Legend:
            leg = plt.legend()
        Legend.assert_called_with(host, [p1, p2],
                ['Density', 'Temperature']) 
Example #3
Source File: test_legend.py    From twitter-stock-recommendation with MIT License 4 votes vote down vote up
def test_parasite(self):
        from mpl_toolkits.axes_grid1 import host_subplot

        host = host_subplot(111)
        par = host.twinx()

        p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
        p2, = par.plot([0, 1, 2], [0, 3, 2], label="Temperature")

        with mock.patch('matplotlib.legend.Legend') as Legend:
            leg = plt.legend()
        Legend.assert_called_with(host, [p1, p2],
                ['Density', 'Temperature'])