.. autofunction:: k3d.factory.texture
:download:`arcade_carpet_512.png <./assets/factory/arcade_carpet_512.png>`
# Texture from https://opengameart.org/content/arcade-carpet-textures-arcadecarpet512png
import k3d
with open('arcade_carpet_512.png', 'rb') as texture:
data = texture.read()
plt_texture = k3d.texture(data,
file_format='png')
plot = k3d.plot()
plot += plt_texture
plot.display()
.. k3d_plot :: :filename: plots/factory/texture_basic_plot.py
Attention!
color_map must be used along with attribute and color_range in order to work correctly.
import k3d
import numpy as np
from k3d.colormaps import matplotlib_color_maps
t = np.linspace(0, 1, 100)
plt_texture = k3d.texture(color_map=matplotlib_color_maps.Jet,
attribute=t,
color_range=[0.15, 0.85])
plot = k3d.plot()
plot += plt_texture
plot.display()
.. k3d_plot :: :filename: plots/factory/texture_colormap_plot.py