当前位置: 首页>>代码示例>>Python>>正文


Python Axes.gca方法代码示例

本文整理汇总了Python中axes.Axes.gca方法的典型用法代码示例。如果您正苦于以下问题:Python Axes.gca方法的具体用法?Python Axes.gca怎么用?Python Axes.gca使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在axes.Axes的用法示例。


在下文中一共展示了Axes.gca方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, *args, **kwargs):
		if len(args) == 1:
			self.xvalues, self.yvalues = meshgrid(
				arange(args[0].shape[0]),
				arange(args[0].shape[1]))
			self.zvalues = args[0]
		else:
			self.xvalues, self.yvalues, self.zvalues = args

		# shading
		self.shading = kwargs.get('shading', None)

		# custom plot options
		self.pgf_options = kwargs.get('pgf_options', [])

		# catch common mistakes
		if not isinstance(self.pgf_options, list):
			raise TypeError('pgf_options should be a list.')

		# add plot to axis
		self.axes = kwargs.get('axes', Axes.gca())
		self.axes.children.append(self)

		# adjust default behavior for 3D plots
		self.axes.axis_on_top = False
		self.axes.xlabel_near_ticks = False
		self.axes.ylabel_near_ticks = False
		self.axes.zlabel_near_ticks = False
开发者ID:BenJamesbabala,项目名称:ride,代码行数:30,代码来源:surfplot.py

示例2: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, *args, **kwargs):
		"""
		Initializes plot properties.
		"""

		# data points
		if len(args) < 1:
			self.xvalues = asarray([])
			self.yvalues = asarray([])
		elif len(args) < 2:
			self.yvalues = asarray(args[0]).flatten()
			self.xvalues = arange(1, len(self.yvalues) + 1)
		else:
			self.xvalues = asarray(args[0]).flatten()
			self.yvalues = asarray(args[1]).flatten()

		# line style
		self.line_style = kwargs.get('line_style', None)
		self.line_width = kwargs.get('line_width', None)
		self.opacity = kwargs.get('opacity', None)
		self.color = kwargs.get('color', None)

		self.fill = kwargs.get('fill', False)

		# marker style
		self.marker = kwargs.get('marker', None)
		self.marker_size = kwargs.get('marker_size', None)
		self.marker_edge_color = kwargs.get('marker_edge_color', None)
		self.marker_face_color = kwargs.get('marker_face_color', None)
		self.marker_opacity = kwargs.get('marker_opacity', None)

		# error bars
		self.xvalues_error = asarray(kwargs.get('xvalues_error', [])).flatten()
		self.yvalues_error = asarray(kwargs.get('yvalues_error', [])).flatten()
		self.error_marker = kwargs.get('error_marker', None)
		self.error_color = kwargs.get('error_color', None)
		self.error_style = kwargs.get('error_style', None)
		self.error_width = kwargs.get('error_width', None)

		# comb (or stem) plots
		self.ycomb = kwargs.get('ycomb', False)
		self.xcomb = kwargs.get('xcomb', False)

		self.closed = kwargs.get('closed', False)

		self.const_plot = kwargs.get('const_plot', False)

		# legend entry for this plot
		self.legend_entry = kwargs.get('legend_entry', None)

		# custom plot options
		self.pgf_options = kwargs.get('pgf_options', [])

		# catch common mistakes
		if not isinstance(self.pgf_options, list):
			raise TypeError('pgf_options should be a list.')

		# add plot to axes
		self.axes = kwargs.get('axis', Axes.gca())
		self.axes.children.append(self)
开发者ID:cshen,项目名称:pypgf,代码行数:62,代码来源:plot.py

示例3: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, *args, **kwargs):
		# legend entries
		self.legend_entries = args

		# legend properties
		self.at = kwargs.get('at', None)
		self.anchor = kwargs.get('anchor', None)
		self.location = kwargs.get('location', None)
		self.align = kwargs.get('align', 'left')
		self.box = kwargs.get('box', True)
		self.font_size = kwargs.get('font_size', None)

		# assign legend to axis
		self.axes = kwargs.get('axes', Axes.gca())
		self.axes.legend = self
开发者ID:BenJamesbabala,项目名称:ride,代码行数:17,代码来源:legend.py

