@@ -337,23 +337,6 @@ def draw(self, renderer):
337
337
gc .restore ()
338
338
339
339
340
- def test_ticks ():
341
- import matplotlib .pyplot as plt
342
- fig = plt .figure (1 )
343
- fig .clf ()
344
- ax = fig .add_subplot (111 )
345
- ax .xaxis .set_visible (False )
346
- ax .yaxis .set_visible (False )
347
- ticks = Ticks (ticksize = 10 , axis = ax .xaxis )
348
- ax .add_artist (ticks )
349
- locs_angles = [((0.2 , 0. ), 90 ),
350
- ((0.4 , 0. ), 120 )]
351
- ticks .set_locs_angles (locs_angles )
352
- plt .draw ()
353
-
354
-
355
-
356
-
357
340
class LabelBase (mtext .Text ):
358
341
"""
359
342
A base class for AxisLabel and TickLabels. The position and angle
@@ -465,33 +448,6 @@ def get_window_extent(self, renderer):
465
448
return bbox
466
449
467
450
468
-
469
- def test_labelbase ():
470
- import matplotlib .pyplot as plt
471
- fig = plt .figure (1 )
472
- fig .clf ()
473
- ax = fig .add_subplot (111 )
474
-
475
- ax .plot ([0.5 ], [0.5 ], "o" )
476
- label = LabelBase (0.5 , 0.5 , "Test" )
477
-
478
- a = - 90
479
- label ._set_ref_angle (a )
480
- label ._set_offset_radius (offset_radius = 50 )
481
- label .set_rotation (- 90 )
482
- label .set (ha = "center" , va = "top" )
483
-
484
- ax .add_artist (label )
485
- plt .draw ()
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
-
495
451
class AxisLabel (LabelBase , AttributeCopier ):
496
452
"""
497
453
Axis Label. Derived from Text. The position of the text is updated
@@ -847,47 +803,6 @@ def get_texts_widths_heights_descents(self, renderer):
847
803
return whd_list
848
804
849
805
850
-
851
- def test_ticklabels ():
852
- import matplotlib .pyplot as plt
853
- fig = plt .figure (1 )
854
- fig .clf ()
855
- ax = fig .add_subplot (111 )
856
- ax .xaxis .set_visible (False )
857
- ax .yaxis .set_visible (False )
858
- ax .plot ([0.2 , 0.4 ], [0.5 , 0.5 ], "o" )
859
- ticks = Ticks (ticksize = 10 , axis = ax .xaxis )
860
- ax .add_artist (ticks )
861
- locs_angles_labels = [((0.2 , 0.5 ), - 90 , "0.2" ),
862
- ((0.4 , 0.5 ), - 120 , "0.4" )]
863
- tick_locs_angles = [(xy , a + 180 ) for xy , a , l in locs_angles_labels ]
864
- ticks .set_locs_angles (tick_locs_angles )
865
-
866
-
867
- ax .plot ([0.5 ], [0.5 ], "," )
868
- axislabel = AxisLabel (0.5 , 0.5 , "Test" )
869
- axislabel ._set_offset_radius (20 )
870
- axislabel ._set_ref_angle (0 )
871
- axislabel .set_axis_direction ("bottom" )
872
- #axislabel._text_follow_ref_angle = True
873
- #axislabel.set(va="center", ha="right")
874
- ax .add_artist (axislabel )
875
-
876
- if 1 :
877
- ticklabels = TickLabels (axis_direction = "left" )
878
- ticklabels ._locs_angles_labels = locs_angles_labels
879
- #ticklabels.set_rotation(90)
880
- ticklabels .set_pad (10 )
881
-
882
- ax .add_artist (ticklabels )
883
-
884
- ax .set_xlim (0 , 1 ); ax .set_ylim (0 , 1 )
885
-
886
- plt .draw ()
887
-
888
-
889
-
890
-
891
806
class GridlinesCollection (LineCollection ):
892
807
def __init__ (self , * kl , ** kwargs ):
893
808
"""
@@ -1611,81 +1526,3 @@ def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
1611
1526
self .minor_ticklabels .set_visible (_ticklabels )
1612
1527
if _label is not None :
1613
1528
self .label .set_visible (_label )
1614
-
1615
-
1616
-
1617
-
1618
-
1619
- def test_axis_artist ():
1620
- global axisline
1621
-
1622
- #self._axislines[loc] = new_fixed_axis(loc=loc, axes=axes)
1623
- from mpl_toolkits .axisartist import AxisArtistHelperRectlinear
1624
- fig = plt .figure (1 )
1625
- fig .clf ()
1626
- ax = fig .add_subplot (111 )
1627
- ax .xaxis .set_visible (False )
1628
- ax .yaxis .set_visible (False )
1629
-
1630
- if 1 :
1631
-
1632
- _helper = AxisArtistHelperRectlinear .Fixed (ax , loc = "left" )
1633
- axisline = AxisArtist (ax , _helper , offset = None , axis_direction = "left" )
1634
- ax .add_artist (axisline )
1635
- _helper = AxisArtistHelperRectlinear .Fixed (ax , loc = "right" )
1636
- axisline = AxisArtist (ax , _helper , offset = None , axis_direction = "right" )
1637
- ax .add_artist (axisline )
1638
-
1639
- _helper = AxisArtistHelperRectlinear .Fixed (ax , loc = "bottom" )
1640
- axisline = AxisArtist (ax , _helper , offset = None , axis_direction = "bottom" )
1641
- axisline .set_label ("TTT" )
1642
- #axisline.label.set_visible(False)
1643
- ax .add_artist (axisline )
1644
-
1645
- #axisline.major_ticklabels.set_axis_direction("bottom")
1646
- axisline .major_ticks .set_tick_out (False )
1647
-
1648
- ax .set_ylabel ("Test" )
1649
-
1650
- axisline .label .set_pad (5 )
1651
-
1652
-
1653
- plt .draw ()
1654
-
1655
- def test_axis_artist2 ():
1656
- global axisline
1657
-
1658
- #self._axislines[loc] = new_fixed_axis(loc=loc, axes=axes)
1659
- from mpl_toolkits .axislines import AxisArtistHelperRectlinear
1660
- fig = plt .figure (1 )
1661
- fig .clf ()
1662
- ax = fig .add_subplot (111 )
1663
- ax .xaxis .set_visible (False )
1664
- ax .yaxis .set_visible (False )
1665
-
1666
-
1667
- _helper = AxisArtistHelperRectlinear .Fixed (ax , loc = "bottom" )
1668
- axisline = AxisArtist (ax , _helper , offset = None , axis_direction = "bottom" )
1669
- axisline .set_label ("TTT" )
1670
- ax .add_artist (axisline )
1671
-
1672
- #axisline.major_ticklabels.set_axis_direction("bottom")
1673
- axisline .major_ticks .set_tick_out (False )
1674
-
1675
-
1676
- ax .set_ylabel ("Test" )
1677
-
1678
- plt .draw ()
1679
-
1680
- if __name__ == "__main__" :
1681
- #test_labelbase()
1682
- #test_ticklabels()
1683
- test_axis_artist ()
1684
- #test_axis_artist2()
1685
-
1686
-
1687
- # DONE
1688
- # *. ticks, ticklabels, axislabels
1689
- # *. workon axisartist
1690
-
1691
- # TODO
0 commit comments