Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

475
Views
cómo llenar los valores en numpy para crear un espectro

He hecho el siguiente código pero no entiendo correctamente lo que está pasando allí. ¿Alguien puede explicar cómo rellenar colores en Numpy?

También quiero establecer valores de 1 to 0 para darle al espectro una intensidad. Por ejemplo: 0 significa baja intensidad, 1 significa alta intensidad

 import numpy as np import matplotlib.pyplot as plt a= np.zeros([256*6,256*6, 3], dtype=np.uint8) # init the array # fill the array with rgb values to create the spectrum without the use of loops #red a[:,:,0] = np.concatenate(([255]*256, np.linspace(255,0,256), [0]*256, [0]*256, np.linspace(0,255,256), [255]*256)) #green a[:,:,1] = np.concatenate((np.linspace(0,255,256), [255]*256, [255]*256, np.linspace(255,0,256), [0]*256,[0]*256)) #blue a[:,:,2] = np.concatenate(([0]*256, [0]*256,np.linspace(0,255,256),[255]*256, [255]*256, np.linspace(255,0,256))) plt.imshow(a) # this is different than what I am looking for

Rendimiento esperado-:

Rendimiento esperado

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

res=256 op=np.zeros([res,res, 3]) # init the array #RGB op[:,:,0]= np.linspace(0,1,res) op[:,:,1]=np.linspace(0,1,res).reshape (256, 1) op[:,:,2]= np.linspace(1,0,res) plt.imshow(op)

¡te dará exactamente lo que estás buscando!

avísame si no funciona

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!