示例4: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, image, **kwargs):
		"""
		@type  image: string/array_like/PIL Image
		@param image: a filepath or an image in grayscale or RGB

		@param vmin:

		@param vmax:

		@param cmap:
		"""

		self.cmap = kwargs.get('cmap', 'gray')

		if isinstance(image, str):
			self.image = PILImage.open(image)

		elif isinstance(image, PILImage.Image):
			self.image = image.copy()

		else:
			if isinstance(image, ndarray):
				# copy array
				image = array(image)

				if image.dtype.kind != 'i':
					vmin = kwargs.get('vmin', min(image))
					vmax = kwargs.get('vmax', max(image))

					# rescale image
					image = (image - vmin) / (vmax - vmin)
					image = array(image * 256., dtype='int32')

				image[image < 0] = 0
				image[image > 255] = 255
				image = array(image, dtype='uint8')

				if image.ndim < 3:
					image = repeat(image.reshape(image.shape[0], -1, 1), 3, 2)

			self.image = PILImage.fromarray(image)

		# add image to axis
		self.axes = kwargs.get('axis', Axes.gca())
		self.axes.children.append(self)

		self.idx = Image._counter
		Image._counter += 1
开发者ID:cshen,项目名称:pypgf,代码行数:50,代码来源:image.py

示例5: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, x, y, r, **kwargs):
		self.x = x
		self.y = y
		self.r = r

		# properties
		self.color = kwargs.get('color', None)
		self.line_style = kwargs.get('line_style', None)
		self.line_width = kwargs.get('line_width', None)

		# custom plot options
		self.pgf_options = kwargs.get('pgf_options', [])

		# catch common mistakes
		if not isinstance(self.pgf_options, list):
			raise TypeError('pgf_options should be a list.')

		# add rectangle to axes
		self.axes = kwargs.get('axes', Axes.gca())
		self.axes.children.append(self)
开发者ID:BenJamesbabala,项目名称:ride,代码行数:22,代码来源:circle.py

示例6: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, x, y, dx, dy, **kwargs):
		self.x = x
		self.y = y
		self.dx = dx
		self.dy = dy

		# properties
		self.color = kwargs.get('color', None)
		self.arrow_style = kwargs.get('arrow_style', '-latex')
		self.line_style = kwargs.get('line_style', None)

		# custom plot options
		self.pgf_options = kwargs.get('pgf_options', [])

		# catch common mistakes
		if not isinstance(self.pgf_options, list):
			raise TypeError('pgf_options should be a list.')

		# add arrow to axes
		self.axes = kwargs.get('axis', Axes.gca())
		self.axes.children.append(self)
开发者ID:cshen,项目名称:pypgf,代码行数:23,代码来源:arrow.py

示例7: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, *args, **kwargs):
		# data points
		if len(args) < 1:
			self.xvalues = asarray([])
			self.yvalues = asarray([])
		elif len(args) < 2:
			self.yvalues = asarray(args[0]).reshape(shape(args[0])[0], -1)
			self.xvalues = arange(1, self.yvalues.shape[-1] + 1)
		else:
			self.xvalues = asarray(args[0]).flatten()
			self.yvalues = asarray(args[1]).reshape(shape(args[1])[0], -1)

		self.box_width = kwargs.get('box_width', 0.5);

		# custom plot options
		self.pgf_options = kwargs.get('pgf_options', [])

		# catch common mistakes
		if not isinstance(self.pgf_options, list):
			raise TypeError('pgf_options should be a list.')

		# add plot to axes
		self.axes = kwargs.get('axis', Axes.gca())
		self.axes.children.append(self)
开发者ID:cshen,项目名称:pypgf,代码行数:26,代码来源:boxplot.py

示例8: gca

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
def gca():
	"""
	Returns currently active axis.
	"""

	return Axes.gca()
开发者ID:BenJamesbabala,项目名称:ride,代码行数:8,代码来源:functions.py

示例9: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, image, **kwargs):
		"""
		@type  image: string/array_like/PIL Image
		@param image: a filepath or an image in grayscale or RGB

		@param vmin:

		@param vmax:

		@param cmap:

		@param xmin:
		@param xmax:
		@param ymin:
		@param ymax:

		@param limits:
		"""

		self._cmap = kwargs.get('cmap', 'gray')

		if isinstance(image, str):
			self.image = PILImage.open(image)

		elif isinstance(image, PILImage.Image):
			self.image = image.copy()

		else:
			if isinstance(image, ndarray):
				# copy array
				image = array(image)

				if image.dtype.kind not in ['u', 'i']:
					self.vmin = kwargs.get('vmin', min(image))
					self.vmax = kwargs.get('vmax', max(image))

					# rescale image
					image = (image - self.vmin) / (self.vmax - self.vmin)
					image = array(image * 256., dtype='int32')

				image[image < 0] = 0
				image[image > 255] = 255
				image = array(image, dtype='uint8')

				if image.ndim < 3:
					image = repeat(image.reshape(image.shape[0], -1, 1), 3, 2)
					for i in range(image.shape[0]):
						for j in range(image.shape[1]):
							image[i, j, :] = colormaps[self._cmap][image[i, j, 0]]

			self.image = PILImage.fromarray(image)

		# specify pixel coordinates 
		self.xmin = kwargs.get('xmin', 0)
		self.xmax = kwargs.get('xmax', self.image.size[0])
		self.ymin = kwargs.get('ymin', 0)
		self.ymax = kwargs.get('ymax', self.image.size[1])

		if 'limits' in kwargs:
			self.xmin, self.xmax, \
			self.ymin, self.ymax = kwargs['limits']

		# add image to axis
		self.axes = kwargs.get('axes', Axes.gca())
		self.axes.children.append(self)

		self.idx = Image._counter
		Image._counter += 1
开发者ID:BenJamesbabala,项目名称:ride,代码行数:70,代码来源:image.py

示例10: __init__

# 需要导入模块: from axes import Axes [as 别名]
# 或者: from axes.Axes import gca [as 别名]
	def __init__(self, *args, **kwargs):
		"""
		Initializes plot properties.
		"""

		# data points
		if len(args) < 1:
			self.xvalues = asarray([])
			self.yvalues = asarray([])
		elif len(args) < 2:
			self.yvalues = asarray(args[0]).flatten()
			self.xvalues = arange(1, len(self.yvalues) + 1)
		else:
			self.xvalues = asarray(args[0]).flatten()
			self.yvalues = asarray(args[1]).flatten()

		# labels for each data point
		self.labels = kwargs.get('labels', None)

		if isinstance(self.labels, str):
			self.labels = [self.labels]

		if self.labels and len(self.labels) != len(self.xvalues):
			raise ValueError('The number of labels should correspond to the number of data points.')

		# line style
		self.line_style = kwargs.get('line_style', None)
		self.line_width = kwargs.get('line_width', None)
		self.opacity = kwargs.get('opacity', None)
		self.color = kwargs.get('color', None)

		self.fill = kwargs.get('fill', False)

		# marker style
		self.marker = kwargs.get('marker', None)
		self.marker_size = kwargs.get('marker_size', None)
		self.marker_edge_color = kwargs.get('marker_edge_color', None)
		self.marker_face_color = kwargs.get('marker_face_color', None)
		self.marker_opacity = kwargs.get('marker_opacity', None)

		# error bars
		self.xvalues_error = asarray(kwargs.get('xvalues_error', [])).flatten()
		self.yvalues_error = asarray(kwargs.get('yvalues_error', [])).flatten()
		self.error_marker = kwargs.get('error_marker', None)
		self.error_color = kwargs.get('error_color', None)
		self.error_style = kwargs.get('error_style', None)
		self.error_width = kwargs.get('error_width', None)

		# PGF pattern to fill area and bar plots
		self.pattern = kwargs.get('pattern', None)

		# comb (or stem) plots
		self.ycomb = kwargs.get('ycomb', False)
		self.xcomb = kwargs.get('xcomb', False)

		self.closed = kwargs.get('closed', False)

		self.const_plot = kwargs.get('const_plot', False)

		# legend entry for this plot
		self.legend_entry = kwargs.get('legend_entry', None)

		# custom plot options
		self.pgf_options = kwargs.get('pgf_options', [])

		# catch common mistakes
		if not isinstance(self.pgf_options, list):
			raise TypeError('pgf_options should be a list.')

		# comment LaTeX code
		self.comment = kwargs.get('comment', '')

		# add plot to axes
		self.axes = kwargs.get('axes', Axes.gca())
		self.axes.children.append(self)
开发者ID:BenJamesbabala,项目名称:ride,代码行数:77,代码来源:plot.py


注:本文中的axes.Axes.gca方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。