Plots.jl: Prevent breakage on Pkg.update for Plots 0.7

Created on 9 Jun 2016  ·  29Comments  ·  Source: JuliaPlots/Plots.jl

Ref: https://github.com/JuliaLang/METADATA.jl/pull/5347

To ensure there is minimal breakage on a Pkg.update call after tagging Plots 0.7, I should verify that any packages which depend on Plots pass their tests (if the failures are Plots-specific) and add an upper bound to METADATA until those packages switch to the new RecipesBase paradigm.

@tkelman is it correct (in the METADATA.jl REQUIRE file) that a line like Plots should become Plots 0.0.1 0.7.0 and Plots 0.4 should be Plots 0.4 0.7.0 for anything that breaks?

Check for breakage and update METADATA:

  • [x] ApproxFun (tests pass...doing nothing)
  • [x] AverageShiftedHistograms (tests fail, but Plots was taken out of require as of v0.4.0...doing nothing)
  • [x] ControlSystems (tests pass...doing nothing)
  • [x] DifferentialEquations (tests pass...doing nothing)
  • [x] EEG (tests fail... added upper bound to EEG 0.0.3)
  • [x] ExperimentalAnalysis (tests fail... added upper bound to ExperimentalAnalysis 0.0.2)
  • [x] ImplicitEquations (tests fail with UndefVarError: PyPlotPackage not defined which means that this package was likely broken long before Plots 0.7... I changed it Plots 0.5 --> Plots 0.5.0 0.5.1)
  • [x] Robotlib (tests fail with ArgumentError: Debug not found in path... doing nothing)
  • [x] SymPy (tests pass...doing nothing)

Move to RecipesBase and re-tag

  • [ ] ApproxFun
  • [ ] AverageShiftedHistograms
  • [ ] OnlineStats
  • [ ] ControlSystems
  • [ ] DifferentialEquations
  • [ ] EEG
  • [ ] ExperimentalAnalysis
  • [ ] ImplicitEquations
  • [ ] Robotlib
  • [ ] SymPy

Most helpful comment

Soon. Today?

On Monday, June 27, 2016, Mattias Fält [email protected] wrote:

I got my code working on your dev branch, when do you plan to push it to
master and add an release so I can get our package working properly again?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/311#issuecomment-228717060,
or mute the thread
https://github.com/notifications/unsubscribe/AA492kLqlYT7bmCwB_7iY4E-fAdlbMdzks5qP69tgaJpZM4Ix-D8
.

All 29 comments

the patch version isn't strictly required, so Plots 0.0 0.7 would work too but yes your understanding is correct

See the updated comment above. I added upper bounds to 3 of the packages and added them to the METADATA PR. @tkelman do you think it's merge-ready?

Here's the full test output: https://gist.github.com/tbreloff/c93d9ebd34b23a27749bd30950e0f30e

the upper bound should go on all past versions (that have a Plots requirement) in the broken cases

@tkelman done... just needed an additional one for EEG 0.0.1

Great! Thanks for taking the time to test this, it's a nice courtesy to your dependents for now until we get people using upper bounds of their own volition more often

Thank you! Your METADATA support effort is true dedication to the language. :+1:

For those package maintainers on this list... I'll open an issue with each repo to work on updating (and likely vastly simplifying) your plotting code.

cc: @dlfivefifty @joshday @mfalt @jcrist @ChrisRackauckas @codles @baggepinnen @jverzani

And if you have a package which needs to be updated that's not on this list, please let me know so I can add a checkbox for it.

I have: https://github.com/jverzani/SymPy.jl/issues/73 Thanks for any help!

Thanks for the notification. I actually had my tests checking out master because it needed all the cool new stuff. I took that all out and the tests should pass. Thanks for tagging this: I think users will find it easier to have the plotting "just work" instead of having old version issues.

FYI my plot recipes are here. Could you take a quick look and give some suggests on how to tighten them up? The only real monster is the animation command: is it possible to do something like an animation recipe?

Thanks for all the hard work. The recipes are a great idea and vastly simplified the code.

