Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Apr 15 22:57
    TradeInJulia edited #433
  • Apr 15 22:55
    TradeInJulia edited #433
  • Apr 15 22:55
    TradeInJulia edited #433
  • Apr 15 08:37
    eahenle commented #437
  • Apr 14 06:55
    Gravifer starred JuliaPlots/RecipesBase.jl
  • Apr 13 06:01
    Gravifer starred JuliaPlots/StatsPlots.jl
  • Apr 13 04:00
    kyllingstad opened #145
  • Apr 12 20:06
    eddieschoute opened #438
  • Apr 12 14:29
    dmetivie edited #437
  • Apr 12 14:27
    dmetivie opened #437
  • Apr 12 11:43
    baggepinnen opened #436
  • Apr 12 10:57
  • Apr 08 22:28
  • Apr 08 22:27
    cata0309 starred JuliaPlots/PlotDocs.jl
  • Apr 08 18:42
    mlwn-00 commented #233
  • Apr 08 17:00
    BeastyBlacksmith commented #434
  • Apr 08 15:59
    nilshg commented #434
  • Apr 08 14:54
    BeastyBlacksmith commented #233
  • Apr 08 14:52
    BeastyBlacksmith commented #434
[slack] <jling> actually, my bad, plot can handle Dict directly
[slack] <dpsanders> It can “handle” it but not in the correct order order, so the lines are random
[slack] <dpsanders> That’s why I need to sort them in the code above
[slack] <jling> oh I see, you want a line-shape instead of scatter/bars
[slack] <dpsanders> right, it works with scatter and bars
[slack] <dpsanders> but that is not plot 😉
[slack] <dpsanders> Basically we need a plot recipe for Dicts
[slack] <jling> weeeel, plot(.... st=:scatter)
[slack] <jling> but I get your point
[slack] <dpsanders> or countmap should return a special CountMap type
[slack] <jling> ah, ok

[slack] <jling> ```julia> a = SortedDict(x=>rand() for x = 1:10)
SortedDict{Any,Any,Base.Order.ForwardOrdering} with 10 entries:
1 => 0.305353
2 => 0.042019
3 => 0.507064
4 => 0.677382
5 => 0.523015
6 => 0.0424785
7 => 0.942855
8 => 0.519996
9 => 0.487269
10 => 0.328405

julia> plot(a)```

[slack] <jling> SortedDict from DataStructures.jl
[slack] <dpsanders> OK that seems like a good solution, thanks!
[slack] <jling> (looks like you can convert a Dict (generally any itr ) and it will be sorted automatically)
[slack] <mkborregaard> Hi @dpsanders no doubt Plots needs a recipe for this. Which is essentially the code you already wrote
[slack] <mkborregaard> or maybe this is easier to read than your code at the top of the thread?
ks = sort!(collect(keys(frequencies))) plot(ks, [frequencies[k] for k in ks])
[slack] <jling> I tried to find that recipe (for Dict) but failed, where are the recipe now?
[slack] <mkborregaard> yeah I also felt like there was one already
[slack] <mkborregaard> but otherwise there shudl be
[slack] <dpsanders> how would you go about finding where that was? Just @which?
[slack] <jling> no, it's really convoluted
[slack] <jling> basically I was trying to find where the code from: JuliaPlots/Plots.jl#2133 is moved to
Alberto Lusiani

hspan!() has an odd behaviour in Plots v1.6.6, instead of plotting from -Inf to +Inf over x it plots from 1 to 2. Minimum example

julia> plot(0:9)
julia> hspan!([2,3])

I am surprised to see this definition, that seems plain wrong

@recipe function f(::Type{Val{:hspan}}, x, y, z)
    n = div(length(y), 2)
    newx = repeat([1, 2, 2, 1, NaN], outer = n)
    newy = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
    linewidth --> 0
    x := newx
    y := newy
    seriestype := :shape

I think that using Inf similarly to vspan would fix this issue

@recipe function f(::Type{Val{:vspan}}, x, y, z)
    n = div(length(y), 2)
    newx = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
    newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
    linewidth --> 0
    x := newx
    y := newy
    seriestype := :shape
Greg Werner
Apologies for taking so long to respond, but after more testing, the solution was fixed by locking the Plots package to v1.5.3 and using the GR backend. The solution works well in any Plots version with one color, but only works well with 1.5.3 when using a color gradient. This is consistent regardless of whether we use Py3.7 / Py3.8 with the Conda distribution or the standard Python distribution with Ubuntu. We also tested using the standard docker build-deps Python debian-based image with no vCPU / Mem limits on a standard Ec2 Ubuntu Bionic instance with 8 cores and 32 Gb mem.
Hello there, how do I set the aspect_ratio of the axes of a 3d plot? I'm using the plotly backend
doing aspect_ratio=:equal doesn't seem to work

[slack] <rveltz> Hi,

I would like to do a isosurface in GR. So far so good but:
• how can I specify the number of levels? (levels = 3?
• how can I zoom out (I see rotation, tilt but not the radius
Thank you a lot for your help

Josef Heinen
Are you using plain GR or the gr backend in Plots?
In plain GR, you can only specify an isovalue (= threshold)
[slack] <rveltz> I am using GR
[slack] <rveltz> but how can you zoom out?
[slack] <Misha Mikhasenko> Are there any dirty hacks to put the cross of errorbar to the legend?: https://files.slack.com/files-pri/T68168MUP-F01C10U9WER/download/image.png
[slack] <Misha Mikhasenko> Are there any hacks to put the cross of errorbar to the legend with Plots/pyplot?

[slack] <nils.gudat> I guess you could scatter with a cross marker and just put it outside the bounds of the visible area? Example:

```julia> scatter(rand(10))

julia> scatter!([0],[-1], marker = :cross, label = "Standard error", ylim = (0.0,1.0), color = "black")```

[slack] <Misha Mikhasenko> good idea. althogh looks a bit different: https://files.slack.com/files-pri/T68168MUP-F01CUAVSX32/download/image.png
[slack] <Misha Mikhasenko> good idea. although looks a bit different
[slack] <Misha Mikhasenko> :+ does pretty well
[slack] <Misha Mikhasenko> It is so annoying to open the picutre in inkscape and manually modify 😩
[slack] <Misha Mikhasenko> Is there a way to change the series order in the Plot{Plots.PyPlotBackend() n=9} object?
[slack] <Misha Mikhasenko> ```p = make_myplot() # Plot{Plots.PyPlotBackend() n=9}
pp = p[1] # Subplot{1}

ERROR: Cannot convert Plots.Series to series data for plotting```

[slack] <Misha Mikhasenko> I have two plot and would like to add a line (one series) from the first plot to the lowest layer of the second plot.
p1 = make_first_plot() p2 = make_second_plot() plot(p1[1][1][:x], p1[1][1][:y], lab="model") plot!(sp=1, p2) # replace p1 plot!(sp=1, p2) # also replace p1
[slack] <loki._.> A user recipe can take arbitrary keyword arguments and process these
[slack] <nils.gudat> So should I basically have one big
@recipe function f(s::MyStruct; type = "main_results") if type == "main_results" [first type of plot] elseif type == "uncertainty" [second type of plot] end end
[slack] <nils.gudat> Seems to do the trick!
[slack] <mkborregaard> or define a seriestype
[slack] <mkborregaard> given that you are not using dispatch anyway
Grigory Starkov
Hi. I have a question about 3d plots. How do I make the ticks and labels for the 'z'-axis to be drawn on the left instead of on the right? I am trying to do it with it pyplot backend.