subplots, subplot, axes的参数和属性

plt.subplots

生成fig和AxesSubplot类型
参数:
nrows, ncols : int, optional, default: 1
sharex, sharey: bool or {‘none’, ‘all’, ‘row’, ‘col’}, default: False

  • True or ‘all’: 所有共享
  • False or ‘none’: 分开
  • ‘row’: 每一行共享
  • ‘col’: 每一列共享
  • sharex只有最下行有x刻度,sharey只有最左列有y刻度。如果要显示用tick_params参数 labelbottom、labelleft,如ax.tick_params(labelbottom=True)

squeeze : bool, optional, default: True

  • False: 无论1x1, 1xn, nx1, nxm,都返回二维数组
  • True: nxm二维数组,其他压缩

num : int or str, optional, default: None。设置序号或者标签
subplot_kw : dict, optional。Figure.add_subplot使用

plt.subplot

生成AxesSubplot类型
参数
plt.subplot(212, sharex=ax1, sharey=ax1, label='ax2')
包括axes的set部分,详情见下

Axes属性

set设置

除去set_axis_off,set_axis_on,set_axisbelow,其他去掉set_前缀都可以做为plt.subplot的参数。例如

plt.subplot(211, sharex=ax1, sharey=ax1, label='label',
            alpha=0.5, fc='r', yscale='log')
   
set_adjustable {‘box’, ‘datalim’}
set_agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
set_alpha float or None
set_anchor 2-tuple of floats or {‘C’, ‘SW’, ‘S’, ‘SE’, …}
set_animated bool
set_aspect {‘auto’, ‘equal’} or num
set_autoscale_on bool
set_autoscalex_on bool
set_autoscaley_on bool
set_axes_locator Callable[[Axes, Renderer], Bbox]
set_axis_off
set_axis_on
set_axisbelow
set_clip_box bool or ‘line’
set_clip_on ‘.Bbox’
set_clip_path bool
set_contains Patch or (Path, Transform) or None
set_facecolor callable
set_fc color
set_figure color
set_frame_on ‘.Figure’
set_gid bool
set_in_layout str
set_label bool
set_navigate object
set_navigate_mode bool
set_path_effects unknown
set_picker ‘.AbstractPathEffect’
set_position None or bool or float or callable
set_prop_cycle [left, bottom, width, height] or ‘~matplotlib.transforms.Bbox’
set_rasterization_zorder unknown
set_rasterized float or None
set_sketch_params bool or None
set_snap (scale: float, length: float, randomness: float)
set_subplotspec bool or None
set_title str
set_transform ‘.Transform’
set_url str
set_visible bool
- 以下7个y通用
set_xbound unknown
set_xlabel str
set_xlim (bottom: float, top: float)
set_xmargin float greater than -0.5
set_xscale {“linear”, “log”, “symlog”, “logit”, …}
set_xticklabels List[str]
set_xticks unknown
-
set_zorder float

完整属性

