Skip to content

Commit e6d0128

Browse files
committed
better names pltshow -> plotshow, etc.
1 parent 88650b5 commit e6d0128

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ version number is returned by `PythonPlot.version`.
5656

5757
Compared to the PyPlot.jl package, there are a few differences in the API.
5858

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.)
59+
* To avoid type piracy, the functions `show`, `close`, `step`, and `fill` are renamed to `plotshow`, `plotclose`, `plotstep`, and `plotfill`, respectively. (You can also access them as `PythonPlot.show` etcetera.)
6060
* The `matplotlibl.pyplot` module is exported as `pyplot` rather than as `plt`.
6161
* 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.
6262

@@ -104,7 +104,7 @@ function (`plot` etc.) is evaluated.
104104
However, if you use PythonPlot from a Julia script that is run non-interactively
105105
(e.g. `julia myscript.jl`), then Matplotlib is executed in
106106
[non-interactive mode](http://matplotlib.org/faq/usage_faq.html#what-is-interactive-mode):
107-
a plot window is not opened until you run `pyshow()` (equivalent to `pyplot.show()`
107+
a plot window is not opened until you run `plotshow()` (equivalent to `pyplot.show()`
108108
in the Python examples).
109109

110110
## Interactive versus Julia graphics

src/PythonPlot.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For more information on API, see the matplotlib.pyplot documentation and the Pyt
1616
module PythonPlot
1717

1818
using PythonCall
19-
export Figure, matplotlib, pyplot, pygui, withfig, pltshow, pltstep, pltclose
19+
export Figure, matplotlib, pyplot, pygui, withfig, plotshow, plotstep, plotclose
2020

2121
###########################################################################
2222
# Define a documentation object
@@ -183,24 +183,24 @@ for f in plt_funcs
183183
end
184184

185185
# rename to avoid type piracy:
186-
@doc LazyHelp(pyplot,"step") pltstep(x, y; kws...) = pycall(pyplot.step, x, y; kws...)
186+
@doc LazyHelp(pyplot,"step") plotstep(x, y; kws...) = pycall(pyplot.step, x, y; kws...)
187187

188188
# rename to avoid type piracy:
189-
pltshow(; kws...) = begin pycall(pyplot.show; kws...); nothing; end
189+
plotshow(; kws...) = begin pycall(pyplot.show; kws...); nothing; end
190190

191-
Base.close(f::Figure) = pltclose(f)
191+
Base.close(f::Figure) = plotclose(f)
192192

193193
# rename to avoid type piracy:
194-
@doc LazyHelp(pyplot,"close") pltclose() = pyplot.close()
195-
pltclose(f::Figure) = pyconvert(Int, pltclose(f.number))
196-
function pltclose(f::Integer)
194+
@doc LazyHelp(pyplot,"close") plotclose() = pyplot.close()
195+
plotclose(f::Figure) = pyconvert(Int, plotclose(f.number))
196+
function plotclose(f::Integer)
197197
pop!(withfig_fignums, f, f)
198198
pyplot.close(f)
199199
end
200-
pltclose(f::AbstractString) = pyplot.close(f)
200+
plotclose(f::AbstractString) = pyplot.close(f)
201201

202202
# rename to avoid type piracy:
203-
@doc LazyHelp(pyplot,"fill") pltfill(x::AbstractArray,y::AbstractArray, args...; kws...) =
203+
@doc LazyHelp(pyplot,"fill") plotfill(x::AbstractArray,y::AbstractArray, args...; kws...) =
204204
pycall(pyplot.fill, PyAny, x, y, args...; kws...)
205205

206206
# consistent capitalization with mplot3d
@@ -209,10 +209,10 @@ pltclose(f::AbstractString) = pyplot.close(f)
209209
# allow them to be accessed via their original names foo
210210
# as PythonPlot.foo … this also means that we must be careful
211211
# to use them as Base.foo in this module as needed!
212-
const close = pltclose
213-
const fill = pltfill
214-
const show = pltshow
215-
const step = pltstep
212+
const close = plotclose
213+
const fill = plotfill
214+
const show = plotshow
215+
const step = plotstep
216216

217217
include("colormaps.jl")
218218

@@ -291,7 +291,7 @@ function withfig(actions::Function, f::Figure; clear=true)
291291
ax_save = gca()
292292
push!(withfig_fignums, f.number)
293293
figure(f.number)
294-
finalizer(pltclose, f)
294+
finalizer(plotclose, f)
295295
try
296296
if clear && !isempty(f)
297297
clf()

0 commit comments

Comments
 (0)