question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Points with multicolor text

See original GitHub issue

🐛 Bug

I cannot add points with multicolored texts.

To Reproduce

For me the example code provided in napari fails with the same error as in the code I was working on.

Error traceback:

File "~\add_points_with_multicolor_text.py", line 27, in <module>
    points_layer = viewer.add_points(
  File "~\napari\lib\site-packages\napari\components\viewer_model.py", line 4, in add_points
    import itertools
  File "~\napari\lib\site-packages\napari\layers\points\points.py", line 378, in __init__
    self._text = TextManager._from_layer(
  File "~\napari\lib\site-packages\napari\layers\utils\text_manager.py", line 292, in _from_layer
    return cls(**kwargs)
  File "~\napari\lib\site-packages\napari\layers\utils\text_manager.py", line 110, in __init__
    super().__init__(**kwargs)
  File "~\napari\lib\site-packages\napari\utils\events\evented_model.py", line 197, in __init__
    super().__init__(**kwargs)
  File "pydantic\main.py", line 339, in pydantic.main.BaseModel.__init__
  File "pydantic\main.py", line 1038, in pydantic.main.validate_model
  File "pydantic\fields.py", line 840, in pydantic.fields.ModelField.validate
  File "pydantic\fields.py", line 1121, in pydantic.fields.ModelField._apply_validators
  File "pydantic\class_validators.py", line 280, in pydantic.class_validators._generic_validator_cls.lambda3
  File "~\napari\lib\site-packages\napari\layers\utils\text_manager.py", line 337, in _check_color
    return transform_color(color)[0]
  File "~\napari\lib\site-packages\napari\utils\colormaps\standardize_color.py", line 65, in transform_color
    return _color_switch[colortype](colors)
KeyError: <class 'dict'>

Environment

 napari: 0.4.16
Platform: Windows-10-10.0.19043-SP0
Python: 3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 06:57:50) [MSC v.1929 64 bit (AMD64)]
Qt: 5.15.2
PyQt5: 5.15.7
NumPy: 1.22.4
SciPy: 1.8.1
Dask: 2022.7.0
VisPy: 0.10.0

OpenGL:
- GL version: 4.4.0 - Build 20.19.15.4531
- MAX_TEXTURE_SIZE: 16384

Additional information

Could be related to #4464 Thank you for your help in advance.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tothmarcellacommented, Aug 12, 2022

Hi @andy-sweet thank you very much for your help so far. Now I am using the text multicoloring but I was unable to color the text of different clusters of points in the correct order. I created a discussion on image.sc https://forum.image.sc/t/adding-multi-colored-text-to-clusters-of-points/70451/1 I just wanted to make sure it reaches you since this issue has already been closed.

0reactions
imagesc-botcommented, Aug 8, 2022

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/adding-multi-colored-text-to-clusters-of-points/70451/1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding multi-colored text to clusters of points - Image.sc Forum
I want to add the color text to label clusters of data points, with the color of the points in a cluster matching...
Read more >
CSS: colored bullets and list numbers - W3C
Ever wanted to make a list with the bullets a different color than the text, like in this example? First item; First item....
Read more >
How to use different color for bullet symbol and text ... - YouTube
Change the color of the bullet symbol ONLY while keeping the text color the same using Elementor (FREE and Pro version - find...
Read more >
Change the color, size, or format of bullets or numbers in a list
Bullet and number fonts, colors, and size are all controlled by the Font attributes. You can change the text formatting of bullets or...
Read more >
How to apply different colors for point and text but in the same ...
I am trying to draw a plot in which the colors of the points are red, green, blue for 3 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found