-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
showvalues display multi-line string incorrectly #224
Comments
I second this behavior I am struggling with the same thing right now, because I want to use
Moreover, the color does not pass through. Is there a way to let the colored output stay as it way instead of making the whole plot blue ? |
Yeah. I found the problem while trying to use UnicodePlots (which output figure as strings with "\n"). It would be a fascinating feature if we can plot under progress bars! |
The problem is definitely in the ProgressMeter.jl/src/ProgressMeter.jl Lines 584 to 607 in 5826a75
This function turns every value passed in It should instead pass objects in the dictionary to the printing functions, which knows better how they should be printed (including colors in UnicodePlots for example). However, the computation of the number of lines should be completely reworked, and I must admit i do not have the knowledge to do it myself. Ok I got something. The follwoing scheme should work to rpovide the right number of lines :
Then, the current behavior is that It should, for each (name,value) pair in showvalues, move back a certain number of lines coresponding to the previous calculations before passing the value itself (and not Hopefully, this should work correctly. I'll implement it and try a PR when i have some time. |
It looks like UnicodePlots now works well with ProgressMeter: using ProgressMeter
using UnicodePlots
n = 20
xs = Float64[]
p = Progress(n)
for iter = 1:n
append!(xs, rand())
sleep(0.5)
plot = lineplot(xs)
str = "\n" * string(plot; color=true) # use ANSI color codes and prepend newline
ProgressMeter.next!(p; showvalues = [(:UnicodePlot, str)])
end However I couldn't get the
This is fixed in the code above by using UnicodePlots' |
I have an idea: replace A better example:
Maybe this could be integrated in |
Output:
Need to detect the number of lines contained in string?
The text was updated successfully, but these errors were encountered: