This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f4 = lambda x: 3.8 * (x - x**2) | |
sequence = SequenceForIteratedFunction(f4, 0.2, 200) | |
p = Plotter(sequence) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f3 = lambda x: 3.5 * (x - x**2) | |
sequence = SequenceForIteratedFunction(f3, 0.2, 200) | |
p = Plotter(sequence) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f2 = lambda x: 3.2 * (x - x**2) | |
sequence = SequenceForIteratedFunction(f2, 0.2, 200) | |
p = Plotter(sequence) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sequence = SequenceForIteratedFunction(f1, 0.2, 200) | |
p = Plotter(sequence) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f1 = lambda x: 2.2 * (x - x**2) | |
funcSequence = SequenceForFunction(f1, 0.0, 1.0, 200) | |
pfunc = Plotter(funcSequence) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Plotter: | |
def __init__(self, sequence, width = 1000, height = 400, boundariesSizeQuotient = 0.06): | |
self.values = sequence | |
self.valuesCount = len(self.values) | |
self.sizeQuotient = boundariesSizeQuotient | |
self.DeterminePlotBoundaries(width, height) | |
self.CreateCanvas(width, height) | |
self.DrawGrid() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def CreateCanvas(self, width, height): | |
self.root = Tk() | |
self.canvas = Canvas(self.root, width = width, height = height) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def DeterminePlotBoundaries(self, width, height): | |
self.upper = height * self.sizeQuotient | |
self.lower = height * (1.0 - self.sizeQuotient) | |
self.left = width * self.sizeQuotient | |
self.right = width * (1.0 - self.sizeQuotient) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Transform(self, y): | |
return self.lower - y*(self.lower - self.upper) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def DrawData(self): | |
dataColor = "black" | |
xStep = self.XStep() | |
for i in range(1, self.valuesCount): | |
x1 = self.left + xStep*(i-1) | |
y1 = self.Transform(self.values[i-1]) | |
x2 = self.left + xStep*i | |
y2 = self.Transform(self.values[i]) | |
self.canvas.create_line(x1, y1, x2, y2, fill = dataColor) |
NewerOlder