question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Height cannot be exactly configured

See original GitHub issue

Though there is a height parameter for the plotting function, this only roughly controls the height. It would be nicer to be able to exactly set the height. This is even more of an issue because the height isn’t always off of the requested height by the same value, so it’s not trivial to correct for this. Here are a couple of examples:

Requested height: 9; actual height: 10

$ pplot 1 10 --height 9
   10.00  ┤╭ 
    9.00  ┤│ 
    8.00  ┤│ 
    7.00  ┤│ 
    6.00  ┤│ 
    5.00  ┤│ 
    4.00  ┤│ 
    3.00  ┤│ 
    2.00  ┤│ 
    1.00  ┼╯ 

Requested height: 8; actual height: 10

$ pplot 1 10 --height 8
   10.00  ┼╭ 
    9.00  ┤│ 
    8.00  ┤│ 
    7.00  ┤│ 
    6.00  ┤│ 
    5.00  ┤│ 
    4.00  ┤│ 
    3.00  ┤│ 
    2.00  ┤╯ 
    1.00  ┼  

The issue is with the floor and ceil operators that are used in computing the actual number of rows.

Here’s a quick fix for this in the Python version:

    target_height = cfg['height'] if 'height' in cfg else interval
    actual_height = float("inf")

    i = 0
    while actual_height > target_height:
        ratio = (target_height - i) / interval
        min2 = floor(minimum * ratio)
        max2 = ceil(maximum * ratio)
        actual_height = max2 - min2 + 1
        i += 1

    assert actual_height == target_height

I just keep decreasing the height value used by 1 until the actual height matches the target height. This has always given me an actual height that’s exactly the target height in the quick tests I’ve done, but there’s probably a better way to do this. I also considered decreasing max2 or increasing min2 by 1 directly, but then we’d also need to set a new value for ratio, at least to keep the current behavior, and I’m not sure what the appropriate way to do that would be.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kroitorcommented, Nov 5, 2019

@hartwork it’s been a bit of a delay due to my other work, but i’ll do my best to resolve this in the near future.

1reaction
hartworkcommented, Nov 5, 2019

It looks like the last action and comment on #29 is from July. Would be great to get that fixed. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - ttk.Treeview - Can't change row height - Stack Overflow
@TerryJanReedy I have a project with 3 different treeviews, and I have tried to use : style = ttk.Style(root) style.configure('Treeview', rowheight=40) But then ......
Read more >
'Height' in track's option doesn't work · Issue #243 · igvteam/igv.js
Hi, The height property doesn't work. I need to change the height by set the 'set track height' after opening.
Read more >
Wrap text not adjust row height - Office - Microsoft Learn
Workaround. To adjust the height of the row to fit all the text in a cell, follow these steps: Select the row you...
Read more >
Sovol SV03 setup guide (Z-height doesn't work like you expect)
Your browser can't play this video. Learn more. Switch camera.
Read more >
Can't change width or height in Token configuration - Reddit
(And those areas need to be larger than a 1x1 token.) When I enter a new width or height in the token configuration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found