10

Does anyone know a mean to "render" plots or at least trees in console mode (draw it in the console)?

I would be able to render small plots at end of a very long process, by drawing some figures in ASCII mode, in order to have a geeky & fun view of some stats collected into the process.

I would be pleased to discover a library which does that, and I would keep the process 100% java, no shell-hack or third-party software.

-- EDIT

@lbalazscs and @Fortega made interesting answers, but the background of my question is to know if it exists such a library, and I will add some details I missed the first time :

The output should be able to display trees, binary trees (linked by @lbalazscs here), but also simple graphs such as bargraphs or so.

I will let this question "unanswered" for a while, and if there is no probant answer, @lbalazscs will get the point ;)

Community
  • 1
  • 1
Benj
  • 1,184
  • 7
  • 26
  • 57

3 Answers3

5

You can print ascii trees with minimal code. See the second answer to this question: How to print binary tree diagram?

(the second answer because this one is not only for binary trees)

Community
  • 1
  • 1
lbalazscs
  • 17,474
  • 7
  • 42
  • 50
4

For people coming here looking for a pure Java tree drawing library: I recommend text-tree, which draws trees like this (and other styles, a lot of possible config if you need it):

some text
├─── more text
├─── and more
│    ├─── still more
│    ╰─── more
╰─── the end

Full disclosure: I am the author of text-tree.

barfuin
  • 16,865
  • 10
  • 85
  • 132
1

If I remember well, you can draw ascii graphs with javaplot

Fortega
  • 19,463
  • 14
  • 75
  • 113
  • Thanks for the tip, however it requires to have *third-party* sofware installed (GNUPlot), which I would avoid to deal with. However, +1 for making me discover this cool lib, which I will use elsewhere. – Benj Feb 03 '13 at 00:31