Commit 0bda9c8
* fix: Support NaN values for disconnected line segments
Implements NaN support in add_plot to allow disconnected line segments,
resolving issue #47. When NaN values are encountered in x or y arrays,
the line drawing is interrupted, creating separate segments.
Changes:
- Modified render_solid_line to skip segments containing NaN values
- Updated render_patterned_line to handle NaN with pattern state reset
- Enhanced render_markers to skip NaN data points
- All backends (PNG, PDF, ASCII) automatically support this feature
This allows users to plot disconnected segments in a single add_plot call
by inserting NaN values as separators, similar to matplotlib behavior.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* test: Improve coverage for NaN line breaking
Add additional test cases to cover:
- Patterned lines (dashed) with NaN breaks
- Markers-only plots with NaN values
This tests more code paths in render_patterned_line and render_markers
to improve test coverage.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* test: Comprehensive NaN line breaking coverage
Add extensive test coverage for NaN handling edge cases:
- All line style patterns (solid, dashed, dotted, dash-dot, unknown)
- Edge cases: all NaN arrays, leading/trailing NaN, consecutive NaN
- Small arrays: single points, two points with NaN combinations
- Robust handling when valid_count = 0 using masked maxval/minval
Also fix potential crash when all points are NaN by adding safeguard
for maxval/minval operations and providing default plot_scale.
This should significantly improve code coverage metrics.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Correct array indexing in disconnected_lines example
Fix bug where cosine calculation used incorrect indexing x(i-5+1)
instead of x(i), which would produce incorrect plot values.
Addresses review feedback from PR #48.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent cd503bc commit 0bda9c8
File tree
4 files changed
+342
-9
lines changed- example
- src
- test
4 files changed
+342
-9
lines changedBinary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
1031 | | - | |
| 1031 | + | |
| 1032 | + | |
1032 | 1033 | | |
1033 | 1034 | | |
1034 | 1035 | | |
| |||
1042 | 1043 | | |
1043 | 1044 | | |
1044 | 1045 | | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1045 | 1049 | | |
1046 | 1050 | | |
1047 | 1051 | | |
| |||
1411 | 1415 | | |
1412 | 1416 | | |
1413 | 1417 | | |
1414 | | - | |
| 1418 | + | |
| 1419 | + | |
1415 | 1420 | | |
1416 | 1421 | | |
1417 | 1422 | | |
1418 | 1423 | | |
1419 | 1424 | | |
1420 | 1425 | | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1421 | 1432 | | |
1422 | 1433 | | |
1423 | 1434 | | |
| |||
1430 | 1441 | | |
1431 | 1442 | | |
1432 | 1443 | | |
| 1444 | + | |
1433 | 1445 | | |
1434 | 1446 | | |
1435 | 1447 | | |
| |||
1439 | 1451 | | |
1440 | 1452 | | |
1441 | 1453 | | |
1442 | | - | |
| 1454 | + | |
1443 | 1455 | | |
1444 | 1456 | | |
1445 | 1457 | | |
1446 | 1458 | | |
1447 | 1459 | | |
| 1460 | + | |
1448 | 1461 | | |
1449 | 1462 | | |
1450 | 1463 | | |
1451 | 1464 | | |
| 1465 | + | |
1452 | 1466 | | |
| 1467 | + | |
1453 | 1468 | | |
1454 | | - | |
1455 | | - | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
1456 | 1478 | | |
1457 | 1479 | | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
1461 | 1489 | | |
1462 | 1490 | | |
1463 | 1491 | | |
| |||
1502 | 1530 | | |
1503 | 1531 | | |
1504 | 1532 | | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
1505 | 1542 | | |
1506 | 1543 | | |
1507 | 1544 | | |
| |||
1519 | 1556 | | |
1520 | 1557 | | |
1521 | 1558 | | |
1522 | | - | |
| 1559 | + | |
1523 | 1560 | | |
1524 | 1561 | | |
1525 | 1562 | | |
| |||
0 commit comments