alexhuntley / plots Goto Github PK
View Code? Open in Web Editor NEWA graph plotting app for GNOME
License: GNU General Public License v3.0
A graph plotting app for GNOME
License: GNU General Public License v3.0
Hi
The plots lines are very narrow and hard to see.
It is good to add an option to increse its width.
Thanks!
Right now the user can zoom in a lot in the application making it so that you can get buggy graphics(appearing on scales smaller than 5e-36)
This is probably a limitation of GTK
I can easily reproduce this by spinning up my scroll wheel and letting it do its thing for a few seconds. Here's the traceback:
$ com.github.alexhuntley.Plots
/app/lib/python3.9/site-packages/plots/graph.py:162: RuntimeWarning: overflow encountered in multiply
graph_extent = 2*self.viewport/self.viewport[0]*self.scale
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/graph.py", line 148, in gl_render
self.render()
File "/app/lib/python3.9/site-packages/plots/graph.py", line 175, in render
major_grid, minor_grid = self.major_grid(pixel_extent[0])
File "/app/lib/python3.9/site-packages/plots/graph.py", line 85, in major_grid
exponent = math.floor(math.log10(abs(min_extent)))
OverflowError: cannot convert float infinity to integer
Default one is x which lies in R. I'd like to choose, e.g., t which lies in [1, 3) or k in R \ { 0 }
I followed the instructions and tried to use the extension-less pyhon file, but that didn't work:
python3 flatpak-pip-generator --requirements-file=flatpak-requirements.txt --no-build-isolation
The snippet only worked for me after renaming the file and using this command:
python3 flatpak-pip-generator.py --requirements-file=flatpak-requirements.txt --no-build-isolation
Tested on Ubuntu 20.04
Please feel free to close.
Nice app!
I would like to create a similar app to print candle stick graphs.
I just like to know what stack you are using.
To me it looks like you are using Python and GTK (3 or 4?).
How do you create plots in GTK? I have tried to find some library for graphs/plots in GTK but I haven't found any.
How do you find the general experience with Python and GTK?
What tools/IDE are using for development and creating the UI?
Thx!
Interested to know if migration to GTK 4.0 or Libadwaita, as a replacement for Handy, is in the development roadmap. This is more of a feature request more than anything.
OS: Fedora 36
Desktop: Gnome 42.5 (under Xorg)
Graphics: NVIDIA GeForce GTX 1650 SUPER (with NVIDIA drivers)
Traceback (most recent call last): File "/app/lib/python3.9/site-packages/plots/plots.py", line 221, in update_shader attempt(good + bad + unknown) File "/app/lib/python3.9/site-packages/plots/plots.py", line 216, in attempt self.gl_area.update_fragment_shader(formulae) File "/app/lib/python3.9/site-packages/plots/graph.py", line 270, in update_fragment_shader fragment_shader = shaders.compileShader( File "/app/lib/python3.9/site-packages/OpenGL/GL/shaders.py", line 235, in compileShader raise ShaderCompilationError( OpenGL.GL.shaders.ShaderCompilationError: ("Shader compile failure (0): b'0(88) : error C0153: floating point constant overflow\\n'", [b'/*\n Copyright 2021 Alexander Huntley\n\n This file is part of Plots.\n\n Plots is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n Plots is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with Plots. If not, see .\n*/\n\n#version 330 core\nin vec2 graph_pos;\nout vec4 rgba;\n\nuniform vec2 pixel_extent;\nuniform float scale;\nuniform float major_grid;\nuniform float minor_grid;\nuniform float samples;\nuniform float line_thickness;\nuniform vec3 fg_color;\nuniform vec3 bg_color;\n\n#define pi 3.141592653589793\n#define e 2.718281828459045\n\n#define ln(x) log(x)\n#define lg(x) log2(x)\n#define log_base(b, x) (log(x)/log(b))\n#define sec(x) (1.0/cos(x))\n#define csc(x) (1.0/sin(x))\n#define cosec(x) csc(x)\n#define cot(x) (1.0/tan(x))\n#define arcsin(x) asin(x)\n#define arccos(x) acos(x)\n#define arctan(x) atan(x)\n#define asec(x) acos(1.0/(x))\n#define acsc(x) asin(1.0/(x))\n#define acosec(x) acsc(x)\n#define acot(x) (atan(1.0/(x)) - ((x) > 0 ? 0.0 : pi))\n#define arcsec(x) asec(x)\n#define arccsc(x) acsc(x)\n#define arccosec(x) acsc(x)\n#define arccot(x) acot(x)\n#define sech(x) (1.0/cosh(x))\n#define csch(x) (1.0/sinh(x))\n#define cosech(x) csch(x)\n#define coth(x) (1.0/tanh(x))\n#define asech(x) acosh(1.0/(x))\n#define acsch(x) asinh(1.0/(x))\n#define acosech(x) acsch(x)\n#define acoth(x) atanh(1.0/(x))\n#define sgn(x) sign(x)\n#define sinc(x) (sin(x)/(x))\n\nfloat rand(vec2 co){\n // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html\n return 2*fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) - 1;\n}\n\nfloat zmod(float x, float y) {\n // mod(x,y), but centered on zero\n return mod(x + y/2, y) - y/2;\n}\n\nfloat factorial(float x) {\n float res = 1;\n for (float i = 1; i <= x; i++)\n res *= i;\n return res;\n}\n\nfloat mypow(float x, float y) {\n if (x >= 0)\n return pow(x, y);\n else if (floor(y) == y) {\n return int(y) % 2 == 0 ? pow(-x, y) : -pow(-x, y);\n }\n return 1e999;\n}\n\n\n\n\n\nvoid main() {\n vec3 color = bg_color;\n vec3 formula_color = vec3(0);\n float sample_extent = line_thickness*pixel_extent.x;\n float step = sample_extent / samples;\n float jitter = .4;\n\n \n {\n \n }\n \n\n float axis_width = pixel_extent.x;\n vec3 minor_color = mix(fg_color, bg_color, 0.6);\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.x, minor_grid))));\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.y, minor_grid))));\n vec3 major_color = mix(fg_color, bg_color, 0.4);\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.x, major_grid))));\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.y, major_grid))));\n vec3 axis_color = fg_color;\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.x)));\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.y)));\n rgba = vec4(color, 1);\n}'], GL_FRAGMENT_SHADER)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/plots.py", line 224, in update_shader
attempt(good + unknown)
File "/app/lib/python3.9/site-packages/plots/plots.py", line 216, in attempt
self.gl_area.update_fragment_shader(formulae)
File "/app/lib/python3.9/site-packages/plots/graph.py", line 270, in update_fragment_shader
fragment_shader = shaders.compileShader(
File "/app/lib/python3.9/site-packages/OpenGL/GL/shaders.py", line 235, in compileShader
raise ShaderCompilationError(
OpenGL.GL.shaders.ShaderCompilationError: ("Shader compile failure (0): b'0(88) : error C0153: floating point constant overflow\n'", [b'/\n Copyright 2021 Alexander Huntley\n\n This file is part of Plots.\n\n Plots is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n Plots is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with Plots. If not, see https://www.gnu.org/licenses/.\n/\n\n#version 330 core\nin vec2 graph_pos;\nout vec4 rgba;\n\nuniform vec2 pixel_extent;\nuniform float scale;\nuniform float major_grid;\nuniform float minor_grid;\nuniform float samples;\nuniform float line_thickness;\nuniform vec3 fg_color;\nuniform vec3 bg_color;\n\n#define pi 3.141592653589793\n#define e 2.718281828459045\n\n#define ln(x) log(x)\n#define lg(x) log2(x)\n#define log_base(b, x) (log(x)/log(b))\n#define sec(x) (1.0/cos(x))\n#define csc(x) (1.0/sin(x))\n#define cosec(x) csc(x)\n#define cot(x) (1.0/tan(x))\n#define arcsin(x) asin(x)\n#define arccos(x) acos(x)\n#define arctan(x) atan(x)\n#define asec(x) acos(1.0/(x))\n#define acsc(x) asin(1.0/(x))\n#define acosec(x) acsc(x)\n#define acot(x) (atan(1.0/(x)) - ((x) > 0 ? 0.0 : pi))\n#define arcsec(x) asec(x)\n#define arccsc(x) acsc(x)\n#define arccosec(x) acsc(x)\n#define arccot(x) acot(x)\n#define sech(x) (1.0/cosh(x))\n#define csch(x) (1.0/sinh(x))\n#define cosech(x) csch(x)\n#define coth(x) (1.0/tanh(x))\n#define asech(x) acosh(1.0/(x))\n#define acsch(x) asinh(1.0/(x))\n#define acosech(x) acsch(x)\n#define acoth(x) atanh(1.0/(x))\n#define sgn(x) sign(x)\n#define sinc(x) (sin(x)/(x))\n\nfloat rand(vec2 co){\n // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html\n return 2fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) - 1;\n}\n\nfloat zmod(float x, float y) {\n // mod(x,y), but centered on zero\n return mod(x + y/2, y) - y/2;\n}\n\nfloat factorial(float x) {\n float res = 1;\n for (float i = 1; i <= x; i++)\n res = i;\n return res;\n}\n\nfloat mypow(float x, float y) {\n if (x >= 0)\n return pow(x, y);\n else if (floor(y) == y) {\n return int(y) % 2 == 0 ? pow(-x, y) : -pow(-x, y);\n }\n return 1e999;\n}\n\n\n\n\n\nvoid main() {\n vec3 color = bg_color;\n vec3 formula_color = vec3(0);\n float sample_extent = line_thicknesspixel_extent.x;\n float step = sample_extent / samples;\n float jitter = .4;\n\n \n {\n \n }\n \n\n float axis_width = pixel_extent.x;\n vec3 minor_color = mix(fg_color, bg_color, 0.6);\n color = mix(minor_color, color, smoothstep(axis_width.4, axis_width*.6, abs(zmod(graph_pos.x, minor_grid))));\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.y, minor_grid))));\n vec3 major_color = mix(fg_color, bg_color, 0.4);\n color = mix(major_color, color, smoothstep(axis_width, axis_width1.05, abs(zmod(graph_pos.x, major_grid))));\n color = mix(major_color, color, smoothstep(axis_width, axis_width1.05, abs(zmod(graph_pos.y, major_grid))));\n vec3 axis_color = fg_color;\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.x)));\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.y)));\n rgba = vec4(color, 1);\n}'], GL_FRAGMENT_SHADER)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/graph.py", line 121, in gl_realize
self.app.update_shader()
File "/app/lib/python3.9/site-packages/plots/plots.py", line 226, in update_shader
attempt(good)
File "/app/lib/python3.9/site-packages/plots/plots.py", line 216, in attempt
self.gl_area.update_fragment_shader(formulae)
File "/app/lib/python3.9/site-packages/plots/graph.py", line 270, in update_fragment_shader
fragment_shader = shaders.compileShader(
File "/app/lib/python3.9/site-packages/OpenGL/GL/shaders.py", line 235, in compileShader
raise ShaderCompilationError(
OpenGL.GL.shaders.ShaderCompilationError: ("Shader compile failure (0): b'0(88) : error C0153: floating point constant overflow\n'", [b'/\n Copyright 2021 Alexander Huntley\n\n This file is part of Plots.\n\n Plots is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n Plots is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with Plots. If not, see https://www.gnu.org/licenses/.\n/\n\n#version 330 core\nin vec2 graph_pos;\nout vec4 rgba;\n\nuniform vec2 pixel_extent;\nuniform float scale;\nuniform float major_grid;\nuniform float minor_grid;\nuniform float samples;\nuniform float line_thickness;\nuniform vec3 fg_color;\nuniform vec3 bg_color;\n\n#define pi 3.141592653589793\n#define e 2.718281828459045\n\n#define ln(x) log(x)\n#define lg(x) log2(x)\n#define log_base(b, x) (log(x)/log(b))\n#define sec(x) (1.0/cos(x))\n#define csc(x) (1.0/sin(x))\n#define cosec(x) csc(x)\n#define cot(x) (1.0/tan(x))\n#define arcsin(x) asin(x)\n#define arccos(x) acos(x)\n#define arctan(x) atan(x)\n#define asec(x) acos(1.0/(x))\n#define acsc(x) asin(1.0/(x))\n#define acosec(x) acsc(x)\n#define acot(x) (atan(1.0/(x)) - ((x) > 0 ? 0.0 : pi))\n#define arcsec(x) asec(x)\n#define arccsc(x) acsc(x)\n#define arccosec(x) acsc(x)\n#define arccot(x) acot(x)\n#define sech(x) (1.0/cosh(x))\n#define csch(x) (1.0/sinh(x))\n#define cosech(x) csch(x)\n#define coth(x) (1.0/tanh(x))\n#define asech(x) acosh(1.0/(x))\n#define acsch(x) asinh(1.0/(x))\n#define acosech(x) acsch(x)\n#define acoth(x) atanh(1.0/(x))\n#define sgn(x) sign(x)\n#define sinc(x) (sin(x)/(x))\n\nfloat rand(vec2 co){\n // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html\n return 2fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) - 1;\n}\n\nfloat zmod(float x, float y) {\n // mod(x,y), but centered on zero\n return mod(x + y/2, y) - y/2;\n}\n\nfloat factorial(float x) {\n float res = 1;\n for (float i = 1; i <= x; i++)\n res = i;\n return res;\n}\n\nfloat mypow(float x, float y) {\n if (x >= 0)\n return pow(x, y);\n else if (floor(y) == y) {\n return int(y) % 2 == 0 ? pow(-x, y) : -pow(-x, y);\n }\n return 1e999;\n}\n\n\n\n\n\nvoid main() {\n vec3 color = bg_color;\n vec3 formula_color = vec3(0);\n float sample_extent = line_thicknesspixel_extent.x;\n float step = sample_extent / samples;\n float jitter = .4;\n\n \n {\n \n }\n \n\n float axis_width = pixel_extent.x;\n vec3 minor_color = mix(fg_color, bg_color, 0.6);\n color = mix(minor_color, color, smoothstep(axis_width.4, axis_width*.6, abs(zmod(graph_pos.x, minor_grid))));\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.y, minor_grid))));\n vec3 major_color = mix(fg_color, bg_color, 0.4);\n color = mix(major_color, color, smoothstep(axis_width, axis_width1.05, abs(zmod(graph_pos.x, major_grid))));\n color = mix(major_color, color, smoothstep(axis_width, axis_width1.05, abs(zmod(graph_pos.y, major_grid))));\n vec3 axis_color = fg_color;\n color = mix(axis_color,
Maybe I missed it, but it would be great to have a absolute function |x| or abs(x).
Btw a fun program. Thanks!
version 0.8
System information :
Operating System: Manjaro Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Kernel Version: 5.10.70-1-MANJARO (64-bit)
Error during installation:
...
==> Starting check()...
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
creating Plots.egg-info
writing Plots.egg-info/PKG-INFO
writing dependency_links to Plots.egg-info/dependency_links.txt
writing entry points to Plots.egg-info/entry_points.txt
writing requirements to Plots.egg-info/requires.txt
writing top-level names to Plots.egg-info/top_level.txt
writing manifest file 'Plots.egg-info/SOURCES.txt'
reading manifest file 'Plots.egg-info/SOURCES.txt'
adding license file 'COPYING'
writing manifest file 'Plots.egg-info/SOURCES.txt'
running build_ext
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
(setup.py:154794): Gtk-WARNING **: 17:29:40.975: cannot open display:
==> ERROR: A failure occurred in check().
Aborting...
Finished with result: exit-code
Main processes terminated with: code=exited/status=4
Service runtime: 7.559s
CPU time consumed: 1.901s
However I can install plots with python3, works fine.
#47 Might solve the issue !
Should explain to users how to use the app and list all the possible functions.
My desktop is using a GTX 970 with the proprietary driver stack version 515.65.01. This should support OpenGL 4.6 according to glxinfo and I don't have any issues running games and such. Yet despite this, when I launch Plots I'm greeted by a message saying that OpenGL 3.2.0 is unsupported:
What could be causing this? I am using Plots 0.8.1 from Flathub for what it's worth, and other Flatpak apps don't seem to have issues with 3D acceleration (SuperTuxKart and Trigger Rally both work fine). Could it be that it's picking OpenGL ES 3.2 (and thus the 3.2.0 version number) for some reason? I'm reminded of this: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4687
Coming from flathub/flathub#2036
I still can't make ^ work properly, the issue is probably related to my locale
bilelmoussaoui@fedora ~ > locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
That's all I get from the terminal
bilelmoussaoui@fedora ~/P/contrast (wip/cdavis/gtk4) [SIGINT]> flatpak run com.github.alexhuntley.Plots
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 264, in on_pointer_move
self.cursor.mouse_select(element, direction, drag=True)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 341, in mouse_select
self.selection_bounds, self.selection_ancestor = self.calculate_selection()
TypeError: cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 147, in do_draw_cb
self.expr.draw(ctx, self.cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 652, in draw
super().draw(ctx, cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 551, in draw
self.index_in_parent in cursor.selection_bounds:
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 147, in do_draw_cb
self.expr.draw(ctx, self.cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 652, in draw
super().draw(ctx, cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 551, in draw
self.index_in_parent in cursor.selection_bounds:
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 264, in on_pointer_move
self.cursor.mouse_select(element, direction, drag=True)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 341, in mouse_select
self.selection_bounds, self.selection_ancestor = self.calculate_selection()
TypeError: cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 264, in on_pointer_move
self.cursor.mouse_select(element, direction, drag=True)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 341, in mouse_select
self.selection_bounds, self.selection_ancestor = self.calculate_selection()
TypeError: cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 264, in on_pointer_move
self.cursor.mouse_select(element, direction, drag=True)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 341, in mouse_select
self.selection_bounds, self.selection_ancestor = self.calculate_selection()
TypeError: cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 147, in do_draw_cb
self.expr.draw(ctx, self.cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 652, in draw
super().draw(ctx, cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 551, in draw
self.index_in_parent in cursor.selection_bounds:
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/plots/formula.py", line 147, in do_draw_cb
self.expr.draw(ctx, self.cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 652, in draw
super().draw(ctx, cursor, widget_transform)
File "/app/lib/python3.8/site-packages/plots/formula.py", line 551, in draw
self.index_in_parent in cursor.selection_bounds:
TypeError: argument of type 'NoneType' is not iterable
Shader compile failure (0): b"0:74(9): error: `s' undeclared\n0:74(2): error: `return' with wrong type error, in function `formula0' returning float\n"
Shader compile failure (0): b"0:74(9): error: `s' undeclared\n0:74(11): error: `i' undeclared\n0:74(9): error: operands to arithmetic operators must be numeric\n0:74(2): error: `return' with wrong type error, in function `formula0' returning float\n"
Shader compile failure (0): b"0:74(9): error: `sin' undeclared\n0:74(2): error: `return' with wrong type error, in function `formula0' returning float\n"
I think it could need some "Help page" with the list of operations you can use and how you can type them :)
Freshly installed Plots app doesn't open. While running Plots with Termianl: (flatpak run com.github.alexhuntley.Plots) there is the following error:
[martin@fedora ~]$ flatpak run com.github.alexhuntley.Plots
(process:2): Gtk-WARNING **: 17:20:19.820: Locale not supported by C library.
Using the fallback 'C' locale.
Traceback (most recent call last):
File "/app/bin/plots", line 8, in <module>
sys.exit(main())
File "/app/lib/python3.9/site-packages/plots/__init__.py", line 22, in main
plots.Plots().run(sys.argv)
File "/app/lib/python3.9/site-packages/plots/plots.py", line 42, in __init__
plots.i18n.bind()
File "/app/lib/python3.9/site-packages/plots/i18n.py", line 26, in bind
locale.setlocale(locale.LC_ALL, "")
File "/usr/lib/python3.9/locale.py", line 610, in setlocale
return _setlocale(category, locale)
Plots 0.8.4 (Flathub)
OS: Fedora Silverblue 37 (Beta)
GNOME 43.0
Wayland
The recent release of Plots on Flathub didn't include the partially complete Help file translations.
Does the CI need to be updated so that updates to the Help files are included with new releases of the main Plots program?
Can the Hungarian Help file translations please be merged into the Plots program and released on Flathub?
Thank you
I am an Italian mathematician so I use correct formulas. Anyway, some scholars could use "sen" instead of "sin" (sinus), "tg" instead of "tan", "cotg" or "cotan" instead of "cot"
Currently the x-axis and y-axis are linear and based on unity.
Is it possible to change the x-axis, y-axis or both axes to logarithmic?
Is it possible to change the increment from unity (i.e. 1, 2, 3, …) to π (i.e. π, 2π, 3π, …)? If you zoom in, the units could still be based on fractional measurements of π, i.e. -0.6π, -0.4π, -0.2π, 0, 0.2π, 0.4π, 0.6π.
What do you think?
Thank you
Hi!
Can you please consider reducing the contrast between the color of the grid and that of the main axes?
As you see, it's pretty difficult to distinguish them. Also, the grid is so prominent that it makes difficult to see some functions or parts of them. In fact, have you noticed that in the above picture I plotted f(x) = 2? 👀
For instance pasting crash¡
into an equation field leads to a crash with the following traceback:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/cursor.py", line 98, in paste_cb
elements = parser.from_latex(text)
File "/app/lib/python3.9/site-packages/plots/parser.py", line 138, in from_latex
return transformer.transform(latex_parser.parse(string))
File "/app/lib/python3.9/site-packages/lark/lark.py", line 625, in parse
return self.parser.parse(text, start=start, on_error=on_error)
File "/app/lib/python3.9/site-packages/lark/parser_frontends.py", line 96, in parse
return self.parser.parse(stream, chosen_start, **kw)
File "/app/lib/python3.9/site-packages/lark/parsers/earley.py", line 266, in parse
to_scan = self._parse(lexer, columns, to_scan, start_symbol)
File "/app/lib/python3.9/site-packages/lark/parsers/xearley.py", line 146, in _parse
to_scan = scan(i, to_scan)
File "/app/lib/python3.9/site-packages/lark/parsers/xearley.py", line 119, in scan
raise UnexpectedCharacters(stream, i, text_line, text_column, {item.expect.name for item in to_scan},
lark.exceptions.UnexpectedCharacters: No terminal matches '¡' in the current parser context, at line 1 col 6
crash¡
^
Expected one of:
* MINUS
* __ANON_4
* PAREN
* EQUAL
* UNDERSCORE
* DIGIT
* __ANON_3
* __ANON_0
* __ANON_1
* __ANON_5
* GREEK
* __ANON_7
* __ANON_2
* CIRCUMFLEX
* PLUS
* SYMBOL
* TIMES
* __ANON_6
* LETTER
Version:
0.8.2 (flatpak)
First of all, thank you for this wonderful app, I first tried it recently and I really like the clean user interface and simple, command driven usage.
I would find it really helpful if the program would be able to plot integral and derivatives.
This would not only be helpful to demonstrate basics of calculus but would also enable the plotting of some functions in their most common form. E.g. the gamma function is only rarely advertised in its product form and hence, really hard to plot for anybody unaware of other formulations.
Right now, plot fails to build in Arch Linux and Ubuntu with the following error.
ModuleNotFoundError: No module named 'glm'
Is it this library? https://pypi.org/project/glm/
Is it something else?
Some keys are translateable. How can I translate this software?
In the Help menu, the first item is New window
. Can this feature please be added to the main program?
Thank you
It's useful for a clone, build, run with GNOME Builder or VSCode (or any IDE that does support Flatpak in the future) :)
It can also be used for CI
Could you make an RPM package? Flatpak never worked for me, and I'm on Fedora.
It's hard to get a good idea of the scale of the graphs without having at least some x and y values as a foundation. It'd be great if the x and y axis were both labeled with coordinates at regular intervals. Those intervals should depend on the scale of zoom, so that they're easily legible, but not sparse enough to be unhelpful.
Please add the summary and description texts (see below) into one of the Weblate components so they can get translated into other languages.
Summary:
Simple graph plotting
Description 1:
Plots makes it easy to visualise mathematical formulae. In addition to basic arithmetic operations, it supports trigonometric, hyperbolic, exponential and logarithmic functions, as well as arbitrary sums and products.
Description 2:
Plots is designed to integrate well with the GNOME desktop and takes advantage of modern hardware using OpenGL.
Also make sure those translated strings get used on localized web-pages like this one:
https://world.pages.gitlab.gnome.org/apps-for-gnome/hr/app/com.github.alexhuntley.Plots/
Add the ability to animate variables, similar to how desmos does it.
Why:
It would help the user gain a better understanding of how a change in a variable affects a graph.
Follow on features:
add the ability to export a video/gif of the animation.
The application crashes when typing "^" into an empty equation
Traceback:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/formularow.py", line 304, in edited
body, expr = self.editor.expr.to_glsl()
File "/app/lib/python3.9/site-packages/plots/elements/elements.py", line 307, in to_glsl
string_stack[-1].insert(i, "mypow(")
UnboundLocalError: local variable 'i' referenced before assignment
Version:
0.8.2 (flatpak)
I open the menu and click on Help
, a new window open displaying the following message:
Document Not Found
The URI ‘help:plots/index’ does not point to a valid page.
Search for packages containing this document.
In About section there is no link to Github
I cannot show the graph of y = log_a (x) either with any a or moving a in an interval
It seems
x^2+y^2=4
doesn't work properly. Any support?
As title says
Hi, thanks for your work on Plots, it is really useful!
My use-case is mostly applying formulas to arbitrary values (simulation output) to further process the signal.
I would like to be able to "import" values from external files.
For example CSV files formatted with x, y
per lines would be available as f(x) = y
, to be able to plot it.
I wouldn't mind and could contribute an inelegant hack of importing a hardcoded filename on startup, I would just need an idea of where to look for, specifically where in the parser or in the formula calculation, to feed the imported values.
I guess this might not be a very common use-case?
currently only black (white) is only dark/light mode aware.
It would be great to have all colors be mode aware.
Proposal:
Define for the light mode a set of dark colors (maybe remove yellow, at it is not really visible) on white background.
Then define for each color a lighter version for the dark mode (maybe it is not needed for medium bright colors)
With this, one could switch between the different modes, without adjusting the colors of the plots.
When I type "sum" into an equation, the application crashes with the following error:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/formularow.py", line 304, in edited
body, expr = self.editor.expr.to_glsl()
File "/app/lib/python3.9/site-packages/plots/elements/elements.py", line 338, in to_glsl
sum_body, sum_expr = sums.pop().to_glsl("".join(body_stack.pop()),
File "/app/lib/python3.9/site-packages/plots/elements/sum.py", line 53, in to_glsl
assert var.isidentifier()
Running the latest flatpak version (0.8.1).
Sometimes/Often it's not possible to close the about dialog any more and then application can only be killed.
Try a couple of times to open the about dialog an close it.
v0,8 via Flatpak
Deleting a variable that is used in in another equation crashes the program.
How to reproduce:
a=1
as first equationa*x
as second equationTraceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/plots.py", line 222, in update_shader
attempt(good + bad + unknown)
File "/app/lib/python3.9/site-packages/plots/plots.py", line 217, in attempt
self.gl_area.update_fragment_shader(formulae)
File "/app/lib/python3.9/site-packages/plots/graph.py", line 275, in update_fragment_shader
fragment_shader = shaders.compileShader(
File "/app/lib/python3.9/site-packages/OpenGL/GL/shaders.py", line 235, in compileShader
raise ShaderCompilationError(
OpenGL.GL.shaders.ShaderCompilationError: ('Shader compile failure (0): b"0:94(9): error: `a\' undeclared\\n0:94(9): error: operands to arithmetic operators must be numeric\\n0:94(2): error: `return\' with wrong type error, in function `formula139965471340384\' returning float\\n"', [b'/*\n Copyright 2021 Alexander Huntley\n\n This file is part of Plots.\n\n Plots is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n Plots is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with Plots. If not, see <https://www.gnu.org/licenses/>.\n*/\n\n#version 330 core\nin vec2 graph_pos;\nout vec4 rgba;\n\nuniform vec2 pixel_extent;\nuniform float scale;\nuniform float major_grid;\nuniform float minor_grid;\nuniform float samples;\nuniform float line_thickness;\nuniform vec3 fg_color;\nuniform vec3 bg_color;\n\n#define pi 3.141592653589793\n#define e 2.718281828459045\n\n#define ln(x) log(x)\n#define lg(x) log2(x)\n#define log_base(b, x) (log(x)/log(b))\n#define sec(x) (1.0/cos(x))\n#define csc(x) (1.0/sin(x))\n#define cosec(x) csc(x)\n#define cot(x) (1.0/tan(x))\n#define arcsin(x) asin(x)\n#define arccos(x) acos(x)\n#define arctan(x) atan(x)\n#define asec(x) acos(1.0/(x))\n#define acsc(x) asin(1.0/(x))\n#define acosec(x) acsc(x)\n#define acot(x) (atan(1.0/(x)) - ((x) > 0 ? 0.0 : pi))\n#define arcsec(x) asec(x)\n#define arccsc(x) acsc(x)\n#define arccosec(x) acsc(x)\n#define arccot(x) acot(x)\n#define sech(x) (1.0/cosh(x))\n#define csch(x) (1.0/sinh(x))\n#define cosech(x) csch(x)\n#define coth(x) (1.0/tanh(x))\n#define asech(x) acosh(1.0/(x))\n#define acsch(x) asinh(1.0/(x))\n#define acosech(x) acsch(x)\n#define acoth(x) atanh(1.0/(x))\n#define sgn(x) sign(x)\n#define sinc(x) (sin(x)/(x))\n\nfloat rand(vec2 co){\n // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html\n return 2*fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) - 1;\n}\n\nfloat zmod(float x, float y) {\n // mod(x,y), but centered on zero\n return mod(x + y/2, y) - y/2;\n}\n\nfloat factorial(float x) {\n float res = 1;\n for (float i = 1; i <= x; i++)\n res *= i;\n return res;\n}\n\nfloat mypow(float x, float y) {\n if (x >= 0)\n return pow(x, y);\n else if (floor(y) == y) {\n return int(y) % 2 == 0 ? pow(-x, y) : -pow(-x, y);\n }\n return 1. / 0.;\n}\n\n\nfloat formula139965471340384(float x) {\n \n return a*x;\n}\n\n\n\n\nvoid main() {\n vec3 color = bg_color;\n vec3 formula_color = vec3(0);\n float sample_extent = line_thickness*pixel_extent.x;\n float step = sample_extent / samples;\n float jitter = .4;\n\n float axis_width = pixel_extent.x;\n vec3 minor_color = mix(fg_color, bg_color, 0.6);\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.x, minor_grid))));\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.y, minor_grid))));\n vec3 major_color = mix(fg_color, bg_color, 0.4);\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.x, major_grid))));\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.y, major_grid))));\n vec3 axis_color = fg_color;\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.x)));\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.y)));\n\n \n {\n float inside = 0;\nfloat outside = 0;\nfloat prev = 0;\nint monotonic = 0;\nbool nans = false;\nfor (float i = 0.0; i < samples; i++) {\n float ii = i + jitter*rand(vec2(graph_pos.x + i*step, graph_pos.y)) - samples/2;\n float x = graph_pos.x + ii*step;\n float yj = jitter*rand(vec2(graph_pos.y, graph_pos.y + i*step));\n float lower = (-0.5+yj)*sample_extent;\n float upper = (0.5+yj)*sample_extent;\n float fp, f;\n\n f = formula139965471340384(x) - graph_pos.y;\n if (lower < f && f < upper)\n inside += 1.0;\n else\n outside += sign(f);\n fp = prev;\n if (i != 0.0)\n monotonic += int(sign(f - fp));\n prev = f;\n nans = nans || isinf(f) || isnan(f);\n}\nformula_color = vec3(0.5607843399047852,0.9411764740943909,0.6431372761726379);\nif (abs(monotonic) != int(samples) - 3 && !nans) {\n if (inside > 0.0)\n color = mix(color, formula_color, inside/samples);\n if (abs(outside) != samples)\n color = mix(color, formula_color, 1. - abs(outside)/samples);\n}\n }\n \n {\n \n }\n \n\n rgba = vec4(color, 1);\n}'], GL_FRAGMENT_SHADER)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/plots.py", line 225, in update_shader
attempt(good + unknown)
File "/app/lib/python3.9/site-packages/plots/plots.py", line 217, in attempt
self.gl_area.update_fragment_shader(formulae)
File "/app/lib/python3.9/site-packages/plots/graph.py", line 275, in update_fragment_shader
fragment_shader = shaders.compileShader(
File "/app/lib/python3.9/site-packages/OpenGL/GL/shaders.py", line 235, in compileShader
raise ShaderCompilationError(
OpenGL.GL.shaders.ShaderCompilationError: ('Shader compile failure (0): b"0:94(9): error: `a\' undeclared\\n0:94(9): error: operands to arithmetic operators must be numeric\\n0:94(2): error: `return\' with wrong type error, in function `formula139965471340384\' returning float\\n"', [b'/*\n Copyright 2021 Alexander Huntley\n\n This file is part of Plots.\n\n Plots is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n Plots is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with Plots. If not, see <https://www.gnu.org/licenses/>.\n*/\n\n#version 330 core\nin vec2 graph_pos;\nout vec4 rgba;\n\nuniform vec2 pixel_extent;\nuniform float scale;\nuniform float major_grid;\nuniform float minor_grid;\nuniform float samples;\nuniform float line_thickness;\nuniform vec3 fg_color;\nuniform vec3 bg_color;\n\n#define pi 3.141592653589793\n#define e 2.718281828459045\n\n#define ln(x) log(x)\n#define lg(x) log2(x)\n#define log_base(b, x) (log(x)/log(b))\n#define sec(x) (1.0/cos(x))\n#define csc(x) (1.0/sin(x))\n#define cosec(x) csc(x)\n#define cot(x) (1.0/tan(x))\n#define arcsin(x) asin(x)\n#define arccos(x) acos(x)\n#define arctan(x) atan(x)\n#define asec(x) acos(1.0/(x))\n#define acsc(x) asin(1.0/(x))\n#define acosec(x) acsc(x)\n#define acot(x) (atan(1.0/(x)) - ((x) > 0 ? 0.0 : pi))\n#define arcsec(x) asec(x)\n#define arccsc(x) acsc(x)\n#define arccosec(x) acsc(x)\n#define arccot(x) acot(x)\n#define sech(x) (1.0/cosh(x))\n#define csch(x) (1.0/sinh(x))\n#define cosech(x) csch(x)\n#define coth(x) (1.0/tanh(x))\n#define asech(x) acosh(1.0/(x))\n#define acsch(x) asinh(1.0/(x))\n#define acosech(x) acsch(x)\n#define acoth(x) atanh(1.0/(x))\n#define sgn(x) sign(x)\n#define sinc(x) (sin(x)/(x))\n\nfloat rand(vec2 co){\n // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html\n return 2*fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) - 1;\n}\n\nfloat zmod(float x, float y) {\n // mod(x,y), but centered on zero\n return mod(x + y/2, y) - y/2;\n}\n\nfloat factorial(float x) {\n float res = 1;\n for (float i = 1; i <= x; i++)\n res *= i;\n return res;\n}\n\nfloat mypow(float x, float y) {\n if (x >= 0)\n return pow(x, y);\n else if (floor(y) == y) {\n return int(y) % 2 == 0 ? pow(-x, y) : -pow(-x, y);\n }\n return 1. / 0.;\n}\n\n\nfloat formula139965471340384(float x) {\n \n return a*x;\n}\n\n\n\n\nvoid main() {\n vec3 color = bg_color;\n vec3 formula_color = vec3(0);\n float sample_extent = line_thickness*pixel_extent.x;\n float step = sample_extent / samples;\n float jitter = .4;\n\n float axis_width = pixel_extent.x;\n vec3 minor_color = mix(fg_color, bg_color, 0.6);\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.x, minor_grid))));\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.y, minor_grid))));\n vec3 major_color = mix(fg_color, bg_color, 0.4);\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.x, major_grid))));\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.y, major_grid))));\n vec3 axis_color = fg_color;\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.x)));\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.y)));\n\n \n {\n float inside = 0;\nfloat outside = 0;\nfloat prev = 0;\nint monotonic = 0;\nbool nans = false;\nfor (float i = 0.0; i < samples; i++) {\n float ii = i + jitter*rand(vec2(graph_pos.x + i*step, graph_pos.y)) - samples/2;\n float x = graph_pos.x + ii*step;\n float yj = jitter*rand(vec2(graph_pos.y, graph_pos.y + i*step));\n float lower = (-0.5+yj)*sample_extent;\n float upper = (0.5+yj)*sample_extent;\n float fp, f;\n\n f = formula139965471340384(x) - graph_pos.y;\n if (lower < f && f < upper)\n inside += 1.0;\n else\n outside += sign(f);\n fp = prev;\n if (i != 0.0)\n monotonic += int(sign(f - fp));\n prev = f;\n nans = nans || isinf(f) || isnan(f);\n}\nformula_color = vec3(0.5607843399047852,0.9411764740943909,0.6431372761726379);\nif (abs(monotonic) != int(samples) - 3 && !nans) {\n if (inside > 0.0)\n color = mix(color, formula_color, inside/samples);\n if (abs(outside) != samples)\n color = mix(color, formula_color, 1. - abs(outside)/samples);\n}\n }\n \n {\n \n }\n \n\n rgba = vec4(color, 1);\n}'], GL_FRAGMENT_SHADER)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/plots/formularow.py", line 283, in delete
self.app.update_shader()
File "/app/lib/python3.9/site-packages/plots/plots.py", line 227, in update_shader
attempt(good)
File "/app/lib/python3.9/site-packages/plots/plots.py", line 217, in attempt
self.gl_area.update_fragment_shader(formulae)
File "/app/lib/python3.9/site-packages/plots/graph.py", line 275, in update_fragment_shader
fragment_shader = shaders.compileShader(
File "/app/lib/python3.9/site-packages/OpenGL/GL/shaders.py", line 235, in compileShader
raise ShaderCompilationError(
OpenGL.GL.shaders.ShaderCompilationError: ('Shader compile failure (0): b"0:94(9): error: `a\' undeclared\\n0:94(9): error: operands to arithmetic operators must be numeric\\n0:94(2): error: `return\' with wrong type error, in function `formula139965471340384\' returning float\\n"', [b'/*\n Copyright 2021 Alexander Huntley\n\n This file is part of Plots.\n\n Plots is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n Plots is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with Plots. If not, see <https://www.gnu.org/licenses/>.\n*/\n\n#version 330 core\nin vec2 graph_pos;\nout vec4 rgba;\n\nuniform vec2 pixel_extent;\nuniform float scale;\nuniform float major_grid;\nuniform float minor_grid;\nuniform float samples;\nuniform float line_thickness;\nuniform vec3 fg_color;\nuniform vec3 bg_color;\n\n#define pi 3.141592653589793\n#define e 2.718281828459045\n\n#define ln(x) log(x)\n#define lg(x) log2(x)\n#define log_base(b, x) (log(x)/log(b))\n#define sec(x) (1.0/cos(x))\n#define csc(x) (1.0/sin(x))\n#define cosec(x) csc(x)\n#define cot(x) (1.0/tan(x))\n#define arcsin(x) asin(x)\n#define arccos(x) acos(x)\n#define arctan(x) atan(x)\n#define asec(x) acos(1.0/(x))\n#define acsc(x) asin(1.0/(x))\n#define acosec(x) acsc(x)\n#define acot(x) (atan(1.0/(x)) - ((x) > 0 ? 0.0 : pi))\n#define arcsec(x) asec(x)\n#define arccsc(x) acsc(x)\n#define arccosec(x) acsc(x)\n#define arccot(x) acot(x)\n#define sech(x) (1.0/cosh(x))\n#define csch(x) (1.0/sinh(x))\n#define cosech(x) csch(x)\n#define coth(x) (1.0/tanh(x))\n#define asech(x) acosh(1.0/(x))\n#define acsch(x) asinh(1.0/(x))\n#define acosech(x) acsch(x)\n#define acoth(x) atanh(1.0/(x))\n#define sgn(x) sign(x)\n#define sinc(x) (sin(x)/(x))\n\nfloat rand(vec2 co){\n // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html\n return 2*fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) - 1;\n}\n\nfloat zmod(float x, float y) {\n // mod(x,y), but centered on zero\n return mod(x + y/2, y) - y/2;\n}\n\nfloat factorial(float x) {\n float res = 1;\n for (float i = 1; i <= x; i++)\n res *= i;\n return res;\n}\n\nfloat mypow(float x, float y) {\n if (x >= 0)\n return pow(x, y);\n else if (floor(y) == y) {\n return int(y) % 2 == 0 ? pow(-x, y) : -pow(-x, y);\n }\n return 1. / 0.;\n}\n\n\nfloat formula139965471340384(float x) {\n \n return a*x;\n}\n\n\n\n\nvoid main() {\n vec3 color = bg_color;\n vec3 formula_color = vec3(0);\n float sample_extent = line_thickness*pixel_extent.x;\n float step = sample_extent / samples;\n float jitter = .4;\n\n float axis_width = pixel_extent.x;\n vec3 minor_color = mix(fg_color, bg_color, 0.6);\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.x, minor_grid))));\n color = mix(minor_color, color, smoothstep(axis_width*.4, axis_width*.6, abs(zmod(graph_pos.y, minor_grid))));\n vec3 major_color = mix(fg_color, bg_color, 0.4);\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.x, major_grid))));\n color = mix(major_color, color, smoothstep(axis_width, axis_width*1.05, abs(zmod(graph_pos.y, major_grid))));\n vec3 axis_color = fg_color;\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.x)));\n color = mix(axis_color, color, smoothstep(axis_width*.6, axis_width*.65, abs(graph_pos.y)));\n\n \n {\n float inside = 0;\nfloat outside = 0;\nfloat prev = 0;\nint monotonic = 0;\nbool nans = false;\nfor (float i = 0.0; i < samples; i++) {\n float ii = i + jitter*rand(vec2(graph_pos.x + i*step, graph_pos.y)) - samples/2;\n float x = graph_pos.x + ii*step;\n float yj = jitter*rand(vec2(graph_pos.y, graph_pos.y + i*step));\n float lower = (-0.5+yj)*sample_extent;\n float upper = (0.5+yj)*sample_extent;\n float fp, f;\n\n f = formula139965471340384(x) - graph_pos.y;\n if (lower < f && f < upper)\n inside += 1.0;\n else\n outside += sign(f);\n fp = prev;\n if (i != 0.0)\n monotonic += int(sign(f - fp));\n prev = f;\n nans = nans || isinf(f) || isnan(f);\n}\nformula_color = vec3(0.5607843399047852,0.9411764740943909,0.6431372761726379);\nif (abs(monotonic) != int(samples) - 3 && !nans) {\n if (inside > 0.0)\n color = mix(color, formula_color, inside/samples);\n if (abs(outside) != samples)\n color = mix(color, formula_color, 1. - abs(outside)/samples);\n}\n }\n \n {\n \n }\n \n\n rgba = vec4(color, 1);\n}'], GL_FRAGMENT_SHADER)
Version:
0.8.3 (flatpak)
Is it possible to have a setting section? I'd like to choose colors of axis and background (night mode) and I'd like to turn on number on the default grid
The ability to build three-dimensional graphs, would be very useful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.