@ChrisRackauckas I was looking at that code before. I don't think I have a great understanding of what you're trying to accomplish (and why you can't wrap it in a @animate or @gif macro). Can you try to describe as simply as possible what you're trying to accomplish? (maybe start an issue in your repo to continue this discussion?)

It's quite a hack solution to get something working. Opened an issue explaining it a bit at ChrisRackauckas/DifferentialEquations.jl#4.

I can update AverageShiftedHistograms and OnlineStats (which you could add to the list). Neither of them currently include tests for plotting, so updating Plots won't break their tests. Thanks for all this cool stuff you're working on 👍 .

Great @joshday... let me know if you need help with it.

I've switched my packages from Requires to RecipesBase. AverageShiftedHistograms has new version in METADATA, pull request for new version OnlineStats release is pending.

That's great Josh. Do you need that RecipesBase commit to be tagged? (using
vs import)

On Saturday, June 11, 2016, Josh Day [email protected] wrote:

I've switched my packages from Requires to RecipesBase.
AverageShiftedHistograms has new version in METADATA, pull request for new
version OnlineStats release is pending.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/311#issuecomment-225405567,
or mute the thread
https://github.com/notifications/unsubscribe/AA492qYltXvaLi-th3wLuIGkd24i_aAnks5qK2v0gaJpZM4Ix-D8
.

Ah, I forgot I checked out RecipesBase. It won't break tests at least. I don't think there's any hurry. I removed a lot of the plotting framework that was in OnlineStats with the plan to add more elegant implementations in the near future.

Thanks for the heads up. I wont have time to work on this for a few weeks, Ill ping you when Im updating. Appreciate all your work.

I'm working on making ControlSystems pass the tests. We were using a lot of subplots (in particular updating them one by one) so its quite a bit of work (although I think your changes look good). I have a few issues but I'm not sure if they are bugs or design choices so I will post them here:
Setting a label on a subplot

plt = plot(layout(2,1))
plot!(plt, title="test", subplot=1)

sets the same label on all subplots (I know the work-around for this). And

plt = plot(layout(2,1))
plot!(plt, rand(10), subplot=2)
plot!(plt, yscale=:log10, subplot=1)

sets both scales to log10 (I know no work-around for this), I assume that there are several similar bugs/features. I'm using PyPlot for testing on julia 0.4.2 with Plots 0.7.2.

Subplots: check out dev branch and try again?

Can you link to your code? I can let you know if it's how I would approach
the solution.

On Monday, June 20, 2016, Mattias Fält [email protected] wrote:

I'm working on making ControlSystems pass the tests. We were using a lot
of subplots (in particular updating them one by one) so its quite a bit of
work (although I think your changes look good). I have a few issues but I'm
not sure if they are bugs or design choices so I will post them here:
Setting a label on a subplot

plt = plot(layout(2,1))plot!(plt, title="test", subplot=1)

sets the same label on all subplots (I know the work-around for this). And

plt = plot(layout(2,1))plot!(plt, rand(10), subplot=2)plot!(plt, yscale=:log10, subplot=1)

sets both scales to log10 (I know no work-around for this), I assume that
there are several similar bugs/features. I'm using PyPlot for testing on
julia 0.4.2 with Plots 0.7.2.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/311#issuecomment-227268911,
or mute the thread
https://github.com/notifications/unsubscribe/AA492r73rawyt90e6CLhdZkypjM1p-Xaks5qNwA3gaJpZM4Ix-D8
.

Sure, the plotting is done here:
https://github.com/JuliaControl/ControlSystems.jl/blob/master/src/plotting.jl
We might try some approach with RecipiesBase later, but that would probably require restructuring a few things to a more functional programming style, and the plotting is currently not the main focus.
My current approach is to change all the
plot!(fig[i,j],...) to something on the form of plot!(fig,...,sub2ind((ni,nj),j,i))
but it seems that this wasn't enough with the subplots issues above, I will try the dev branch.

Ok I see you have a lot of code there! These can most likely be much cleaner as recipes, though you should do whatever is easiest for you in the short term. If you give me a full example with expected output, I can help re-code it so you can see the approach.

