算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
skill-122【设计与创意】Create high-quality visualizations of data using JAX. Supports various plotting techniques and customization options.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
line_plot(x, y, title='Line Plot', xlabel='X-axis', ylabel='Y-axis')Description: Generate a basic line plot of y against x.
Parameters:
x (array): Data for the x-axis.y (array): Data for the y-axis.title (str, optional): Title of the plot.xlabel (str, optional): Label for the x-axis.ylabel (str, optional): Label for the y-axis.Returns: Visualization displayed using JAX-compatible plotting library.
import jax.numpy as jnp
import jax_data_visualization as jx
import matplotlib.pyplot as plt
x = jnp.array([0, 1, 2, 3, 4])
y = jnp.array([0, 1, 4, 9, 16])
jx.line_plot(x, y, title='Quadratic Growth')
scatter_plot(x, y, title='Scatter Plot')Description: Generate a scatter plot of data points.
Parameters:
x (array): Data for the x-axis.y (array): Data for the y-axis.title (str, optional): Title of the plot.Returns: Visualization displayed using JAX-compatible plotting library.
def scatter_plot(x, y, title='Scatter Plot'):
plt.scatter(x, y)
plt.title(title)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()
scatter_plot(x, y)
histogram_plot(data, bins=10)Description: Generate a histogram of the data.
Parameters:
data (array): Data for histogram.bins (int, optional): Number of bins in the histogram.Returns: Visualization displayed using JAX-compatible plotting library.
def histogram_plot(data, bins=10):
plt.hist(data, bins=bins)
plt.title('Histogram')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.show()
histogram_plot(jnp.array([1, 2, 2, 3, 4, 4, 4, 5]))
custom_plot(x, y, style='default')Description: Generates a customizable plot based on specified style.
Parameters:
x (array): Data for the x-axis.y (array): Data for the y-axis.style (str, optional): Custom style for the plot.Returns: Visualization displayed with custom style.
def custom_plot(x, y, style='default'):
plt.style.use(style)
plt.plot(x, y)
plt.title('Custom Style Plot')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()
custom_plot(x, y, style='ggplot')
save_plot(filename)Description: Save the current plot to a specified file.
Parameters:
filename (str): Filename to save the plot as.Returns: None.
def save_plot(filename):
plt.savefig(filename)
save_plot('my_plot.png')
Notes: