如何为特定数值设置特定颜色。

huangapple go评论53阅读模式
英文:

How to set specific colors for specific values

问题

I have a rather large set of data, composed of one array of tuples (coordinates) and one array of values associated with each coordinate. My problem is that those values are not just one integer but sometimes an array of possible values.

For example, I could have an array like this: [6,10,8,[4,5,6],4]. This corresponds to 5 coordinates.

I would like to plot this data using imshow. Basically I want to create my own colormap but I have only 11 different possible values, some of which being an array.

All the resources I've found only treat uniform values. Should I change my approach or is there a way to use this data as is?

I have tried using colors.boundaryNorms, but that obviously doesn't work for the sub-arrays.
As I am quite new to matplotlib I do not have much different ideas to try.

英文:

I have a rather large set of data, composed of one array of tuples (coordinates) and one array of values associated with each coordinate. My problem is that those values are not just one integer but sometimes an array of possible values.

For example, I could have an array like this: [6,10,8,[4,5,6],4]. This corresponds to 5 coordinates.

I would like to plot this data using imshow. Basically I want to create my own colormap but I have only 11 different possible values, some of which being an array.

All the resources I've found only treat uniform values. Should I change my approach or is there a way to use this data as is?

I have tried using colors.boundaryNorms, but that obviously doesn't work for the sub-arrays.
As I am quite new to matplotlib I do not have much different ideas to try.

答案1

得分: 0

After some reflection and considering I work with geospatial data, I switched to rasterio and QGIS to visualize my results.
Closing the question.

英文:

After some reflection and considering I work with geospatial data, I switched to rasterio and Qgis to visualize my results.
Closing the question.

huangapple
  • 本文由 发表于 2023年6月12日 20:46:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76456815.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定