text
stringlengths 1
93.6k
|
|---|
list_instructions = self._markers.get(dictkey)
|
# creating a list of instructions for the specific marker.
|
if list_instructions is None:
|
if _mpl_ge_2_0:
|
polygons = marker_path.to_polygons(marker_trans, closed_only=False)
|
else:
|
polygons = marker_path.to_polygons(marker_trans)
|
self._markers[dictkey] = self.get_path_instructions(gc,
|
polygons, rgbFace=rgbFace)
|
# Traversing all the positions where a marker should be rendered
|
for vertices, codes in path.iter_segments(trans, simplify=False):
|
if len(vertices):
|
x, y = vertices[-2:]
|
for widget, instructions in self._markers[dictkey]:
|
widget.canvas.add(PushMatrix())
|
widget.canvas.add(Translate(x, y))
|
widget.canvas.add(instructions)
|
widget.canvas.add(PopMatrix())
|
def flipy(self):
|
return False
|
def _convert_path(self, path, transform=None, clip=None, simplify=None,
|
sketch=None):
|
if clip:
|
clip = (0.0, 0.0, self.width, self.height)
|
else:
|
clip = None
|
if _mpl_ge_1_5:
|
return _path.convert_to_string(
|
path, transform, clip, simplify, sketch, 6,
|
[b'M', b'L', b'Q', b'C', b'z'], False).decode('ascii')
|
else:
|
return _path.convert_to_svg(path, transform, clip, simplify, 6)
|
def get_canvas_width_height(self):
|
'''Get the actual width and height of the widget.
|
'''
|
return self.widget.width, self.widget.height
|
def get_text_width_height_descent(self, s, prop, ismath):
|
'''This method is needed specifically to calculate text positioning
|
in the canvas. Matplotlib needs the size to calculate the points
|
according to their layout
|
'''
|
if ismath:
|
ftimage, depth = self.mathtext_parser.parse(s, self.dpi, prop)
|
w = ftimage.get_width()
|
h = ftimage.get_height()
|
return w, h, depth
|
font = resource_find(prop.get_name() + ".ttf")
|
if font is None:
|
plot_text = CoreLabel(font_size=prop.get_size_in_points())
|
else:
|
plot_text = CoreLabel(font_size=prop.get_size_in_points(),
|
font_name=prop.get_name())
|
plot_text.text = six.text_type("{}".format(s))
|
plot_text.refresh()
|
return plot_text.texture.size[0], plot_text.texture.size[1], 1
|
def new_gc(self):
|
'''Instantiate a GraphicsContextKivy object
|
'''
|
return GraphicsContextKivy(self.widget)
|
def points_to_pixels(self, points):
|
return points / 72.0 * self.dpi
|
def weight_as_number(self, weight):
|
''' Replaces the deprecated matplotlib function of the same name
|
'''
|
# Return if number
|
if isinstance(weight, numbers.Number):
|
return weight
|
# else use the mapping of matplotlib 2.2
|
elif weight == 'ultralight':
|
return 100
|
elif weight == 'light':
|
return 200
|
elif weight == 'normal':
|
return 400
|
elif weight == 'regular':
|
return 400
|
elif weight == 'book':
|
return 500
|
elif weight == 'medium':
|
return 500
|
elif weight == 'roman':
|
return 500
|
elif weight == 'semibold':
|
return 600
|
elif weight == 'demibold':
|
return 600
|
elif weight == 'demi':
|
return 600
|
elif weight == 'bold':
|
return 700
|
elif weight == 'heavy':
|
return 800
|
elif weight == 'extra bold':
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.