Skip to content

Saving a plot #2691

Answered by midichef
arisolt asked this question in Q&A
Discussion options

You must be logged in to vote

Interesting use case! Try adding this to your .visidatarc. You can copy the plot to the clipboard with gzY. Or g^O to edit a copy in an editor. Orgz" to open the screenshot in a visidata TextSheet.

## Utility class to emulate a curses screen and allow readout of drawn text via screenshot().
class ScreenLike:
    def __init__(self, w, h):
        self.w = w
        self.h = h
        self.pixels = [[' ' for _ in range(self.w)] for _ in range(self.h)]
    def getmaxyx(self):
        return self.h, self.w
    def addstr(self, y, x, ch_str, attr):
        if not (0 <= y < self.h): vd.warning(f'bad y coord in ScreenLike: y={y}')
        if not (0 <= x < self.w): vd.warning(f'bad x coord in Scr…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by arisolt
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants