{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import k3d\n", "import numpy as np\n", "\n", "position1 = [0.5, 1.0, 0.0]\n", "position2 = [-0.5, -1.0, 0.0]\n", "\n", "plot = k3d.plot()\n", "plot += k3d.texture_text('K3D Jupyter', position1, color=0xff0000, font_face='Arial', font_weight=300, size=2.0)\n", "plot += k3d.texture_text('K3D Jupyter', position2, color=0xff0000, font_face='Arial', font_weight=700, size=1.0)\n", "plot.display()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Multipile texts in single object\n", "\n", "N = 20\n", "positions = np.random.randn(N,3).astype(np.float32)\n", "\n", "plot2 = k3d.plot()\n", "obj = k3d.texture_text([\"lorem ipsum\"] * N, positions, is_html=True)\n", "plot2 += obj\n", "plot2.display()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "obj.text = list(map(lambda a: str(a), list(range(N))))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "obj.position = np.random.randn(N,3).astype(np.float32)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 4 }