LogoLogoAPI ドキュメント
LogoLogoAPI ドキュメント
ホームページ
概要認証と冪等性画像生成画像編集画像変換グラフ生成ジョブと待機クレジットエラーレート制限と同時実行API 変更履歴
API ドキュメント

グラフ生成

データ表から論文向けのグラフを生成

POST /api/v1/charts/generations は multipart/form-data を受け付けます。必要なスコープ:charts:generate。 サービスは表を読み取り、指定または自動選択したグラフ種類で描画し、完成した PNG を 1 枚返します。 ストリーミングや途中状態は公開されません。他のジョブと同様にポーリングしてください。

フォームフィールド

フィールド型必須デフォルトルール
datafileはい—CSV、TSV、TXT、XLSX、XLS。最大 5 MB。先頭行は一意な列名
promptstringいいえ—示したい内容や強調点。最大 8,000 文字
chart_typesstringいいえ自動カンマ区切りまたは複数指定。下記の種類から最大 4 つ
journal_stylestringいいえdefaultdefault、nature、science、cell、plos、acs
figure_widthstringいいえdoublesingle(1 段)または double(2 段)
color_palettestringいいえokabe_itookabe_ito、wong、tol_bright、tol_muted

解析できない、サイズ上限を超える、列名が重複または空のファイルは 400 INVALID_REQUEST を返します(サイズ超過時の HTTP ステータスは 413)。

グラフ種類

bar, line, scatter, boxplot, violin, histogram, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , .

画像変換

画像を SVG・PPTX・PNG・PDF・TIFF に変換する

ジョブと待機

非同期処理をポーリングし、サニタイズ済みの結果を読む

目次

フォームフィールド
グラフ種類
クレジット
出力
cURL
JavaScript
Python
heatmap
regression
errorbar
timeseries
volcano
kaplan_meier
forest
dot
radar
upset
dendrogram
qq
ogive
funnel
density
roc
sankey
stem_leaf
correlation
pca
manhattan
bland_altman
waterfall
dose_response
growth_curve
standard_curve
raincloud
beeswarm
ecdf
ma_plot
enrichment
enzyme_kinetics
calendar_heatmap
choropleth
stacked_area
ridgeline
bubble
hexbin
paired_dot
precision_recall
calibration_curve
confusion_matrix

クレジット

グラフジョブ 1 件につき 10 クレジット を消費します。受付時に予約し、成功時のみ確定します。失敗したジョブは予約を解放します。

出力

result.files には論文印刷解像度の PNG が 1 枚だけ含まれ、width と height が付きます。 図のサイズはジャーナルスタイルと段幅で決まるため、ピクセル寸法はリクエストごとに異なります。

cURL

curl https://sci-draw.com/api/v1/charts/generations \
  -H 'Authorization: Bearer sd_YOUR_KEY' \
  -H 'Idempotency-Key: study-12-figure-2' \
  -H 'Prefer: wait=30' \
  -F 'data=@results.csv;type=text/csv' \
  -F 'prompt=処理群を比較し有意差を示す' \
  -F 'chart_types=boxplot' \
  -F 'journal_style=nature' \
  -F 'figure_width=single'

JavaScript

const form = new FormData();
form.set('data', file);
form.set('prompt', '処理群を比較し有意差を示す');
form.set('chart_types', 'boxplot');
const response = await fetch('https://sci-draw.com/api/v1/charts/generations', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}`, 'Idempotency-Key': crypto.randomUUID() },
  body: form,
});

Python

with open("results.csv", "rb") as table:
    response = requests.post(
        "https://sci-draw.com/api/v1/charts/generations",
        headers={"Authorization": f"Bearer {api_key}", "Idempotency-Key": str(uuid.uuid4())},
        files={"data": ("results.csv", table, "text/csv")},
        data={"prompt": "処理群を比較し有意差を示す", "chart_types": "boxplot"},
    )

アップロードした表は非公開のジョブ入力であり、ジョブやログの応答に含まれることはありません。終了状態に達すると削除されます。