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
+13-5Lines changed: 13 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -52,12 +52,20 @@ 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 in the API.
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 `matplotlibl.pyplot` module is exported as `pyplot` rather than as `plt`.
61
+
* The PythonCall package 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.
62
+
55
63
### Exported functions
56
64
57
65
Only the currently documented `matplotlib.pyplot` API is exported. To use
58
66
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
67
+
as `pyplot.foo(...)`. For example, `pyplot.plot(x, y)` also works. (And
68
+
the raw `Py` object for the `matplotlib`module itself is also accessible
61
69
as `PythonPlot.matplotlib`.)
62
70
63
71
Matplotlib is somewhat inconsistent about capitalization: it has
@@ -71,8 +79,8 @@ must be used to access `matplotlib.pyplot.xcorr`
71
79
etcetera.
72
80
73
81
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`.
82
+
through `pyplot.somefunction(...)`, as is conventional in Python, you can
83
+
do `import PythonPlot as pyplot` instead of `using PythonPlot`.
76
84
77
85
### Figure objects
78
86
@@ -96,7 +104,7 @@ function (`plot` etc.) is evaluated.
96
104
However, if you use PythonPlot from a Julia script that is run non-interactively
97
105
(e.g. `julia myscript.jl`), then Matplotlib is executed in
Copy file name to clipboardExpand all lines: src/PythonPlot.jl
+38-34Lines changed: 38 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