{"id":21296908,"url":"https://github.com/reddec/svg","last_synced_at":"2025-10-15T07:34:21.927Z","repository":{"id":17709960,"uuid":"20522618","full_name":"reddec/svg","owner":"reddec","description":"Lightweight C plotting library without special dependencies for Linux and Win","archived":false,"fork":false,"pushed_at":"2021-02-19T04:53:45.000Z","size":99,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T05:05:45.011Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reddec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-05T11:34:39.000Z","updated_at":"2025-01-13T23:35:14.000Z","dependencies_parsed_at":"2022-07-13T04:40:57.198Z","dependency_job_id":null,"html_url":"https://github.com/reddec/svg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/reddec/svg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fsvg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fsvg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fsvg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fsvg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reddec","download_url":"https://codeload.github.com/reddec/svg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fsvg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279059577,"owners_count":26094983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T14:30:54.723Z","updated_at":"2025-10-15T07:34:21.899Z","avatar_url":"https://github.com/reddec.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"svg\n===\n\nLightweight C plotting library without special dependencies for Linux and Win. \nDeveloped with C89 standart. Successfull build on gcc-4.8 and Visual C compiller 2010\n\n## Example\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003cmath.h\u003e\n#include \"svg.h\"\n\nint main(int argc, char** argv)\n{\n    int size = 410, i;\n    double *data = (double*) malloc(sizeof (double)*size);/*Allocate test y array*/\n    double *x = (double*) malloc(sizeof (double)*size);   /*Allocate test x array*/\n    FILE *f;\n    for (i = 0; i \u003c size; ++i)                             /*Fill x and y values*/\n    {\n        data[i] = 50 + 50 * sin(i * 0.03);\n        x[i] = i;\n    }\n    f = fopen(\"sin.svg\", \"w\");                             /*Open result file*/\n    /* Plot graphic with red (#ff0000) lines as svg image only */\n    svg_draw_to_file_xy(f, \"#ff0000\", data, x, size, \"x\", \"sin(x)\", 2, false); \n    fclose(f);                                             /*Close result file*/\n    free(data);                                            /* Free y array */\n    free(x);                                               /* Free x array */\n    return (EXIT_SUCCESS);\n}\n```\n\nCompile the example:\n\n```\n$ gcc main.c svg.c -lm\n$ ./a.out\n```\n\nOutput of `sin.svg`:\n\n![Sin](https://raw.githubusercontent.com/reddec/svg/master/doc/sin.png)\n\n## API\n\nFull version\n\n```c++\nvoid svg_draw_to_file_xy(\n            FILE *f,\n            const char *color,\n            double *y,\n            double *x,\n            size_t count,\n            const char *xlabel,\n            const char *ylabel,\n            int decimal,\n            bool html)\n```\n            \nShort version with auto generated X (from 0 to count-1)\n\n```c++\nvoid svg_draw_to_file_y(\n            FILE *f,\n            const char *color,\n            double *y,\n            size_t count,\n            const char *xlabel,\n            const char *ylabel,\n            int decimal,\n            bool html)\n```\n\n* **f** - reference to opened file for writing result\n* **color** - line color\n* **y** - array with values\n* **x** - sorted array with x values from minimum to maximum\n* **count** - elements count (not bytes)\n* **decimal** - number after dot in float\n* **html** - generate or not html page with inline svg. Usefull for Windows users, which do not have other good SVG viewer then browsers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freddec%2Fsvg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freddec%2Fsvg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freddec%2Fsvg/lists"}