Open
Description
It seems that there is not compatible with webcolors?
{
"name": "AttributeError",
"message": "module 'webcolors' has no attribute 'CSS3_HEX_TO_NAMES'",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[32], line 5
3 plt.xlabel(r\"$t/\\mathrm{s}$\")
4 plt.ylabel(r\"$\\theta/\\degree$\")
----> 5 tikzplotlib.save(\"beta0-theta-t\")
File c:\\Users\\sweet\\anaconda3\\envs\\stable\\lib\\site-packages\\tikzplotlib\\_save.py:262, in save(filepath, encoding, *args, **kwargs)
252 def save(filepath: str | Path, *args, encoding: str | None = None, **kwargs):
253 \"\"\"Same as `get_tikz_code()`, but actually saves the code to a file.
254
255 :param filepath: The file to which the TikZ output will be written.
(...)
260 :returns: None
261 \"\"\"
--> 262 code = get_tikz_code(*args, filepath=filepath, **kwargs)
263 with open(filepath, \"w\", encoding=encoding) as f:
264 f.write(code)
File c:\\Users\\sweet\\anaconda3\\envs\\stable\\lib\\site-packages\\tikzplotlib\\_save.py:213, in get_tikz_code(figure, filepath, axis_width, axis_height, textsize, tex_relative_path_to_data, externalize_tables, override_externals, externals_search_path, strict, wrap, add_axis_environment, extra_axis_parameters, extra_groupstyle_parameters, extra_tikzpicture_parameters, extra_lines_start, dpi, show_info, include_disclaimer, standalone, float_format, table_row_sep, flavor)
210 _print_pgfplot_libs_message(data)
212 # gather the file content
--> 213 data, content = _recurse(data, figure)
215 # Check if there is still an open groupplot environment. This occurs if not
216 # all of the group plot slots are used.
217 if \"is_in_groupplot_env\" in data and data[\"is_in_groupplot_env\"]:
File c:\\Users\\sweet\\anaconda3\\envs\\stable\\lib\\site-packages\\tikzplotlib\\_save.py:339, in _recurse(data, obj)
336 continue
338 if isinstance(child, mpl.axes.Axes):
--> 339 ax = _axes.Axes(data, child)
341 if ax.is_colorbar:
342 continue
File c:\\Users\\sweet\\anaconda3\\envs\\stable\\lib\\site-packages\\tikzplotlib\\_axes.py:140, in Axes.__init__(self, data, obj)
136 self.axis_options.append(\"axis y line=right\")
138 self._ticks(data, obj)
--> 140 self._grid(obj, data)
142 # axis line styles
143 # Assume that the bottom edge color is the color of the entire box.
144 axcol = obj.spines[\"bottom\"].get_edgecolor()
File c:\\Users\\sweet\\anaconda3\\envs\\stable\\lib\\site-packages\\tikzplotlib\\_axes.py:336, in Axes._grid(self, obj, data)
334 if xlines:
335 xgridcolor = xlines[0].get_color()
--> 336 data, col, _ = _color.mpl_color2xcolor(data, xgridcolor)
337 if col != \"black\":
338 self.axis_options.append(f\"x grid style={{{col}}}\")
File c:\\Users\\sweet\\anaconda3\\envs\\stable\\lib\\site-packages\\tikzplotlib\\_color.py:76, in mpl_color2xcolor(data, matplotlib_color)
66 # Don't handle gray colors separately. They can be specified in xcolor as
67 #
68 # {gray}{0.6901960784313725}
(...)
72
73 # convert to RGB255
74 rgb255 = np.array(my_col[:3] * 255, dtype=int)
---> 76 name, diff = _get_closest_colour_name(rgb255)
77 if diff > 0:
78 if np.all(my_col[0] == my_col[:3]):
File c:\\Users\\sweet\\anaconda3\\envs\\stable\\lib\\site-packages\\tikzplotlib\\_color.py:32, in _get_closest_colour_name(rgb)
30 match = None
31 mindiff = 1.0e15
---> 32 for h, name in webcolors.CSS3_HEX_TO_NAMES.items():
33 r = int(h[1:3], 16)
34 g = int(h[3:5], 16)
AttributeError: module 'webcolors' has no attribute 'CSS3_HEX_TO_NAMES'"
}
Metadata
Metadata
Assignees
Labels
No labels