Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
BridgingBot
@GitterIRCbot
[slack] <jling> use ylims=(1e-3,Inf) or something like that
BridgingBot
@GitterIRCbot
[slack] <dpsanders> Is there a way of having transparent text in an annotate!? E.g. alpha=0.5?
BridgingBot
@GitterIRCbot
[slack] <jling> use text("hi", color=RGBA{Float64}(0.5,0.5,0.5,0.5) for annotate!
[slack] <jling> color as a kwarg is passed to font
[slack] <jling> which will accept RBGA (colorant) type
[slack] <jling> if you have a name for colorant, do something like coloralpha(colorant"grey", 0.34)
BridgingBot
@GitterIRCbot
[slack] <dpsanders> perfect, thanks!
Pascal Müller
@pascal-mueller

hi if I have something like

p1 = getPlotOne()
p2 = getPlotTwo()

How do I get two windows? One for p1 and one for p2? Or maybe just show p1, wait until the window gets closed and then show p2?

BridgingBot
@GitterIRCbot
[slack] <dpsanders> What’s the correct way to plot a dictionary of frequencies?
[slack] <dpsanders> Such that I can use plot and the lines will look right.
[slack] <jling> do you mean like a dictionary with freq => intensity and you want to plot intensity like bars with x at freq?
BridgingBot
@GitterIRCbot
[slack] <dpsanders> yes
[slack] <dpsanders> well I mean value => frequency
[slack] <dpsanders> as in 1 => 17 if the number 1 occurs 17 times

[slack] <dpsanders> You can do

     ks = collect(keys(frequencies))
     vs = collect(values(frequencies))

     p = sortperm(ks)

     plot(ks[p], vs[p], m=:o)
 end

but that is… pretty complicated

[slack] <jling> I don't see a good way, but you can just loop over pairs and bar! maybe
BridgingBot
@GitterIRCbot
[slack] <jling> incidentally, if your Dict was a histogram, you can plot that directly 😉
[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
BridgingBot
@GitterIRCbot
[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!
BridgingBot
@GitterIRCbot
[slack] <jling> (looks like you can convert a Dict (generally any itr ) and it will be sorted automatically)
BridgingBot
@GitterIRCbot
[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
@alusiani

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
    ()
end

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
    ()
end
Greg Werner
@jgwerner
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.
Frederico
@sunbubble
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
BridgingBot
@GitterIRCbot

[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
@jheinen
Are you using plain GR or the gr backend in Plots?
In plain GR, you can only specify an isovalue (= threshold)
BridgingBot
@GitterIRCbot
[slack] <rveltz> I am using GR
[slack] <rveltz> but how can you zoom out?