Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 12 19:14

    github-actions[bot] on v0.14.21

    (compare)

  • May 12 18:33
    JuliaTagBot commented #395
  • May 12 18:12
    JuliaRegistrator commented on bd6d89c
  • May 12 18:12
    BeastyBlacksmith commented on bd6d89c
  • May 12 18:12

    BeastyBlacksmith on master

    0.14.21 (compare)

  • May 12 17:48

    BeastyBlacksmith on new_version

    (compare)

  • May 12 17:48

    BeastyBlacksmith on new_version

    CompatHelper: bump compat for "… (compare)

  • May 12 17:48

    BeastyBlacksmith on new_version

    (compare)

  • May 12 17:48

    BeastyBlacksmith on master

    CompatHelper: bump compat for "… (compare)

  • May 12 17:48
    BeastyBlacksmith closed #445
  • May 11 19:27
    BeastyBlacksmith opened #236
  • May 11 19:27

    BeastyBlacksmith on input

    Update input_data.md closes ht… (compare)

  • May 11 18:43

    BeastyBlacksmith on master

    Update README.md [skip ci] (compare)

  • May 06 13:27

    SimonDanisch on new_version

    (compare)

  • May 06 13:27

    SimonDanisch on master

    CompatHelper: bump compat for "… Merge pull request #427 from Ju… (compare)

  • May 06 13:27
    SimonDanisch closed #427
  • May 06 13:27
    SimonDanisch commented #427
  • May 06 06:46
  • May 05 22:14
  • May 05 13:05
    SimonDanisch commented #427
Greg Werner
@jgwerner
for example, for the code below execution time is 55s:
## Plots with several of colors

using DelimitedFiles
using Plots
default(fmt = :png)

pointcloud = readdlm("data/question_image.csv",',');

# The x and y coordinates for the first 2 rows of the data an can be extracted from the array separately
point_data = pointcloud[1:2,:];

# The intensity data of the pointcloud forms the last row, and can be saved separately
color_data = pointcloud[3,:];

# Plot the 2D point cloud data with intensity values!
start = time()
plot(point_data[1,:], point_data[2,:], seriestype = :scatter, markersize = 0.1, 
    markerstrokewidth = 0, dpi = 150, markercolor  = cgrad(:rainbow, rev = true), 
    marker_z = color_data, legend = false)
display(plot!())
elapsed = time() - start
display(elapsed)
Greg Werner
@jgwerner
with one color, it's faster, but 8s still seems kind of slow:
using DelimitedFiles
using Plots
default(fmt = :png)

start = time()
# Your code starts here
points = readdlm("data/question_image.csv",',');

scatter(points[1,:],points[2,:],markersize = 0.1,legend = false)
display(plot!())
elapsed = time()-start
display(elapsed)
display(size(points))
BridgingBot
@GitterIRCbot
[slack] <jling> one (first) time is expected to be slow, no?
Greg Werner
@jgwerner
its consistently slow even after the first run
BridgingBot
@GitterIRCbot
[slack] <jling> do you mean like first run with julia script.jl and then do it again?
BridgingBot
@GitterIRCbot
[slack] <mkborregaard> most likely. using plots in scripts is not a good workflow
Josef Heinen
@jheinen
Could you provide one of your data sets or a MWE?
BridgingBot
@GitterIRCbot
[slack] <dpsanders> ArgumentError: At least one finite value must be provided to formatter. This happens whenever there is a 0 on a log scale. What is the correct solution for this? Right now I have plot(replace(ys, 0 => NaN), but that seems ugly and boilerplate-y
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