You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-5Lines changed: 12 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -52,12 +52,19 @@ see the [matplotlib.pyplot documentation for more
52
52
information](http://matplotlib.org/api/pyplot_api.html). The Matplotlib
53
53
version number is returned by `PythonPlot.version`.
54
54
55
+
### Differences from PyPlot
56
+
57
+
Compared to the PyPlot package, there are a few differences.
58
+
59
+
* To avoid type piracy, the functions `show`, `close`, `step`, and `fill` are renamed to `pltshow`, `pltclose`, `pltstep`, and `pltfill`, respectively. (You can also access them as `PythonPlot.show` etcetera.)
60
+
* The PythonCall performs many fewer automatic conversions from Python types to Julia types (in comparison to PyCall). If you need to convert Matplotlib return values to native Julia objects, you'll need to do `using PythonCall` and call its `pyconvert(T, o)` or other conversion functions.
61
+
55
62
### Exported functions
56
63
57
64
Only the currently documented `matplotlib.pyplot` API is exported. To use
58
65
other functions in the module, you can also call `matplotlib.pyplot.foo(...)`
59
-
as `plt.foo(...)`. For example, `plt.plot(x, y)` also works. (And
60
-
the raw `Py` object for the `matplotlib`modules is also accessible
66
+
as `pyplot.foo(...)`. For example, `pyplot.plot(x, y)` also works. (And
67
+
the raw `Py` object for the `matplotlib`module itself is also accessible
61
68
as `PythonPlot.matplotlib`.)
62
69
63
70
Matplotlib is somewhat inconsistent about capitalization: it has
@@ -71,8 +78,8 @@ must be used to access `matplotlib.pyplot.xcorr`
71
78
etcetera.
72
79
73
80
If you wish to access *all* of the PyPlot functions exclusively
74
-
through `plt.somefunction(...)`, as is conventional in Python, you can
75
-
do `import PythonPlot as plt` instead of `using PythonPlot`.
81
+
through `pyplot.somefunction(...)`, as is conventional in Python, you can
82
+
do `import PythonPlot as pyplot` instead of `using PythonPlot`.
76
83
77
84
### Figure objects
78
85
@@ -96,7 +103,7 @@ function (`plot` etc.) is evaluated.
96
103
However, if you use PythonPlot from a Julia script that is run non-interactively
97
104
(e.g. `julia myscript.jl`), then Matplotlib is executed in
Copy file name to clipboardExpand all lines: src/PythonPlot.jl
+39-34Lines changed: 39 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,6 @@
2
2
"""
3
3
PythonPlot allows Julia to interface with the Matplotlib library in Python, specifically the matplotlib.pyplot module, so you can create beautiful plots in Julia with your favorite Python package.
4
4
5
-
Only the currently documented matplotlib.pyplot API is exported. To use other functions in the module, you can also call matplotlib.pyplot.foo(...) as plt.foo(...).
6
-
For example, plt.plot(x, y) also works. (And the raw Py object for the matplotlib modules is also accessible as PythonPlot.matplotlib.)
7
-
8
5
In general, all the arguments are the same as in Python.
9
6
10
7
Here's a brief demo of a simple plot in Julia:
@@ -19,8 +16,7 @@ For more information on API, see the matplotlib.pyplot documentation and the Pyt
0 commit comments