How to use python Matplotlib to mark colors in a scatter chart
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.