Matplotlib.axis.Axis.properties() function in Python
Last Updated :
11 Jun, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack.
Â
matplotlib.axis.Axis.properties() Function
The Axis.properties() function in axis module of matplotlib library is used to get the dictionary of all the properties of the artist.Â
Â
Syntax: Axis.properties(self)Â
Parameters: This method does not accepts any parameters.Â
Return value: This method return dictionary of all the properties of the artist.Â
Below examples illustrate the matplotlib.axis.Axis.properties() function in matplotlib.axis:
Example 1:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import numpy as np
import matplotlib.pyplot as plt
xx = np.random.rand(5, 7)
fig, ax = plt.subplots()
m = ax.pcolor(xx)
m.set_zorder(2)
w = Axis.properties(ax)
print("Display all Properties\n")
for i in w:
print(i, ":", w[i])
fig.suptitle('matplotlib.axis.Axis.properties() \
function Example\n', fontweight ="bold")
plt.show()
Output:Â
Â
Display all Properties
adjustable : boxÂ
agg_filter : NoneÂ
alpha : NoneÂ
anchor : CÂ
animated : FalseÂ
aspect : autoÂ
autoscale_on : TrueÂ
autoscalex_on : TrueÂ
autoscaley_on : TrueÂ
axes_locator : NoneÂ
axisbelow : lineÂ
children : [<matplotlib.collections.PolyCollection object at 0x098F9810>, <matplotlib.spines.Spine object at 0x087152B0>, <matplotlib.spines.Spine object at 0x08715350>, <matplotlib.spines.Spine object at 0x087153F0>, <matplotlib.spines.Spine object at 0x08715490>, <matplotlib.axis.XAxis object at 0x08715230>, <matplotlib.axis.YAxis object at 0x08715710>, Text(0.5, 1.0, ''), Text(0.0, 1.0, ''), Text(1.0, 1.0, ''), <matplotlib.patches.Rectangle object at 0x0873B150>]Â
clip_box : NoneÂ
clip_on : TrueÂ
clip_path : NoneÂ
contains : NoneÂ
data_ratio : 0.7142857142857143Â
default_bbox_extra_artists : [<matplotlib.collections.PolyCollection object at 0x098F9810>, <matplotlib.spines.Spine object at 0x087152B0>,<matplotlib.spines.Spine object at 0x08715350>, <matplotlib.spines.Spine object at 0x087153F0>, <matplotlib.spines.Spine object at 0x08715490>, <matplotlib.axis.XAxis object at 0x08715230>, <matplotlib.axis.YAxis object at 0x08715710>, Text(0.5, 1.0, ''), Text(0.0, 1.0, ''), Text(1.0, 1.0, ''), <matplotlib.patches.Rectangle object at 0x0873B150>]Â
facecolor : (1.0, 1.0, 1.0, 1.0)Â
fc : (1.0, 1.0, 1.0, 1.0)Â
figure : Figure(640x480)Â
frame_on : TrueÂ
geometry : (1, 1, 1)Â
gid : NoneÂ
gridspec : GridSpec(1, 1)Â
images : <a list of 0 AxesImage objects>Â
in_layout : TrueÂ
label :Â
legend : NoneÂ
legend_handles_labels : ([], [])Â
lines :<a list of 0 Line2D objects>Â
navigate : TrueÂ
navigate_mode : NoneÂ
path_effects : []Â
picker : NoneÂ
position : Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88)Â
rasterization_zorder : NoneÂ
rasterized : NoneÂ
renderer_cache : NoneÂ
shared_x_axes : <matplotlib.cbook.Grouper object at 0x085CE210>Â
shared_y_axes :<matplotlib.cbook.Grouper object at 0x085CE270>Â
sketch_params : NoneÂ
snap : NoneÂ
subplotspec : <matplotlib.gridspec.SubplotSpec object at 0x079122B0>Â
title :Â
transform : IdentityTransform()Â
transformed_clip_path_and_affine : (None, None)Â
url : NoneÂ
visible : TrueÂ
window_extent : TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))Â
xaxis : XAxis(80.0,52.8)Â
xaxis_transform : BlendedGenericTransform(Â
CompositeGenericTransform(Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())),Â
CompositeGenericTransform(Â
BboxTransformFrom(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=7.0, y1=5.0),Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())))),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))))),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))))Â
xbound : (0.0, 7.0)Â
xgridlines : <a list of 8 Line2D gridline objects>Â
xlabel :Â
xlim : (0.0, 7.0)Â
xmajorticklabels : <a list of 8 Text major ticklabel objects>Â
xminorticklabels : <a list of 0 Text minor ticklabel objects>Â
xscale : linearÂ
xticklabels : <a list of 8 Text major ticklabel objects>Â
xticklines : <a list of 16 Line2D ticklines objects>Â
xticks : [0. 1. 2. 3. 4. 5. 6. 7.]Â
yaxis : YAxis(80.0,52.8)Â
yaxis_transform : BlendedGenericTransform(Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))),Â
CompositeGenericTransform(Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())),Â
CompositeGenericTransform(Â
BboxTransformFrom(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=7.0, y1=5.0),Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())))),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))))))Â
ybound : (0.0, 5.0)Â
ygridlines : <a list of 6 Line2D gridline objects>Â
ylabel :Â
ylim : (0.0, 5.0)Â
ymajorticklabels : <a list of 6 Text major ticklabel objects>Â
yminorticklabels : <a list of 0 Text minor ticklabel objects>Â
yscale : linearÂ
yticklabels : <a list of 6 Text major ticklabel objects>Â
yticklines : <a list of 12 Line2D ticklines objects>Â
yticks : [0. 1. 2. 3. 4. 5.]Â
zorder : 0Â
Â
Example 2:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(10**7)
geeks = np.random.randn(100)
fig, ax = plt.subplots()
ax.acorr(geeks, usevlines = True,
normed = True,
maxlags = 80, lw = 3)
ax.grid(True)
w = Axis.properties(ax)
print("Display all Properties\n")
for i in w:
print(i, ":", w[i])
fig.suptitle('matplotlib.axis.Axis.properties() \
function Example\n', fontweight ="bold")
plt.show()
Output:Â
Â
Â
Display all Properties
adjustable : boxÂ
agg_filter : NoneÂ
alpha : NoneÂ
anchor : CÂ
animated : FalseÂ
aspect : autoÂ
autoscale_on : TrueÂ
autoscalex_on : TrueÂ
autoscaley_on : TrueÂ
axes_locator : NoneÂ
axisbelow : lineÂ
children : [<matplotlib.collections.LineCollection object at 0x0AAFA810>, <matplotlib.lines.Line2D object at 0x0AAFA7F0>, <matplotlib.spines.Spine object at 0x081762D0>, <matplotlib.spines.Spine object at 0x08176370>, <matplotlib.spines.Spine object at 0x08176410>, <matplotlib.spines.Spine object at 0x081764B0>, <matplotlib.axis.XAxis object at 0x08176250>, <matplotlib.axis.YAxis object at 0x081766F0>, Text(0.5, 1.0, ''), Text(0.0, 1.0, ''), Text(1.0, 1.0, ''), <matplotlib.patches.Rectangle object at 0x0819D130>]Â
clip_box : NoneÂ
clip_on : TrueÂ
clip_path : NoneÂ
contains : NoneÂ
data_ratio : 0.007741698372824119Â
default_bbox_extra_artists : [<matplotlib.collections.LineCollection object at 0x0AAFA810>, <matplotlib.lines.Line2D object at 0x0AAFA7F0>, <matplotlib.spines.Spine object at 0x081762D0>, <matplotlib.spines.Spine object at 0x08176370>, <matplotlib.spines.Spine object at 0x08176410>, <matplotlib.spines.Spine object at 0x081764B0>, <matplotlib.axis.XAxis object at 0x08176250>, <matplotlib.axis.YAxis object at 0x081766F0>, Text(0.5, 1.0, ''), Text(0.0, 1.0, ''), Text(1.0, 1.0, ''), <matplotlib.patches.Rectangle object at 0x0819D130>]Â
facecolor : (1.0, 1.0, 1.0, 1.0)Â
fc : (1.0, 1.0, 1.0, 1.0)Â
figure : Figure(640x480)Â
frame_on : TrueÂ
geometry : (1, 1, 1)Â
gid : NoneÂ
gridspec : GridSpec(1, 1)Â
images : <a list of 0 AxesImage objects>Â
in_layout : TrueÂ
label :Â
legend : NoneÂ
legend_handles_labels : ([], [])Â
lines : <a list of 1 Line2D objects>Â
navigate : TrueÂ
navigate_mode : NoneÂ
path_effects : []Â
picker : NoneÂ
position : Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88)Â
rasterization_zorder : NoneÂ
rasterized : NoneÂ
renderer_cache : NoneÂ
shared_x_axes : <matplotlib.cbook.Grouper object at 0x0802E210>Â
shared_y_axes : <matplotlib.cbook.Grouper object at 0x0802E270>Â
sketch_params : NoneÂ
snap : NoneÂ
subplotspec : <matplotlib.gridspec.SubplotSpec object at 0x073722F0>Â
title :Â
transform : IdentityTransform()Â
transformed_clip_path_and_affine : (None, None)Â
url : NoneÂ
visible : TrueÂ
window_extent : TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))Â
xaxis : XAxis(80.0,52.8)Â
xaxis_transform : BlendedGenericTransform(Â
CompositeGenericTransform(Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())),Â
CompositeGenericTransform(Â
BboxTransformFrom(Â
TransformedBbox(Â
Bbox(x0=-88.0, y0=-0.300605326634452, x1=88.0, y1=1.061933586982593),Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())))),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))))),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))))Â
xbound : (-88.0, 88.0)Â
xgridlines : <a list of 11 Line2D gridline objects>Â
xlabel :Â
xlim : (-88.0, 88.0)Â
xmajorticklabels : <a list of 11 Text major ticklabel objects>Â
xminorticklabels : <a list of 0 Text minor ticklabel objects>Â
xscale : linearÂ
xticklabels : <a list of 11 Text major ticklabel objects>Â
xticklines : <a list of 22 Line2D ticklines objects>Â
xticks : [-100. -80. -60. -40. -20. 0. 20. 40. 60. 80. 100.]Â
yaxis : YAxis(80.0,52.8)Â
yaxis_transform : BlendedGenericTransform(Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))),Â
CompositeGenericTransform(Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())),Â
CompositeGenericTransform(Â
BboxTransformFrom(Â
TransformedBbox(Â
Bbox(x0=-88.0, y0=-0.300605326634452, x1=88.0, y1=1.061933586982593),Â
TransformWrapper(Â
BlendedAffine2D(Â
IdentityTransform(),Â
IdentityTransform())))),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),Â
BboxTransformTo(Â
TransformedBbox(Â
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),Â
Affine2D(Â
[[100. 0. 0.]Â
[ 0. 100. 0.]Â
[ 0. 0. 1.]]))))))))Â
ybound : (-0.300605326634452, 1.061933586982593)Â
ygridlines : <a list of 9 Line2D gridline objects>Â
ylabel :Â
ylim : (-0.300605326634452, 1.061933586982593)Â
ymajorticklabels : <a list of 9 Text major ticklabel objects>Â
yminorticklabels : <a list of 0 Text minor ticklabel objects>Â
yscale : linearÂ
yticklabels : <a list of 9 Text major ticklabel objects>Â
yticklines : <a list of 18 Line2D ticklines objects>Â
yticks : [-0.4 -0.2 0. 0.2 0.4 0.6 0.8 1. 1.2]Â
zorder : 0Â
Â
Â