That would be great, the problem as I see it is that what is plotted is not just a result of the object, but also which kind of visualization is wanted. But I have not looked that much into RecipiesBase, so I'm not sure what capabilities it has. One of our testing examples with reference images (the don't need to be identical), can be generated like this.

using ControlSystems
Plots.pyplot()
tf1 = tf([1],[1,1])
tf2 = tf([1/5,2],[1,1,1])
sys = [tf1 tf2]
ws = logspace(-2,2,200)
setPlotScale("dB")
bodeplot(sys,ws) #reference bode
marginplot([tf1, tf2], ws) #reference margin

The reference images are bode and margin.
The setPlotScale is probably a bad work around, but we want the user to be able to set a default. (And the bottom legends are wrong).

I got my code working on your dev branch, when do you plan to push it to master and add an release so I can get our package working properly again?

Soon. Today?

On Monday, June 27, 2016, Mattias Fält [email protected] wrote:

I got my code working on your dev branch, when do you plan to push it to
master and add an release so I can get our package working properly again?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/311#issuecomment-228717060,
or mute the thread
https://github.com/notifications/unsubscribe/AA492kLqlYT7bmCwB_7iY4E-fAdlbMdzks5qP69tgaJpZM4Ix-D8
.

I'm working on updating some plotting code as well. Currently, I'm missing a syntax for what previously looked like

fig = subplot(n=9,nc=3)
plot!(fig[2,3], randn(10))

The following work

fig = plot(layout=(3,3))
plot!(randn(10), subplot=6)

but it would be convenient to be able to access subplots with their x,y-coordinates like

fig = plot(layout=(3,3))
plot!(randn(10), subplot=(2,3))

Have I missed some syntax or is it not supported (yet)?

Thanks!

I've been thinking it would be nice to be able to do:

sp = plt.subplots[2]
plot!(sp, rand(10))

which is an alternative to the subplot arg. I'm on the fence whether plt[2] should return the 2nd Subplot or the 2nd Series. (Right now it actually returns a (x,y) tuple of the 2nd series). I can be convinced either way. I lean towards:

# plt is a Plot
plt[2] # 2nd subplot, same as plt.subplots[2]
plt[2,1] # if layout is grid, grab the subplot in position (2,1), error otherwise
plt[:size] # return the attribute value for size

# sp is a Subplot
sp[2] # the 2nd series of this subplot
sp[:title] # return the attribute value for title

would be convenient to be able to access subplots with their x,y-coordinates like

But wouldn't always give what you want, as layouts can be complex, recursive structures. I could support a tuple for some simple cases, and error otherwise I suppose. (if you want this, please open a separate issue)

The syntax

# plt is a Plot
plt[2] # 2nd subplot, same as plt.subplots[2]
plt[2,1] # if layout is grid, grab the subplot in position (2,1), error otherwise

# sp is a Subplot
sp[2] # the 2nd series of this subplot
sp[:title] # return the attribute value for title

seems very reasonable to me and your description fits well with what I would expect the behavior to be (maybe I'm biased due to the old syntax being plot!(plt[2,1] ,...))
Whether the syntax is plot!(randn(10), subplot=(2,3)) or plot!(fig[2,3], randn(10)) does not matter much to me, as long as there is an easy way to access plots in a grid layout.

To be able to access, and modify/delete individual series in a plot/subplot would also be nice. Your suggested syntax once again seems reasonable to me. The reason I would like to modify/delete series is for updating a plot as e.g. some optimization problem progresses.

To be able to access, and modify/delete individual series in a plot/subplot would also be nice.

Agreed... deleting has been on my list for way too long: https://github.com/tbreloff/Plots.jl/issues/47

Closing. If anyone wants help with converting to recipes, please open an issue in your respective packages or come ask questions on gitter

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kersulis picture kersulis  ·  5Comments

SebastianM-C picture SebastianM-C  ·  4Comments

Cody-G picture Cody-G  ·  3Comments

kleinschmidt picture kleinschmidt  ·  3Comments

asinghvi17 picture asinghvi17  ·  3Comments