MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / draw_axis

Function draw_axis

DemoPrograms/Demo_Graph_Element_Sine_Wave.py:32–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30
31
32def draw_axis():
33 graph.draw_line((-SIZE_X, 0), (SIZE_X, 0)) # axis lines
34 graph.draw_line((0, -SIZE_Y), (0, SIZE_Y))
35
36 for x in range(-SIZE_X, SIZE_X+1, NUMBER_MARKER_FREQUENCY):
37 graph.draw_line((x, -SIZE_Y/66), (x, SIZE_Y/66)) # tick marks
38 if x != 0:
39 # numeric labels
40 graph.draw_text(str(x), (x, -SIZE_Y/15), color='green', font='courier 10')
41
42 for y in range(-SIZE_Y, SIZE_Y+1, NUMBER_MARKER_FREQUENCY):
43 graph.draw_line((-SIZE_X/66, y), (SIZE_X/66, y))
44 if y != 0:
45 graph.draw_text(str(y), (-SIZE_X/11, y), color='blue', font='courier 10')
46
47# Create the graph that will be put into the window. Making outside of layout so have element in a variable
48graph = sg.Graph(canvas_size=(500, 500),

Callers 1

Calls 2

draw_lineMethod · 0.80
draw_textMethod · 0.80

Tested by

no test coverage detected