WCSAxes#
- class astropy.visualization.wcsaxes.WCSAxes(fig, *args, wcs=None, transform=None, coord_meta=None, transData=None, slices=None, frame_class=None, **kwargs)[源代码]#
基类:
Axes
可用于显示WCS世界坐标的main Axis类。
- 参数:
- fig :
Figure
图形 要添加轴的地物
- *args
*args
可以是单一的(left, bottom, width, height)
矩形或单个matplotlib.transforms.Bbox
。这指定了轴所在的矩形(在地物坐标中)。*args
也可以由三个数字或一个三位数组成;在后一种情况下,这些数字被视为独立的数字。这些数字被解释为(nrows, ncols, index)
:(nrows, ncols)
指定子图数组的大小,以及index
正在创建的子图的从1开始的索引。最后,*args
也可以直接作为matplotlib.gridspec.SubplotSpec
举个例子。- wcs :
WCS
可选WCS,可选 数据的WCS。如果有规定,
transform
无法指定。- 转型 :
Transform
可选变换,可选 数据的转换。如果有规定,
wcs
无法指定。- coord_meta :
dict
,可选Python:Dict,可选 提供附加元数据的字典
transform
已指定。这应该包括钥匙type
,wrap
和unit
. 其中每一个都应该是一个列表,其中包含与WCS维度相同的项。这个type
条目应该是longitude
,latitude
或scalar
, thewrap
对于经度,条目应该给出坐标换行的角度(和None
否则),以及unit
应给出Unit
实例。这还可以选择包括format_unit
输入用于刻度标签的单位(如果未指定,则默认为unit
)- 转载数据 :
Transform
可选变换,可选 可用于覆盖默认数据->像素映射。
- slices :
tuple
,可选Python:元组,可选 对于具有两个以上维度的WCS转换,我们需要选择在2D图像中显示哪些维度。切片应该包含一个
x
入口,一y
条目,其余的值应该是整数,指示通过数据的切片。切片中项目的顺序应与中维度的顺序相同WCS
,与Numpy中维度的顺序相反。例如,(50, 'x', 'y')
意味着第一个WCS维度(最后一个Numpy维度)将在索引为50的位置切片,第二个WCS和Numpy维度将显示在x轴上,最终的WCS维度(第一个Numpy维度)将显示在y轴上(因此数据将使用data[:, :, 50].transpose()
)- frame_class可选类型
框架的类,它应该是
BaseFrame
. 默认值是使用RectangularFrame
- fig :
- 属性:
- coords :
CoordinatesMap
CoordinatesMap
坐标信息的容器。
- coords :
方法总结
contour
(*args, **kwargs)绘制等高线。
contourf
(*args, **kwargs)绘制填充轮廓。
draw
\(渲染器)画轴。
draw_wcsaxes
\(渲染器)get_coords_overlay
(frame[, coord_meta])获取给定帧上的坐标覆盖。
get_tightbbox
(renderer, *args, **kwargs)返回轴的紧定边界框,包括轴及其修饰符(xLabel、标题等)。
get_transform
\(框架)返回从指定帧到显示坐标的变换。
get_xlabel
\()获取XLabel文本字符串。
get_ylabel
\()获取依拉贝尔文本字符串。
grid
([b, axis, which])为两个坐标绘制网格线。
imshow
(X, *args, **kwargs)Matplotlib的包装
imshow()
.plot_coord
(*args, **kwargs)情节
SkyCoord
或BaseCoordinateFrame
对象放在轴上。reset_wcs
([wcs, slices, transform, coord_meta])重置当前轴,以使用新的WCS对象。
scatter_coord
(*args, **kwargs)散布
SkyCoord
或BaseCoordinateFrame
将对象放置到轴上。set
(*[, adjustable, agg_filter, alpha, ...])一次设置多个属性。
set_xlabel
([xlabel, labelpad, loc])设置x-label。
set_ylabel
([ylabel, labelpad, loc])设置y标签。
text_coord
(*args, **kwargs)使用打印文本字符串
SkyCoord
或BaseCoordinateFrame
将对象放置到轴上。tick_params
([axis])方法设置tick和tick label参数的方法与
tick_params()
Matplotlib中的方法。方法文件
- contour(*args, **kwargs)[源代码]#
绘制等高线。
这是的自定义实现
contour()
它将变换(如果指定)一次性应用于所有轮廓,而不是单独应用于每个轮廓线。所有位置参数和关键字参数都与for相同contour()
.
- contourf(*args, **kwargs)[源代码]#
绘制填充轮廓。
这是的自定义实现
contourf()
它将变换(如果指定)一次性应用于所有轮廓,而不是单独应用于每个轮廓线。所有位置参数和关键字参数都与for相同contourf()
.
- get_coords_overlay(frame, coord_meta=None)[源代码]#
获取给定帧上的坐标覆盖。
- 参数:
- frame :
str
,BaseCoordinateFrame
PYTHON:字符串,基本坐标框架 要为其获取覆盖的帧。如果字符串必须对应于星形帧变换图中注册的一个坐标帧。
- coord_meta :
dict
Python :词典 坐标覆盖的元数据。
- frame :
- 返回:
- overlay :
CoordinatesMap
CoordinatesMap
坐标重叠。
- overlay :
- get_tightbbox(renderer, *args, **kwargs)[源代码]#
返回轴的紧定边界框,包括轴及其修饰符(xLabel、标题等)。
艺术家们
artist.set_in_layout(False)
不包括在bbox中。- 参数:
- 渲染器 :
RendererBase
子类RenderBase子类 将用于绘制图形的渲染器(即
fig.canvas.get_renderer()
)- bbox_extra_artists :
list
的Artist
或None
Python :艺人名单或无 要包含在紧定边界框中的艺术家列表。如果
None
(默认),则轴的所有艺术家子项都包括在紧边界框中。- call_axes_locator : bool ,默认:
True
布尔,默认:PYTHON:TRUE 如果 call_axes_locator 是
False
,它不会调用_axes_locator
属性,该属性对于获取正确的边框是必需的。call_axes_locator=False
如果调用者只对收紧框相对于轴BBox的相对大小感兴趣,则可以使用。- for_layout_only : default:
False
默认值: 边界框将 not 包括标题的x范围和xlabel,或ylabel的y范围。
- 渲染器 :
- 返回:
BboxBase
图形像素坐标中的边界框。
- get_transform(frame)[源代码]#
返回从指定帧到显示坐标的变换。
这不包括transData转换
- 参数:
- frame :
WCS
或Transform
或str
WCS或变换或Python:字符串 - 这个
frame
参数可以有几种可能的类型:
- 这个
- frame :
- grid(b=None, axis='both', *, which='major', **kwargs)[源代码]#
为两个坐标绘制网格线。
标准matplotlib外观选项(color、alpha等)可以作为关键字参数传递。这表现得像
matplotlib.axes.Axes
但如果没有指定参数,则显示网格而不是切换网格。
- imshow(X, *args, **kwargs)[源代码]#
Matplotlib的包装
imshow()
.如果一个RGB图像作为PIL对象传递,它将被垂直翻转并
origin
将被设置为lower
,因为WCS变换-类似于FITS文件-假设原点是图像左下角的像素(而RGB图像的原点在左上角)。所有参数都传递给
imshow()
.
- plot_coord(*args, **kwargs)[源代码]#
情节
SkyCoord
或BaseCoordinateFrame
对象放在轴上。第一个论点
plot_coord()
应为一个坐标,然后将其转换为前两个参数matplotlib.axes.Axes.plot
. 所有其他参数都与matplotlib.axes.Axes.plot
. 如果未指定transform
关键字参数将基于坐标创建。- 参数:
- 坐标 :
SkyCoord
或BaseCoordinateFrame
SkyCoord或BaseCoordinateFrame 要在轴上打印的坐标对象。这将转换为前两个参数
matplotlib.axes.Axes.plot
.
- 坐标 :
参见
matplotlib.axes.Axes.plot
此方法通过传递给它的所有参数从该函数调用。
- scatter_coord(*args, **kwargs)[源代码]#
散布
SkyCoord
或BaseCoordinateFrame
将对象放置到轴上。的第一个参数
scatter_coord()
应为坐标,然后将其转换为前两个参数,以matplotlib.axes.Axes.scatter
。所有其他参数都与matplotlib.axes.Axes.scatter
。如果未指定,则为transform
将根据坐标创建关键字参数。- 参数:
- 坐标 :
SkyCoord
或BaseCoordinateFrame
SkyCoord或BaseCoordinateFrame 要在轴上散布的坐标对象。它被转换为前两个参数,以
matplotlib.axes.Axes.scatter
。
- 坐标 :
参见
matplotlib.axes.Axes.scatter
此方法通过传递给它的所有参数从该函数调用。
- set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, subplotspec=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>)#
一次设置多个属性。
支持的属性包括
- 性能:
adjustable: {'box', 'datalim'} agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None anchor: (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...} animated: bool aspect: {'auto', 'equal'} or float autoscale_on: bool autoscalex_on: unknown autoscaley_on: unknown axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or 'line' box_aspect: float or None clip_box:
BboxBase
or None clip_on: bool clip_path: Patch or (Path, Transform) or None facecolor or fc: color figure:Figure
frame_on: bool gid: str in_layout: bool label: object mouseover: bool navigate: bool navigate_mode: unknown path_effects: list ofAbstractPathEffect
picker: None or bool or float or callable position: [left, bottom, width, height] orBbox
prop_cycle:Cycler
rasterization_zorder: float or None rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None subplotspec: unknown title: str transform:Transform
url: str visible: bool xbound: (lower: float, upper: float) xlabel: unknown xlim: (left: float, right: float) xmargin: float greater than -0.5 xscale: unknown xticklabels: unknown xticks: unknown ybound: (lower: float, upper: float) ylabel: unknown ylim: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: unknown yticklabels: unknown yticks: unknown zorder: float
- text_coord(*args, **kwargs)[源代码]#
使用打印文本字符串
SkyCoord
或BaseCoordinateFrame
将对象放置到轴上。的第一个参数
text_coord()
应为坐标,然后将其转换为前两个参数,以matplotlib.axes.Axes.text
。所有其他参数都与matplotlib.axes.Axes.text
。如果未指定,则为transform
将根据坐标创建关键字参数。- 参数:
- 坐标 :
SkyCoord
或BaseCoordinateFrame
SkyCoord或BaseCoordinateFrame 要在轴上打印的坐标对象。它被转换为前两个参数,以
matplotlib.axes.Axes.text
。
- 坐标 :
参见
matplotlib.axes.Axes.text
此方法通过传递给它的所有参数从该函数调用。
- tick_params(axis='both', **kwargs)[源代码]#
方法设置tick和tick label参数的方法与
tick_params()
Matplotlib中的方法。这是为了方便起见而提供的,但建议使用API
set_ticks()
,set_ticklabel()
,set_ticks_position()
,set_ticklabel_position()
和grid()
.- 参数:
- axis :
int
或str
,可选PYTHON:INT或PYTHON:STR,可选 将参数应用于哪个轴。默认为“both”,但也可以设置为
int
或str
引用要将其应用到的轴,后跟可以索引的有效值ax.coords
. 注意'x'
和'y
'也可用于矩形轴。- which{'both','major','minor'},可选
将设置应用到的刻度。默认情况下,设置同时应用于主刻度和次刻度。注意如果
'minor'
则当前只能设置刻度的长度。- direction{'in','out'},可选
将记号放在轴内或轴外。
- length :
float
,可选Python:Float,可选 以点为单位的刻度长度。
- width :
float
,可选Python:Float,可选 以点为单位的刻度宽度。
- color : color ,可选颜色,可选
记号颜色(接受任何有效的Matplotlib颜色)
- pad :
float
,可选Python:Float,可选 刻度线和标签之间的点距离。
- labelsize :
float
或str
,可选PYTHON:FLOAT或PYTHON:STR,可选 以点或字符串(例如“大”)标记标签字体大小。
- labelcolor : color ,可选颜色,可选
接受任何颜色库颜色标签
- colors : color ,可选颜色,可选
- 将记号颜色和标签颜色更改为相同的值
(接受任何有效的Matplotlib颜色)。
- bottom, top, left, right : bool ,可选可选的布尔
在哪里画记号。请注意,只有在通过
axis
参数,如果框架不是矩形,则它将无法正常工作。- labelbottom, labeltop, labelleft, labelright : bool ,可选可选的布尔
在哪里绘制记号标签。请注意,只有在通过
axis
参数,如果框架不是矩形,则它将无法正常工作。- grid_color : color ,可选颜色,可选
网格线的颜色(接受任何有效的Matplotlib颜色)。
- grid_alpha :
float
,可选Python:Float,可选 网格线的透明度:0(透明)到1(不透明)。
- grid_linewidth :
float
,可选Python:Float,可选 网格线的宽度(以点为单位)。
- grid_linestyle :
str
,可选Python:字符串,可选 网格线的样式(接受任何有效的Matplotlib线样式)。
- axis :