Beispiel #1
0
 def test_axes_warnings(self):
     ax = Axes()
     warnings_expected = 9
     with warnings.catch_warnings(record=True) as w:
         # Cause all warnings to always be triggered.
         warnings.simplefilter("always")
         # Trigger warnings.
         ax.text(0.5, 0.91, 'text1', withdash=True)  # 1 warning
         ax.fill_between(self.x, self.y * 0.1, self.y * 1.1,
                         step='pre')  # 1 warning
         ax.fill_between(self.x,
                         -self.y - 10,
                         self.y - 10,
                         where=(self.x >= np.mean(self.x)),
                         interpolate=True)  # 1 warning
         ax.set_xlim([-1, 2], emit=False, auto=True,
                     blah=True)  # 3 warnings
         ax.set_ylim([-1, 2], emit=False, auto=True,
                     blah=True)  # 3 warnings
         # Verify that warnings were made.
         assert len(w) == warnings_expected
     self.printv(
         '      test_axes_warnings: tried to make probelmatic calls to Axes methods '
         'and got {}/{} warnings. ax = {}'.format(len(w), warnings_expected,
                                                  ax))
Beispiel #2
0
 def test_axes_err(self):
     ax = Axes()
     yerr = self.y * 0.1
     ax.errorbar(-self.x, self.y, yerr, color='r')
     ax.errorbar(self.x,
                 self.y,
                 yerr,
                 color='r',
                 capsize=6,
                 capthick=1.25,
                 marker='s',
                 ecolor='m')
     ax.errorbar(data={'x': -self.x, 'y': -self.y, 'yerr': yerr})
     ax.errorbar(self.x,
                 self.y,
                 yerr,
                 elinewidth=2.5,
                 markeredgewidth=1.2,
                 barsabove=True)
     ax.errorbar(self.x, self.y - 20, yerr, capsize=0, capthick=0)
     ax.fill_between(self.x, -self.y - yerr - 1, -self.y + yerr - 1)
     ax.fill_between(data={
         'x': -self.x,
         'y1': 10 - self.y - yerr - 1,
         'y2': -self.y + yerr - 1
     })
     ax.fill_between(self.x,
                     -self.y - yerr - 1,
                     -self.y + yerr - 1,
                     where=(self.x >= np.mean(self.x)))
     ax.fill_between(self.x, self.y + 20, 0)