Skip to content

Commit b5f4d36

Browse files
authored
Fix 3d subplot overwriting (#548)
* update CI * fix 3d subplot overwriting
1 parent 52ff225 commit b5f4d36

File tree

5 files changed

+55
-67
lines changed

5 files changed

+55
-67
lines changed

.github/workflows/CI.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
tags: '*'
8+
jobs:
9+
test:
10+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
version:
16+
- '1.0'
17+
- '1'
18+
# - 'nightly'
19+
os:
20+
- ubuntu-latest
21+
- macOS-latest
22+
- windows-latest
23+
arch:
24+
- x64
25+
steps:
26+
- uses: actions/checkout@v2
27+
- uses: julia-actions/setup-julia@v1
28+
with:
29+
version: ${{ matrix.version }}
30+
arch: ${{ matrix.arch }}
31+
- uses: actions/cache@v1
32+
env:
33+
cache-name: cache-artifacts
34+
with:
35+
path: ~/.julia/artifacts
36+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
37+
restore-keys: |
38+
${{ runner.os }}-test-${{ env.cache-name }}-
39+
${{ runner.os }}-test-
40+
${{ runner.os }}-
41+
- uses: julia-actions/julia-buildpkg@v1
42+
- uses: julia-actions/julia-runtest@v1
43+
- uses: julia-actions/julia-processcoverage@v1
44+
- uses: codecov/codecov-action@v1
45+
with:
46+
file: lcov.info

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[![Build Status](https://travis-ci.org/JuliaPy/PyPlot.jl.svg?branch=master)](https://travis-ci.org/JuliaPy/PyPlot.jl)
2-
[![Build status](https://ci.appveyor.com/api/projects/status/github/JuliaPy/PyPlot.jl?branch=master)](https://ci.appveyor.com/project/StevenGJohnson/pyplot-jl/branch/master)
1+
[![CI](https://github.com/JuliaPy/PyPlot.jl/workflows/CI/badge.svg)](https://github.com/JuliaPy/PyPlot.jl/actions?query=workflow%3ACI)
32

43
# The PyPlot module for Julia
54

@@ -9,7 +8,7 @@ specifically to the `matplotlib.pyplot` module.
98

109
PyPlot uses the Julia [PyCall](https://github.com/stevengj/PyCall.jl)
1110
package to call Matplotlib directly from Julia with little or no
12-
overhead (arrays are passed without making a copy).
11+
overhead (arrays are passed without making a copy). (See also [PythonPlot.jl](https://github.com/stevengj/PythonPlot.jl) for a version of PyPlot.jl using the alternative [PythonCall.jl](https://github.com/cjdoris/PythonCall.jl) package.)
1312

1413
This package takes advantage of Julia's [multimedia
1514
I/O](https://docs.julialang.org/en/latest/base/io-network/#Multimedia-I/O-1)

appveyor.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/plot3d.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@ const mplot3d_funcs = (:bar3d, :contour3D, :contourf3D, :plot3D, :plot_surface,
5454
:plot_trisurf, :plot_wireframe, :scatter3D,
5555
:text2D, :text3D, :view_init, :voxels)
5656

57+
function gca3d()
58+
using3D() # make sure mplot3d is loaded
59+
return PyPlot.version <= v"3.4" ? gca(projection="3d") : plt."subplot"(gca()."get_subplotspec"(), projection="3d")
60+
end
61+
5762
for f in mplot3d_funcs
5863
fs = string(f)
5964
@eval @doc LazyHelp(axes3D,"Axes3D", $fs) function $f(args...; kws...)
60-
using3D() # make sure mplot3d is loaded
61-
ax = PyPlot.version <= v"3.4" ? gca(projection="3d") : plt."subplot"(projection="3d")
62-
pycall(ax.$fs, PyAny, args...; kws...)
65+
pycall(gca3d().$fs, PyAny, args...; kws...)
6366
end
6467
end
6568

@@ -73,9 +76,7 @@ const zlabel_funcs = (:zlabel, :zlim, :zscale, :zticks)
7376
for f in zlabel_funcs
7477
fs = string("set_", f)
7578
@eval @doc LazyHelp(axes3D,"Axes3D", $fs) function $f(args...; kws...)
76-
using3D() # make sure mplot3d is loaded
77-
ax = PyPlot.version <= v"3.4" ? gca(projection="3d") : plt."subplot"(projection="3d")
78-
pycall(ax.$fs, PyAny, args...; kws...)
79+
pycall(gca3d().$fs, PyAny, args...; kws...)
7980
end
8081
end
8182

0 commit comments

Comments
 (0)