Update anndata skill documentation to version 1.1, enhancing compatibility notes and installation instructions. Introduce experimental APIs for lazy loading and concatenation, and clarify usage of deprecated methods. Update best practices for I/O operations and metadata handling.

This commit is contained in:
Timothy Kassis committed 2026-06-07 14:59:51 -07:00
1 parent b2a969eb56
commit b24a631e44
47 files changed
+798 -478

No files matched your search

+25 -20
View File
@@ -13,6 +13,7 @@ Plot types:
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import argparse
@@ -63,6 +64,7 @@ def generate_sample_data():
def create_line_plot(data, ax=None):
"""Create line plot with best practices."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 6), constrained_layout=True)
@@ -80,13 +82,14 @@ def create_line_plot(data, ax=None):
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
if ax is None:
if created_fig:
return fig
return ax
def create_scatter_plot(data, ax=None):
"""Create scatter plot with color and size variations."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 6), constrained_layout=True)
@@ -107,13 +110,14 @@ def create_scatter_plot(data, ax=None):
cbar = plt.colorbar(scatter, ax=ax)
cbar.set_label('Distance from origin')
if ax is None:
if created_fig:
return fig
return ax
def create_bar_chart(data, ax=None):
"""Create bar chart with error bars and styling."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 6), constrained_layout=True)
@@ -125,28 +129,28 @@ def create_bar_chart(data, ax=None):
capsize=5, alpha=0.8)
# Color bars by value
colors = plt.cm.viridis(data['bar_values'] / data['bar_values'].max())
colors = mpl.colormaps['viridis'](data['bar_values'] / data['bar_values'].max())
for bar, color in zip(bars, colors):
bar.set_facecolor(color)
ax.set_xlabel('Category')
ax.set_ylabel('Values')
ax.set_title('Bar Chart Example')
ax.set_xticks(x_pos)
ax.set_xticklabels(data['categories'])
ax.set_xticks(x_pos, data['categories'])
ax.grid(True, axis='y', alpha=0.3, linestyle='--')
# Remove top and right spines
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
if ax is None:
if created_fig:
return fig
return ax
def create_histogram(data, ax=None):
"""Create histogram with density overlay."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 6), constrained_layout=True)
@@ -166,13 +170,14 @@ def create_histogram(data, ax=None):
ax.legend()
ax.grid(True, axis='y', alpha=0.3, linestyle='--')
if ax is None:
if created_fig:
return fig
return ax
def create_heatmap(data, ax=None):
"""Create heatmap with colorbar and annotations."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 8), constrained_layout=True)
@@ -193,13 +198,14 @@ def create_heatmap(data, ax=None):
ax.set_ylabel('Y Index')
ax.set_title('Heatmap Example')
if ax is None:
if created_fig:
return fig
return ax
def create_contour_plot(data, ax=None):
"""Create contour plot with filled contours and labels."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 8), constrained_layout=True)
@@ -223,37 +229,39 @@ def create_contour_plot(data, ax=None):
ax.set_title('Contour Plot Example')
ax.set_aspect('equal')
if ax is None:
if created_fig:
return fig
return ax
def create_box_plot(data, ax=None):
"""Create box plot comparing distributions."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 6), constrained_layout=True)
# Generate multiple distributions
box_data = [np.random.normal(0, std, 100) for std in range(1, 5)]
bp = ax.boxplot(box_data, labels=['Group 1', 'Group 2', 'Group 3', 'Group 4'],
patch_artist=True, showmeans=True,
boxprops=dict(facecolor='lightblue', edgecolor='black'),
medianprops=dict(color='red', linewidth=2),
meanprops=dict(marker='D', markerfacecolor='green', markersize=8))
ax.boxplot(box_data, tick_labels=['Group 1', 'Group 2', 'Group 3', 'Group 4'],
patch_artist=True, showmeans=True,
boxprops=dict(facecolor='lightblue', edgecolor='black'),
medianprops=dict(color='red', linewidth=2),
meanprops=dict(marker='D', markerfacecolor='green', markersize=8))
ax.set_xlabel('Groups')
ax.set_ylabel('Values')
ax.set_title('Box Plot Example')
ax.grid(True, axis='y', alpha=0.3, linestyle='--')
if ax is None:
if created_fig:
return fig
return ax
def create_violin_plot(data, ax=None):
"""Create violin plot showing distribution shapes."""
created_fig = ax is None
if ax is None:
fig, ax = plt.subplots(figsize=(10, 6), constrained_layout=True)
@@ -272,19 +280,16 @@ def create_violin_plot(data, ax=None):
ax.set_xlabel('Groups')
ax.set_ylabel('Values')
ax.set_title('Violin Plot Example')
ax.set_xticks(range(1, 5))
ax.set_xticklabels(['Group 1', 'Group 2', 'Group 3', 'Group 4'])
ax.set_xticks(range(1, 5), ['Group 1', 'Group 2', 'Group 3', 'Group 4'])
ax.grid(True, axis='y', alpha=0.3, linestyle='--')
if ax is None:
if created_fig:
return fig
return ax
def create_3d_plot():
"""Create 3D surface plot."""
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure(figsize=(12, 9))
ax = fig.add_subplot(111, projection='3d')
@@ -14,10 +14,10 @@ Presets:
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import argparse
import os
# Predefined style presets
@@ -166,7 +166,7 @@ def create_style_preview(style_dict=None):
bars = ax3.bar(data['categories'], data['bar_values'],
edgecolor='black', linewidth=1)
# Color bars with gradient
colors = plt.cm.viridis(np.linspace(0.2, 0.8, len(bars)))
colors = mpl.colormaps['viridis'](np.linspace(0.2, 0.8, len(bars)))
for bar, color in zip(bars, colors):
bar.set_facecolor(color)
ax3.set_xlabel('Categories')
@@ -299,7 +299,8 @@ def interactive_mode():
print(" 5. Color scheme")
print(" 6. Done, show preview")
while True:
max_customization_steps = 20
for _ in range(max_customization_steps):
choice = input("\nSelect option (1-6): ").strip()
if choice == '1':
@@ -332,6 +333,8 @@ def interactive_mode():
elif choice == '6':
break
else:
print("\nReached customization step limit; showing preview with current settings.")
return style_dict