text stringlengths 0 828 |
|---|
tname = self.any_decoder.get_tname( |
next(self.plotter.iter_base_variables), data.coords) |
if tname is not None and tname in data.coords: |
time = data.coords[tname] |
if not time.values.ndim: |
try: # assume a valid datetime.datetime instance |
s = pd.to_datetime(str(time.values[()])).strftime(s) |
except ValueError: |
pass |
if six.PY2: |
return s.decode('utf-8') |
return s" |
1565,"def get_fig_data_attrs(self, delimiter=None): |
""""""Join the data attributes with other plotters in the project |
This method joins the attributes of the |
:class:`~psyplot.InteractiveBase` instances in the project that |
draw on the same figure as this instance does. |
Parameters |
---------- |
delimiter: str |
Specifies the delimiter with what the attributes are joined. If |
None, the :attr:`delimiter` attribute of this instance or (if the |
latter is also None), the rcParams['texts.delimiter'] item is used. |
Returns |
------- |
dict |
A dictionary with all the meta attributes joined by the specified |
`delimiter`"""""" |
if self.project is not None: |
delimiter = next(filter(lambda d: d is not None, [ |
delimiter, self.delimiter, self.rc['delimiter']])) |
figs = self.project.figs |
fig = self.ax.get_figure() |
if self.plotter._initialized and fig in figs: |
ret = figs[fig].joined_attrs(delimiter=delimiter, |
plot_data=True) |
else: |
ret = self.get_enhanced_attrs(self.plotter.plot_data) |
self.logger.debug( |
'Can not get the figure attributes because plot has not ' |
'yet been initialized!') |
return ret |
else: |
return self.get_enhanced_attrs(self.plotter.plot_data)" |
1566,"def get_fmt_widget(self, parent, project): |
""""""Create a combobox with the attributes"""""" |
from psy_simple.widgets.texts import LabelWidget |
return LabelWidget(parent, self, project)" |
1567,"def clear_other_texts(self, remove=False): |
""""""Make sure that no other text is a the same position as this one |
This method clears all text instances in the figure that are at the |
same position as the :attr:`_text` attribute |
Parameters |
---------- |
remove: bool |
If True, the Text instances are permanently deleted from the |
figure, otherwise there text is simply set to ''"""""" |
fig = self.ax.get_figure() |
# don't do anything if our figtitle is the only Text instance |
if len(fig.texts) == 1: |
return |
for i, text in enumerate(fig.texts): |
if text == self._text: |
continue |
if text.get_position() == self._text.get_position(): |
if not remove: |
text.set_text('') |
else: |
del fig[i]" |
1568,"def transform(self): |
""""""Dictionary containing the relevant transformations"""""" |
ax = self.ax |
return {'axes': ax.transAxes, |
'fig': ax.get_figure().transFigure, |
'data': ax.transData}" |
1569,"def _remove_texttuple(self, pos): |
""""""Remove a texttuple from the value in the plotter |
Parameters |
---------- |
pos: tuple (x, y, cs) |
x and y are the x- and y-positions and cs the coordinate system"""""" |
for i, (old_x, old_y, s, old_cs, d) in enumerate(self.value): |
if (old_x, old_y, old_cs) == pos: |
self.value.pop(i) |
return |
raise ValueError(""{0} not found!"".format(pos))" |
1570,"def _update_texttuple(self, x, y, s, cs, d): |
""""""Update the text tuple at `x` and `y` with the given `s` and `d`"""""" |
pos = (x, y, cs) |
for i, (old_x, old_y, old_s, old_cs, old_d) in enumerate(self.value): |
if (old_x, old_y, old_cs) == pos: |
self.value[i] = (old_x, old_y, s, old_cs, d) |
return |
raise ValueError(""No text tuple found at {0}!"".format(pos))" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.