acorr
add_artist
add_callback
add_child_axes
add_collection
add_container
add_image
add_line
add_patch
add_table
aname
angle_spectrum
annotate
apply_aspect
arrow
artists
autoscale
autoscale_view
axes
axhline
axhspan
axis
axison
axvline
axvspan
bar
barbs
barh
bbox
boxplot
broken_barh
bxp
callbacks
can_pan
can_zoom
change_geometry
child_axes
cla
clabel
clear
clipbox
cohere
colNum
collections
containers
contains
contains_point
contour
contourf
convert_xunits
convert_yunits
csd
dataLim
drag_pan
draw
draw_artist
end_pan
errorbar
eventplot
eventson
figbox
figure
fill
fill_between
fill_betweenx
findobj
fmt_xdata
fmt_ydata
format_coord
format_cursor_data
format_xdata
format_ydata
get_adjustable
get_agg_filter
get_alpha
get_anchor
get_animated
get_aspect
get_autoscale_on
get_autoscalex_on
get_autoscaley_on
get_axes_locator
get_axisbelow
get_children
get_clip_box
get_clip_on
get_clip_path
get_contains
get_cursor_data
get_data_ratio
get_data_ratio_log
get_default_bbox_extra_artists
get_facecolor
get_fc
get_figure
get_frame_on
get_geometry
get_gid
get_gridspec
get_images
get_in_layout
get_label
get_legend
get_legend_handles_labels
get_lines
get_navigate
get_navigate_mode
get_path_effects
get_picker
get_position
get_rasterization_zorder
get_rasterized
get_renderer_cache
get_shared_x_axes
get_shared_y_axes
get_sketch_params
get_snap
get_subplotspec
get_tightbbox
get_title
get_transform
get_transformed_clip_path_and_affine
get_url
get_visible
get_window_extent
get_xaxis
get_xaxis_text1_transform
get_xaxis_text2_transform
get_xaxis_transform
get_xbound
get_xgridlines
get_xlabel
get_xlim
get_xmajorticklabels
get_xminorticklabels
get_xscale
get_xticklabels
get_xticklines
get_xticks
get_yaxis
get_yaxis_text1_transform
get_yaxis_text2_transform
get_yaxis_transform
get_ybound
get_ygridlines
get_ylabel
get_ylim
get_ymajorticklabels
get_yminorticklabels
get_yscale
get_yticklabels
get_yticklines
get_yticks
get_zorder
grid
has_data
have_units
hexbin
hist
hist2d
hlines
ignore_existing_data_limits
images
imshow
in_axes
indicate_inset
indicate_inset_zoom
inset_axes
invert_xaxis
invert_yaxis
is_first_col
is_first_row
is_last_col
is_last_row
is_transform_set
label_outer
legend
legend_
lines
locator_params
loglog
magnitude_spectrum
margins
matshow
minorticks_off
minorticks_on
mouseover
name
numCols
numRows
patch
patches
pchanged
pcolor
pcolorfast
pcolormesh
phase_spectrum
pick
pickable
pie
plot
plot_date
properties
psd
quiver
quiverkey
redraw_in_frame
relim
remove
remove_callback
reset_position
rowNum
scatter
secondary_xaxis
secondary_yaxis
semilogx
semilogy
set
set_adjustable
set_agg_filter
set_alpha
set_anchor
set_animated
set_aspect
set_autoscale_on
set_autoscalex_on
set_autoscaley_on
set_axes_locator
set_axis_off
set_axis_on
set_axisbelow
set_clip_box
set_clip_on
set_clip_path
set_contains
set_facecolor
set_fc
set_figure
set_frame_on
set_gid
set_in_layout
set_label
set_navigate
set_navigate_mode
set_path_effects
set_picker
set_position
set_prop_cycle
set_rasterization_zorder
set_rasterized
set_sketch_params
set_snap
set_subplotspec
set_title
set_transform
set_url
set_visible
set_xbound
set_xlabel
set_xlim
set_xmargin
set_xscale
set_xticklabels
set_xticks
set_ybound
set_ylabel
set_ylim
set_ymargin
set_yscale
set_yticklabels
set_yticks
set_zorder
specgram
spines
spy
stackplot
stale
stale_callback
start_pan
stem
step
sticky_edges
streamplot
table
tables
text
texts
tick_params
ticklabel_format
title
titleOffsetTrans
transAxes
transData
transLimits
transScale
tricontour
tricontourf
tripcolor
triplot
twinx
twiny
update
update_datalim
update_datalim_bounds
update_from
update_params
use_sticky_edges
viewLim
violin
violinplot
vlines
xaxis
xaxis_date
xaxis_inverted
xcorr
yaxis
yaxis_date
yaxis_inverted
zorder
_add_text
_adjustable
_agg_filter
_alpha
_anchor
_animated
_aspect
_autoscaleXon
_autoscaleYon
_autotitlepos
_axes
_axes_class
_axes_locator
_axisbelow
_clipon
_clippath
_contains
_convert_dx
_current_image
_default_contains
_facecolor
_frameon
_gci
_gen_axes_patch
_gen_axes_spines
_get_axis_list
_get_axis_map
_get_clipping_extent_bbox
_get_lines
_get_patches_for_fill
_get_view
_gid
_gridOn
_in_layout
_init_axis
_label
_layoutbox
_left_title
_make_twin_axes
_mouseover
_mouseover_set
_navigate
_navigate_mode
_oid
_on_units_changed
_originalPosition
_parse_scatter_color_args
_path_effects
_pcolorargs
_picker
_position
_poslayoutbox
_process_unit_info
_prop_order
_propobservers
_quiver_units
_rasterization_zorder
_rasterized
_remove_legend
_remove_method
_request_autoscale_view
_right_title
_sci
_set_artist_props
_set_gc_clip
_set_lim_and_transforms
_set_position
_set_title_offset_trans
_set_view
_set_view_from_bbox
_shared_x_axes
_shared_y_axes
_sharex
_sharey
_sketch
_snap
_stale
_stale_viewlim_x
_stale_viewlim_y
_sticky_edges
_subplotspec
_tight
_transform
_transformSet
_twinned_axes
_unstale_viewLim
_update_image_limits
_update_line_limits
_update_patch_limits
_update_title_position
_update_transScale
_url
_use_sticky_edges
_validate_converted_limits
_viewLim
_visible
_xaxis_transform
_xcid
_xmargin
_yaxis_transform
_ycid
_ymargin
__class__
__delattr__
__dict__
__dir__
__doc__
__eq__
__format__
__ge__
__getattribute__
__getstate__
__gt__
__hash__
__init__
__init_subclass__
__le__
__lt__
__module__
__ne__
__new__
__reduce__
__reduce_ex__
__repr__
__setattr__
__setstate__
__sizeof__
__str__
__subclasshook__
__weakref__

你可能感兴趣的:(matplotlib)