tinyblocks-plot: graficos no estilo do matplotlib

Figura atual como no pyplot: linha, linha x-y, pontos, barras com nomes,
histograma, titulo, nomes dos eixos (y na vertical), legenda, grade,
limites e series com nome que crescem a cada passo (curvas de treino).
Desenha numa imagem (para o palco) ou grava em PNG/BMP/PPM. Valores de
lista, de texto ou de tensor. Paleta tab10; marcas "redondas" (1, 2, 5
x 10^n) com folga de 5%; linhas e pontos com antisserrilhado; fonte
DejaVu Sans 12 px embutida (tools/gen_font.c, via tinyblocks-opentype),
com os acentos do portugues.

Convolucoes da ai: "filtros de tamanho %3" (o rotulo repetia o campo).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mguinhosandClaude Opus 5.5 committed 2026-10-26 23:47:49 -03:00
1 parent 25bb30d12f
commit 2951535d93
10 files changed
+1957 -4

No files matched your search

+13 -2
View File
@@ -86,7 +86,7 @@ CAT_LDFLAGS := $(foreach l,$(CAT_LIBS),-ltinyblocks-$(l))
CAT_INCS := $(foreach l,$(CAT_LIBS),-I$(LIBDIR)/tinyblocks-$(l)/include)
# Libraries que o editor registra como as de categoria, mas com varios
# fontes e o Makefile proprio (o harness nao as compila junto)
APP_LIBS := socket ssl http archive tensor ai
APP_LIBS := socket ssl http archive tensor ai plot
APP_A := $(foreach l,$(APP_LIBS),$(LIBDIR)/tinyblocks-$(l)/build/libtinyblocks-$(l).a)
APP_INCS := $(foreach l,$(APP_LIBS),-I$(LIBDIR)/tinyblocks-$(l)/include)
APP_LDLIBS := -lssl -lcrypto -lz -lpthread
@@ -111,7 +111,7 @@ LIB_LDFLAGS := -L$(ED_DIR)/build -L$(GX_DIR)/build -L$(SD_DIR)/build \
editor run-editor run-sdl2 mylib vector customappearance graphics sdl2-backend test-editor \
appdir appimage run-appimage icon \
test-toml test-plugin test-blueprint test-a11y test-mcp test-mcp-server test-base64 test-curves test-meta test-ppm test-bmp test-png test-image test-vg test-svg test-jpg \
test-tensor test-ai test-http test-archive test-syntax test-os test-value test-vars test-scratchblocks test-input test-stdlib test-regex test-markdown test-opentype \
test-tensor test-ai test-http test-archive test-plot test-syntax test-os test-value test-vars test-scratchblocks test-input test-stdlib test-regex test-markdown test-opentype \
category-libs category-sos libs app-libs \
lib-events lib-control lib-errors lib-input lib-operators lib-number lib-string lib-variables lib-vector lib-appearance lib-pen lib-fs lib-os \
lib-environ \
@@ -648,6 +648,17 @@ $(BUILD)/archive_test: tests/archive_test.c $(LIBDIR)/tinyblocks-archive/src/tb_
test-archive: $(BUILD)/archive_test ## Roda o teste da archive (ASan/UBSan)
./$(BUILD)/archive_test
# -- Teste da library plot (figura -> imagem PNG) ---
PLOT_DIR := $(LIBDIR)/tinyblocks-plot
$(BUILD)/plot_test: tests/plot_test.c $(PLOT_DIR)/src/tb_plot.c $(PLOT_DIR)/src/plot_font.h $(TENSOR_SRCS) static
@mkdir -p $(BUILD)
$(CC) $(CFLAGS_DBG) -I$(TENSOR_DIR)/include -I$(PLOT_DIR)/include -I$(PNG_DIR)/include \
$(TENSOR_SRCS) $(PLOT_DIR)/src/tb_plot.c $(PNG_DIR)/src/tb_png.c tests/plot_test.c -o $@ \
-Wl,--start-group $(LIB_A) -Wl,--end-group -lpng -lm -lpthread
test-plot: $(BUILD)/plot_test ## Roda o teste da plot (ASan/UBSan; grava /tmp/tb_plot_*.png)
./$(BUILD)/plot_test
# -- Teste da library curves ---
$(BUILD)/curves_test: tests/curves_test.c $(CV_DIR)/src/tb_curves.c static
@mkdir -p $(BUILD)