-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plotting method now takes a function as an argument.
- Loading branch information
1 parent
9a6b723
commit 69ac980
Showing
7 changed files
with
381 additions
and
292 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,50 @@ | ||
.DS_Store | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff: | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/dictionaries | ||
|
||
# Sensitive or high-churn files: | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.xml | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
|
||
# Gradle: | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# CMake | ||
cmake-build-debug/ | ||
|
||
# Mongo Explorer plugin: | ||
.idea/**/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
/out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,49 @@ | ||
import numpy as np | ||
from PyQt4 import QtGui | ||
from PyQt4.uic import loadUiType | ||
|
||
from matplotlib.figure import Figure | ||
from matplotlib.backends.backend_qt4agg import ( | ||
FigureCanvasQTAgg as FigureCanvas, | ||
NavigationToolbar2QT as NavigationToolbar) | ||
from matplotlib.figure import Figure | ||
from sympy import * | ||
|
||
Ui_MainWindow, QMainWindow = loadUiType('window.ui') | ||
|
||
|
||
def f(x): | ||
return np.sin(x); | ||
|
||
|
||
class Main(QMainWindow, Ui_MainWindow): | ||
def __init__(self, ): | ||
super(Main, self).__init__() | ||
self.setupUi(self) | ||
self.fig1 = Figure() | ||
|
||
def addmpl(self, fig): | ||
def drawFig(self, fig): | ||
self.canvas = FigureCanvas(fig) | ||
self.mplvl.addWidget(self.canvas) | ||
self.canvas.draw() | ||
self.toolbar = NavigationToolbar(self.canvas, | ||
self.mplwindow, coordinates=True) | ||
self.mplvl.addWidget(self.toolbar) | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
from PyQt4 import QtGui | ||
import numpy as np | ||
def plot(self, y): | ||
plt = self.fig1.add_subplot(111) | ||
xs = np.arange(-100.0, 100.0, 0.1) | ||
plt.plot(xs, y(xs)) | ||
plt.axis([-6, 6, -1, 1]) | ||
self.drawFig(self.fig1) | ||
|
||
|
||
if __name__ == '__main__': | ||
app = QtGui.QApplication(sys.argv) | ||
main = Main() | ||
main.show() | ||
|
||
#figure example | ||
fig1 = Figure() | ||
ax1f1 = fig1.add_subplot(111) | ||
ax1f1.plot(np.random.rand(5)) | ||
main.addmpl(fig1) | ||
# figure example | ||
x = Symbol('x') | ||
y = sin(x) | ||
main.plot(lambdify(x, y.diff(x), 'numpy')) | ||
|
||
sys.exit(app.exec_()) |
Oops, something went wrong.