Giter Club home page Giter Club logo

Comments (19)

KristofferC avatar KristofferC commented on May 16, 2024

It would also be nice if you could only set the labels without plotting anything extra, for example

p = plot(rand(10))
plot!(;xlabel="label")

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Yeah this should be possible with most backends. I see you're using pyplot, so I'll handle that first.

I'll also add shorthands 'xlabel!()', etc. I should be able to do this today.

On Sep 22, 2015, at 5:01 AM, Kristoffer Carlsson [email protected] wrote:

It would also be nice if you could only set the labels without plotting anything extra, for example

p = plot(rand(10))
plot!(;xlabel="label")

Reply to this email directly or view it on GitHub.

from plots.jl.

KristofferC avatar KristofferC commented on May 16, 2024

I'm using PyPlot because I'm having some troubles with the other backends in IJulia.

For example:

image

Same with Immerse and Gadfly.

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

I'm a little confused what you're trying to do. x_mod and y_mod are not valid arguments in Plots, so I wouldn't expect this to flow through to the backends at all. Also what is matstats? Let me know how you'd like to call this, and I can either tell you the right way, or add support for it.

from plots.jl.

KristofferC avatar KristofferC commented on May 16, 2024

Sorry, I understand your confusion, I should have explained better. I am writing a package where the resulting data is a bit messy to extract from the type. To facilitate plotting of the results I therefore extend the plot function in Plots.jl with another function that take the types in my package (matstat is one of those types). This function then extracts the needed data from the type and then finally calls the Plots.jl plot-function and return that plot object

However, the problem has nothing to do with this, it is just that with certain backends like Immerse, Gadfly, Winston I get no output in IJulia.

An example which does not contain any of my own code:

image

from plots.jl.

KristofferC avatar KristofferC commented on May 16, 2024

Using for example Gadfly directly works.

image

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Ah I see, so it's just not displaying in IJulia. Ok I need to look into that... I don't actually use IJulia at all, but I know others do, so I want that to work as expected.

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Just installed IJulia, so I'll investigate further. However, does it work if you do:

using Plots
gadfly!()
plot(rand(10))
display(currentPlot())

from plots.jl.

KristofferC avatar KristofferC commented on May 16, 2024

Cool! That works beautifully for Gadfly and Immerse (Immerse opens a new window but I guess this is to expect since it has the GUI functionality).

For Winston (works with using Winston):

LoadError: MethodError: `display` has no method matching display(::Gtk.GtkCanvas, ::Winston.FramedPlot)
Closest candidates are:
  display(!Matched::AbstractString, ::Any)
  display(!Matched::TextDisplay, ::Any)
  display(!Matched::MIME{mime}, ::Any)
  ...

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Ok thanks. I'll look into Winston, but I suspect that IJulia calls a
specific "writemime" method to show its results, and my display method is
only getting called from the REPL. It should be a relatively easy fix, as
soon as I figure out the specific problem.

On Tue, Sep 22, 2015 at 11:08 AM, Kristoffer Carlsson <
[email protected]> wrote:

Cool! That works beautifully for Gadfly

For Winston (works with using Winston):

LoadError: MethodError: display has no method matching display(::Gtk.GtkCanvas, ::Winston.FramedPlot)
Closest candidates are:
display(!Matched::AbstractString, ::Any)
display(!Matched::TextDisplay, ::Any)
display(!Matched::MIME{mime}, ::Any)
...


Reply to this email directly or view it on GitHub
#27 (comment).

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

By the way, this works on the development branch, and I'll push it to master once I finish with a display/writemime re-write.

using Plots
plot(rand(10))
plot!(title="title", ylabel="ylabel")
xlabel!("xlabel")   # shorthand for plot!(xlabel="xlabel")

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Both the original labels/title request, and the IJulia display issues should all be fixed now on latest master. Please try it out.

from plots.jl.

KristofferC avatar KristofferC commented on May 16, 2024

Works great! Thanks!

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Cool! If there's anything that's not easy or intuitive, please let me
know. I want this to be the kind of package that "just works" no matter
what you throw at it.

On Wed, Sep 23, 2015 at 10:00 AM, Kristoffer Carlsson <
[email protected]> wrote:

Works great! Thanks!


Reply to this email directly or view it on GitHub
#27 (comment).

from plots.jl.

KristofferC avatar KristofferC commented on May 16, 2024

One thing, for Gadfly this works great:

image

For Pyplot I get two outputs, one that is above the Out:

image

Winston works.

Unicodeplots workish (maybe this is a limitation with the backend):

image

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Thanks... I'll look into PyPlot's double-display. As for UnicodePlots, that's more of a REPL plotting tool... I'm actually surprised it does anything even remotely good in IJulia!

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

Also one additional comment... unless you need the plot reference p somewhere later in your code, it's unnecessary. Instead of

pyplot!()
p = plot(rand(10))
plot!(p, rand(10))

you can do:

pyplot!()
plot(rand(10))
plot!(rand(10))

Plots keeps track of the "current plot" for you, and when you leave it out it will automatically update the current plot.

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

I pushed to master. The pyplot double-show issue is still there, and is not an immediately easy solution. The pyplot code is a little hacky to get it to work in IJulia, and the figure seems to be displayed at various stages of the building process, and not after the plot method returns. It works fine at the REPL, so I need to pour through Steven's code a little more to understand what he's doing for IJulia.

from plots.jl.

tbreloff avatar tbreloff commented on May 16, 2024

closing for more specific issue #29

from plots.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.