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