MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_hist

Method test_hist

lib/matplotlib/tests/test_datetime.py:511–555  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

509
510 @mpl.style.context("default")
511 def test_hist(self):
512 mpl.rcParams["date.converter"] = 'concise'
513
514 start_date = datetime.datetime(2023, 10, 1)
515 time_delta = datetime.timedelta(days=1)
516
517 values1 = np.random.randint(1, 10, 30)
518 values2 = np.random.randint(1, 10, 30)
519 values3 = np.random.randint(1, 10, 30)
520
521 bin_edges = [start_date + i * time_delta for i in range(31)]
522
523 fig, (ax1, ax2, ax3) = plt.subplots(3, 1, constrained_layout=True)
524 ax1.hist(
525 [start_date + i * time_delta for i in range(30)],
526 bins=10,
527 weights=values1
528 )
529 ax2.hist(
530 [start_date + i * time_delta for i in range(30)],
531 bins=10,
532 weights=values2
533 )
534 ax3.hist(
535 [start_date + i * time_delta for i in range(30)],
536 bins=10,
537 weights=values3
538 )
539
540 fig, (ax4, ax5, ax6) = plt.subplots(3, 1, constrained_layout=True)
541 ax4.hist(
542 [start_date + i * time_delta for i in range(30)],
543 bins=bin_edges,
544 weights=values1
545 )
546 ax5.hist(
547 [start_date + i * time_delta for i in range(30)],
548 bins=bin_edges,
549 weights=values2
550 )
551 ax6.hist(
552 [start_date + i * time_delta for i in range(30)],
553 bins=bin_edges,
554 weights=values3
555 )
556
557 @pytest.mark.xfail(reason="Test for hist2d not written yet")
558 @mpl.style.context("default")

Callers

nothing calls this directly

Calls 2

histMethod · 0.80
subplotsMethod · 0.45

Tested by

no test coverage detected