Skip to content

Commit 651b4f8

Browse files
committed
core: split gnuplot backend emission and add structured axes styling
1 parent 16c5e35 commit 651b4f8

5 files changed

Lines changed: 759 additions & 650 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ add_library(gnuplotpp
2323
src/facet.cpp
2424
src/figure.cpp
2525
src/gnuplot_backend.cpp
26+
src/gnuplot_backend_emit.cpp
2627
src/presets.cpp
2728
src/spec_yaml.cpp
2829
src/statistics.cpp
@@ -89,6 +90,13 @@ if(BUILD_EXAMPLES)
8990

9091
add_executable(tufte_minimal_example examples/tufte_minimal_example.cpp)
9192
target_link_libraries(tufte_minimal_example PRIVATE gnuplotpp::gnuplotpp)
93+
94+
if(NOT WIN32)
95+
add_custom_target(refresh-readme-assets
96+
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/refresh_readme_assets.sh ${CMAKE_BINARY_DIR}
97+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
98+
COMMENT "Regenerating README-linked figure assets from examples")
99+
endif()
92100
endif()
93101

94102
if(BUILD_TESTING)

include/gnuplotpp/plot.hpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,32 @@ struct RectObject {
133133
bool front = false;
134134
};
135135

136+
/** @brief Axes typography overrides (optional). */
137+
struct TypographySpec {
138+
bool has_tick_font_pt = false;
139+
double tick_font_pt = 8.0;
140+
bool has_label_font_pt = false;
141+
double label_font_pt = 9.0;
142+
bool has_title_font_pt = false;
143+
double title_font_pt = 9.0;
144+
bool has_title_bold = false;
145+
bool title_bold = false;
146+
};
147+
148+
/** @brief Axes frame/tick style overrides (optional). */
149+
struct AxisFrameSpec {
150+
bool has_border_mask = false;
151+
int border_mask = 15;
152+
bool has_border_line_width_pt = false;
153+
double border_line_width_pt = 0.9;
154+
bool has_border_color = false;
155+
std::string border_color = "#222222";
156+
bool has_ticks_out = false;
157+
bool ticks_out = false;
158+
bool has_ticks_mirror = false;
159+
bool ticks_mirror = false;
160+
};
161+
136162
/** @brief Axes-level labels, limits, and grid/log controls. */
137163
struct AxesSpec {
138164
std::string title;
@@ -178,6 +204,11 @@ struct AxesSpec {
178204
int yminor_count = 2;
179205
std::string xformat;
180206
std::string yformat;
207+
208+
TypographySpec typography{};
209+
AxisFrameSpec frame{};
210+
211+
// Legacy typography overrides (kept for source compatibility).
181212
bool has_tick_font_pt = false;
182213
double tick_font_pt = 8.0;
183214
bool has_label_font_pt = false;

0 commit comments

Comments
 (0)