seaborn
seaborn copied to clipboard
Marker property requires MarkerStyle objects with identity scale
so.Plot(x=[1, 2, 3], y=[1, 2, 3], marker=["o", "s", "x"]).add(so.Dot()).scale(marker=None)
This barfs trying to operate on the marker
values as if they are MarkerStyle
objects:
Traceback
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File ~/miniconda3/envs/seaborn-py39-latest/lib/python3.9/site-packages/IPython/core/formatters.py:343, in BaseFormatter.__call__(self, obj)
341 method = get_real_method(obj, self.print_method)
342 if method is not None:
--> 343 return method()
344 return None
345 else:
File ~/code/seaborn/seaborn/_core/plot.py:265, in Plot._repr_png_(self)
263 def _repr_png_(self) -> tuple[bytes, dict[str, float]]:
--> 265 return self.plot()._repr_png_()
File ~/code/seaborn/seaborn/_core/plot.py:804, in Plot.plot(self, pyplot)
800 """
801 Compile the plot spec and return the Plotter object.
802 """
803 with theme_context(self._theme_with_defaults()):
--> 804 return self._plot(pyplot)
File ~/code/seaborn/seaborn/_core/plot.py:834, in Plot._plot(self, pyplot)
832 # Process the data for each layer and add matplotlib artists
833 for layer in layers:
--> 834 plotter._plot_layer(self, layer)
836 # Add various figure decorations
837 plotter._make_legend(self)
File ~/code/seaborn/seaborn/_core/plot.py:1335, in Plotter._plot_layer(self, p, layer)
1332 grouping_vars = mark._grouping_props + default_grouping_vars
1333 split_generator = self._setup_split_generator(grouping_vars, df, subplots)
-> 1335 mark._plot(split_generator, scales, orient)
1337 # TODO is this the right place for this?
1338 for view in self._subplots:
File ~/code/seaborn/seaborn/_marks/dot.py:71, in DotBase._plot(self, split_gen, scales, orient)
68 for _, data, ax in split_gen():
70 offsets = np.column_stack([data["x"], data["y"]])
---> 71 data = self._resolve_properties(data, scales)
73 points = mpl.collections.PathCollection(
74 offsets=offsets,
75 paths=data["path"],
(...)
83 **self.artist_kws,
84 )
85 ax.add_collection(points)
File ~/code/seaborn/seaborn/_marks/dot.py:134, in Dot._resolve_properties(self, data, scales)
132 def _resolve_properties(self, data, scales):
--> 134 resolved = super()._resolve_properties(data, scales)
135 filled = resolved["fill"]
137 main_stroke = resolved["stroke"]
File ~/code/seaborn/seaborn/_marks/dot.py:50, in DotBase._resolve_properties(self, data, scales)
47 def _resolve_properties(self, data, scales):
49 resolved = resolve_properties(self, data, scales)
---> 50 resolved["path"] = self._resolve_paths(resolved)
51 resolved["size"] = resolved["pointsize"] ** 2
53 if isinstance(data, dict): # Properties for single dot
File ~/code/seaborn/seaborn/_marks/dot.py:43, in DotBase._resolve_paths(self, data)
41 for m in marker:
42 if m not in path_cache:
---> 43 path_cache[m] = get_transformed_path(m)
44 paths.append(path_cache[m])
45 return paths
File ~/code/seaborn/seaborn/_marks/dot.py:36, in DotBase._resolve_paths.<locals>.get_transformed_path(m)
35 def get_transformed_path(m):
---> 36 return m.get_path().transformed(m.get_transform())
AttributeError: 'str' object has no attribute 'get_path'
For some reason to conversion to the common representation is not happening upstream of the identity scaling, as it should be.