Skip to content

Commit 487e10d

Browse files
authored
transition pyplot -> pythonplot (#330)
* transition `pyplot` -> `pythonplot` * add dep
1 parent 146aff5 commit 487e10d

File tree

12 files changed

+68
-63
lines changed

12 files changed

+68
-63
lines changed

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
3030
PlotlyKaleido = "f2990250-8cf9-495f-b13a-cce12b45703c"
3131
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
3232
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
33-
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
33+
PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9"
3434
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
3535
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
3636
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
File renamed without changes.

docs/gallery/pyplot/index.md renamed to docs/gallery/pythonplot/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# PyPlot
1+
# PythonPlot
22

3-
To switch to the `PyPlot` backend, you can use:
3+
To switch to the `PythonPlot` backend, you can use:
44

55
```julia
66
using Plots
7-
pyplot()
7+
pythonplot()
88
```
99

1010
The demos are generated from `Plots._examples`. Empty demos are features that this backend does not support.

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,15 @@ function main()
597597

598598
# initialize all backends
599599
gr()
600-
pyplot()
600+
pythonplot()
601601
plotlyjs()
602602
pgfplotsx()
603603
unicodeplots()
604604
gaston()
605605
inspectdr()
606606

607607
# NOTE: for a faster representative test build use `PLOTDOCS_BACKENDS='GR' PLOTDOCS_EXAMPLES='1'`
608-
default_backends = "GR PyPlot PlotlyJS PGFPlotsX UnicodePlots Gaston InspectDR"
608+
default_backends = "GR PythonPlot PlotlyJS PGFPlotsX UnicodePlots Gaston InspectDR"
609609
backends = get(ENV, "PLOTDOCS_BACKENDS", default_backends)
610610
backends = backends == "ALL" ? default_backends : backends
611611
@info "selected backends: $backends"

docs/src/GraphRecipes/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ graphplot(g, curves=false)
5151

5252
![](https://user-images.githubusercontent.com/8610352/74631053-de196b80-51c0-11ea-8cba-ddbdc2c6312f.png)
5353
#### Directed Graphs
54-
If you pass `graphplot` a `Graphs.DiGraph` or an asymmetric adjacency matrix, then `graphplot` will use arrows to indicate the direction of the edges. Note that using the `arrow` attribute with the `pyplot` backend will allow you to control the aesthetics of the arrows.
54+
If you pass `graphplot` a `Graphs.DiGraph` or an asymmetric adjacency matrix, then `graphplot` will use arrows to indicate the direction of the edges. Note that using the `arrow` attribute with the `pythonplot` backend will allow you to control the aesthetics of the arrows.
5555
```julia
5656
using GraphRecipes, Plots
5757
g = [0 1 1;

docs/src/backends.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ This document is meant to be a guide and introduction to make that choice.
5252

5353
# At a glance
5454

55-
My favorites: `GR` for speed, `Plotly(JS)` for interactivity, `UnicodePlots` for REPL/SSH and `PyPlot` otherwise.
56-
57-
| If you require... | then use... |
58-
| :------------------------ | :-------------------------------------- |
59-
| features | GR, PyPlot, Plotly(JS), Gaston |
60-
| speed | GR, UnicodePlots, InspectDR, Gaston |
61-
| interactivity | PyPlot, Plotly(JS), InspectDR |
62-
| beauty | GR, Plotly(JS), PGFPlots/ PGFPlotsX |
63-
| REPL plotting | UnicodePlots |
64-
| 3D plots | GR, PyPlot, Plotly(JS), Gaston |
65-
| a GUI window | GR, PyPlot, PlotlyJS, Gaston, InspectDR |
66-
| a small footprint | UnicodePlots, Plotly |
67-
| backend stability | PyPlot, Gaston |
68-
| plot+data -> `.hdf5` file | HDF5 |
55+
My favorites: `GR` for speed, `Plotly(JS)` for interactivity, `UnicodePlots` for REPL/SSH and `PythonPlot` otherwise.
56+
57+
| If you require... | then use... |
58+
| :------------------------ | :------------------------------------------ |
59+
| features | GR, PythonPlot, Plotly(JS), Gaston |
60+
| speed | GR, UnicodePlots, InspectDR, Gaston |
61+
| interactivity | PythonPlot, Plotly(JS), InspectDR |
62+
| beauty | GR, Plotly(JS), PGFPlots/ PGFPlotsX |
63+
| REPL plotting | UnicodePlots |
64+
| 3D plots | GR, PythonPlot, Plotly(JS), Gaston |
65+
| a GUI window | GR, PythonPlot, PlotlyJS, Gaston, InspectDR |
66+
| a small footprint | UnicodePlots, Plotly |
67+
| backend stability | PythonPlot, Gaston |
68+
| plot+data -> `.hdf5` file | HDF5 |
6969

7070
Of course this list is rather subjective and nothing in life is that simple. Likely there are subtle tradeoffs between backends, long hidden bugs, and more excitement. Don't be shy to try out something new !
7171

@@ -204,12 +204,12 @@ pl = scatter(
204204
)
205205
```
206206

207-
## [PyPlot](https://github.com/stevengj/PyPlot.jl)
207+
## [PythonPlot](https://github.com/stevengj/PythonPlot.jl)
208208

209-
A Julia wrapper around the popular python package `PyPlot` (Matplotlib). It uses `PyCall.jl` to pass data with minimal overhead.
209+
A Julia wrapper around the popular python package `Matplotlib`. It uses `PythonCall.jl` to pass data with minimal overhead.
210210

211211
```@example backends
212-
pyplot(); backendplot() #hide
212+
pythonplot(); backendplot() #hide
213213
```
214214

215215
Pros:
@@ -228,11 +228,11 @@ Cons:
228228
Primary author: Steven G Johnson (@stevengj)
229229

230230
### Fine tuning
231-
It is possible to use more features of `PyPlot/matplotlib` via the [`extra_kwargs`](@ref extra_kwargs) mechanism.
231+
It is possible to use more features of `matplotlib` via the [`extra_kwargs`](@ref extra_kwargs) mechanism.
232232
For example, for a 3D plot, the following example should generate a colorbar at a proper location; without the `extra_kwargs` below, the colorbar is displayed too far right to see its ticks and numbers. The four coordinates in the example below, i.e., `[0.9, 0.05, 0.05, 0.9]` specify the colorbar location `[ left, bottom, width, height ]`. Note that for 2D plots, this fine tuning is not necessary.
233233

234234
```@example backends
235-
using Plots; pyplot()
235+
using Plots; pythonplot()
236236
237237
x = y = collect(range(-π, π; length = 100))
238238
fn(x, y) = 3 * exp(-(3x^2 + y^2)/5) * (sin(x+2y))+0.1randn(1)[1]
@@ -418,7 +418,7 @@ Plots.hdf5plot_write(p, "plotsave.hdf5")
418418

419419
**Read from .hdf5 file**
420420
```julia
421-
pyplot() # Must first select some backend
421+
pythonplot() # Must first select some backend
422422
pread = Plots.hdf5plot_read("plotsave.hdf5")
423423
display(pread)
424424
```
@@ -444,6 +444,10 @@ Primary author: MA Laforge (@ma-laforge)
444444

445445
# Deprecated backends
446446

447+
### [PyPlot](https://github.com/stevengj/PyPlot.jl)
448+
449+
`matplotlib` based backend, using `PyCall.jl` and `PyPlot.jl`. Superseded by `PythonCall.jl` and `PythonPlot.jl`.
450+
Whilst still supported in `Plots 1.X`, users are advised to transition to the `pythonplot` backend.
447451

448452
### [PGFPlots](https://github.com/sisl/PGFPlots.jl)
449453

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Tap into the extensive visualization functionality enabled by the [Plots ecosyst
1818

1919
Data visualization has a complicated history. Plotting software makes trade-offs between features and simplicity, speed and beauty, and a static and dynamic interface. Some packages make a display and never change it, while others make updates in real-time.
2020

21-
Plots is a visualization interface and toolset. It sits above other backends, like GR, PyPlot, PGFPlotsX, or Plotly, connecting commands with implementation. If one backend does not support your desired features or make the right trade-offs, you can just switch to another backend with one command. No need to change your code. No need to learn a new syntax. Plots might be the last plotting package you ever learn.
21+
Plots is a visualization interface and toolset. It sits above other backends, like GR, PythonPlot, PGFPlotsX, or Plotly, connecting commands with implementation. If one backend does not support your desired features or make the right trade-offs, you can just switch to another backend with one command. No need to change your code. No need to learn a new syntax. Plots might be the last plotting package you ever learn.
2222

2323
The goals with the package are:
2424

docs/src/install.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Pkg.add("PlotlyJS"); Pkg.add("PlotlyBase")
3030
# In order to have a good experience with Jupyter, refer to Plotly-specific
3131
# Jupyter installation (https://github.com/plotly/plotly.py#installation)
3232

33-
Pkg.add("PyPlot")
34-
# Depends only on PyPlot package
33+
Pkg.add("PythonPlot")
34+
# Depends only on PythonPlot package
3535

3636
Pkg.add("UnicodePlots")
3737
```
@@ -66,7 +66,7 @@ Optionally, [choose a backend](@ref backends) and/or override default settings a
6666
gr(size = (300, 300), legend = false) # provide optional defaults
6767
pgfplotsx()
6868
plotly(ticks=:native) # plotlyjs for richer saving options
69-
pyplot() # backends are selected with lowercase names
69+
pythonplot() # backends are selected with lowercase names
7070
unicodeplots() # plot in terminal
7171
```
7272

docs/src/output.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ When not using `savefig`, the default output format depends on the environment (
6060
Note: not all backends support every output file format !
6161
A simple table showing which format is supported by which backend
6262

63-
| format | backends |
64-
| :----- | :------------------------------------------------- |
65-
| eps | inspectdr, plotlyjs, pyplot |
66-
| html | plotly, plotlyjs |
67-
| json | plotly, plotlyjs |
68-
| pdf | gr, plotlyjs, pyplot, pgfplotsx, inspectdr, gaston |
69-
| png | gr, plotlyjs, pyplot, pgfplotsx, inspectdr, gaston, unicodeplots |
70-
| ps | gr, pyplot |
71-
| svg | gr, inspectdr, pgfplotsx, plotlyjs, pyplot, gaston |
72-
| tex | pgfplotsx |
73-
| text | hdf5, unicodeplots |
63+
| format | backends |
64+
| :----- | :------------------------------------------------------------------- |
65+
| eps | inspectdr, plotlyjs, pythonplot |
66+
| html | plotly, plotlyjs |
67+
| json | plotly, plotlyjs |
68+
| pdf | gr, plotlyjs, pythonplot, pgfplotsx, inspectdr, gaston |
69+
| png | gr, plotlyjs, pythonplot, pgfplotsx, inspectdr, gaston, unicodeplots |
70+
| ps | gr, pythonplot |
71+
| svg | gr, inspectdr, pgfplotsx, plotlyjs, pythonplot, gaston |
72+
| tex | pgfplotsx |
73+
| text | hdf5, unicodeplots |
7474

7575
Supported file formats can be written to an IO stream via, for example, `png(myplot, pipebuffer::IO)`, so the image file can be passed via a PipeBuffer to other functions, eg. `Cairo.read_from_png(pipebuffer::IO)`.

docs/src/pipeline.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ x, y = range(0, 1, length = n), randn(n, 3)
2121
and we'd like to visualize `x` against each column of `y`. Here's a sample command in Plots:
2222

2323
```@example pipeline
24-
using Plots; pyplot(size = (400, 300))
24+
using Plots; pythonplot(size = (400, 300))
2525
plot(
2626
x, y,
2727
line = (0.5, [4 1 0], [:path :scatter :histogram]),
@@ -40,21 +40,21 @@ In this example, we have an input matrix, and we'd like to plot three series on
4040
We create a row vector (1x3 matrix) of symbols to assign different visualization types for each series, set the orientation of the histogram, and set
4141
alpha values.
4242

43-
For comparison's sake, this is somewhat similar to the following calls in PyPlot:
43+
For comparison's sake, this is somewhat similar to the following calls in PythonPlot:
4444

4545
```@example pipeline
46-
import PyPlot
47-
fig = PyPlot.gcf()
46+
import PythonPlot
47+
fig = PythonPlot.gcf()
4848
fig.set_size_inches(4, 3, forward = true)
4949
fig.set_dpi(100)
50-
PyPlot.clf()
50+
PythonPlot.clf()
5151
5252
n = 100
5353
x, y = range(0, 1, length = n), randn(n, 3)
5454
55-
PyPlot.plot(x, y[:,1], alpha = 0.5, "steelblue", linewidth = 4)
56-
PyPlot.scatter(x, y[:,2], alpha = 0.5, marker = "+", s = 100, c="orangered")
57-
PyPlot.plt.hist(
55+
PythonPlot.plot(x, y[:,1], alpha = 0.5, "steelblue", linewidth = 4)
56+
PythonPlot.scatter(x, y[:,2], alpha = 0.5, marker = "+", s = 100, c="orangered")
57+
PythonPlot.hist(
5858
y[:,3],
5959
orientation = "horizontal",
6060
alpha = 0.5,
@@ -64,14 +64,15 @@ PyPlot.plt.hist(
6464
linewidth = 0
6565
)
6666
67-
ax = PyPlot.gca()
67+
ax = PythonPlot.gca()
6868
ax.xaxis.grid(true)
6969
ax.yaxis.grid(true)
70-
PyPlot.title("My title")
71-
PyPlot.legend(["y1","y2"])
72-
PyPlot.savefig("pyplot.svg"); nothing # hide
70+
PythonPlot.title("My title")
71+
PythonPlot.legend(["y1","y2"])
72+
PythonPlot.savefig("pythonplot.svg")
73+
nothing #hide
7374
```
74-
![](pyplot.svg)
75+
![](pythonplot.svg)
7576

7677
---
7778

0 commit comments

Comments
 (0)