You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a strange bug in PyPlot that a println statement in a certain place in my code causes a plot to come out completely blank. Below is a stripped-down version of my code. If I include the code as is, then it makes three plots, but the third plot window is empty. However, if I comment out the println statement on l. 23, then the third plot appears as expected. This is Julia version 1.8.2, PyPlot was just installed today (2022-10-16), python version (according to Pyplot) is 3.9.12, matplotlib version (according to the error message when I type hold(true) at the REPL) is 3.5.2, and the platform is Windows 10.
module driver_ppbug
using LinearAlgebra
using PyPlot
functionadmm1(a)
n =size(a,2)
clusterID =vcat(ones(Int(n/2)),2*ones(Int(n/2)))
itcount =1return clusterID, itcount
endfunctionfind_k_largest_clusters(clusterID, k1)
returnvcat([[1,2,3,4], [5,6,7]], [[i] for i =8:length(clusterID)])
endfunctionplotresult(a, clusterID)
n =size(a,2)
colors1 ="rgbcmky"
mxcolor =length(colors1)
result =find_k_largest_clusters(clusterID, mxcolor)
println("result lens = ", [length(q) for q in result])
plotted = [falsefor i =1: n]
for i =1: mxcolor
iflength(result[i]) >1plot(a[1,result[i]], a[2,result[i]], "*"* colors1[[i]])
elsebreakend
plotted[result[i]] .=trueendplot(a[1, .!plotted], a[2, .!plotted], "."* colors1[[mxcolor]])
axis("equal")
nothingendfunctiongm_generator(n)
a =hcat(collect(1.0:1.0:n), sin.(1.0:1.0:n))'
compID =vcat(ones(Int(n/2)), 2*ones(Int(n/2)))
weight =ones(n)
return a, compID, weight
endfunctionmxgau(n, sigma, lambdascale1, lambdascale2)
a, compID, weight =gm_generator(n)
sub1 =findall(compID .==1)
sub2 =findall(compID .==2)
close("all")
figure(1)
plot(a[1,sub1], a[2,sub1], "*r")
plot(a[1,sub2], a[2,sub2], "*g")
axis("equal")
figure(2)
plot(a[1,:], a[2,:], "*k")
axis("equal")
clusterID, itcount1 =admm1(a)
figure(3)
plotresult(a, clusterID)
println("itcount1 = ", itcount1)
nothingendmxgau(20, .3, .3, .1)
end
The text was updated successfully, but these errors were encountered:
I encountered a strange bug in PyPlot that a println statement in a certain place in my code causes a plot to come out completely blank. Below is a stripped-down version of my code. If I
include
the code as is, then it makes three plots, but the third plot window is empty. However, if I comment out theprintln
statement on l. 23, then the third plot appears as expected. This is Julia version 1.8.2, PyPlot was just installed today (2022-10-16), python version (according to Pyplot) is 3.9.12, matplotlib version (according to the error message when I typehold(true)
at the REPL) is 3.5.2, and the platform is Windows 10.The text was updated successfully, but these errors were encountered: