Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use python Matplotlib to mark colors in a scatter chart

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

The knowledge of this article "how to use python Matplotlib to mark color in scatter map" is not understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use python Matplotlib to mark color in scatter chart" article.

Answer:

I find your question a little difficult to understand. I think what you need is the ability to map the input xswap y parameter to the color in the selected color map. See the following example:

Import numpy as npimport matplotlib.pyplotdef number_to_colour (number, total_number): return plt.cm.rainbow (np.linspace [list (number)] x = np.arange (12) y = plt.figure 3.z = plt.figure () ax = fig.add_subplot (111111projection='3d') ax.scatter (x, y, z, c=number_to_colour (x, len (x)) plt.show ()

Plt.cm.rainbow (np.linspace) creates a color array of evenly spaced lengths, spaced between color maps (in this case). Modifying the index of this array (or changing the np.linspace to another feature with the desired scaling) should provide you with the color scaling you need. Total_numberrainbow

The above is about the content of this article on "how to use python Matplotlib to mark colors in scatter maps". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report